| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Property Class Referenceabstract

Property base class allowing Property* collections to be "homogeneous". More...

`#include <GaudiKernel/Property.h>`

Inheritance diagram for Property:
[legend]
Collaboration diagram for Property:
[legend]

## Public Member Functions
const std::string & | name () const
| property name More...
const std::string & | documentation () const
| property documentation More...
const std::type_info * | type_info () const
| property type-info More...
std::string | type () const
| property type More...
virtual bool | load (Property &dest) const =0
| export the property value to the destination More...
virtual bool | assign (const Property &source)=0
| import the property value form the source More...
virtual std::string | toString () const =0
| value -> string More...
virtual void | toStream (std::ostream &out) const =0
| value -> stream More...
virtual StatusCode | fromString (const std::string &value)=0
| string -> value More...
const std::function< void(Property &)> & | readCallBack () const
| get a reference to the readCallBack More...
const std::function< void(Property &)> & | updateCallBack () const
| get a reference to the updateCallBack More...
virtual Property & | declareReadHandler (std::function< void(Property &)> fun)
| set new callback for reading More...
virtual Property & | declareUpdateHandler (std::function< void(Property &)> fun)
| set new callback for update More...
template<class HT >
Property & | declareReadHandler (void(HT::*MF)(Property &), HT *instance)
template<class HT >
Property & | declareUpdateHandler (void(HT::*MF)(Property &), HT *instance)
virtual void | useReadHandler () const
| use the call-back function at reading More...
virtual bool | useUpdateHandler ()
| use the call-back function at update More...
virtual | ~Property ()=default
| virtual destructor More...
virtual Property * | clone () const =0
| clone: "virtual constructor" More...
void | setName (std::string value)
| set the new value for the property name More...
void | setDocumentation (std::string documentation)
| set the documentation string More...
virtual std::ostream & | fillStream (std::ostream &) const
| the printout of the property value More...

## Protected Member Functions
| Property (const std::type_info &type, std::string name="")
| constructor from the property name and the type More...
| Property (std::string name, const std::type_info &type)
| constructor from the property name and the type More...
| Property (const Property &)=default
| copy constructor More...
Property & | operator= (const Property &)=default
| assignment operator More...

## Protected Attributes
std::function< void(Property &)> | m_readCallBack
std::function< void(Property &)> | m_updateCallBack

## Private Member Functions
| Property ()

## Private Attributes
std::string | m_name
std::string | m_documentation
const std::type_info * | m_typeinfo

## Detailed Description

Property base class allowing Property* collections to be "homogeneous".

Author
  Paul Maley
  CTDay
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Definition at line 38 of file Property.h.

## Constructor & Destructor Documentation

Property::Property | ( |  | ) |
| private

virtual Property::~Property | ( |  | ) |
| virtual default

virtual destructor

Property::Property | ( | const std::type_info & | type,
|  | std::string | name = `""`
| ) |  |
| protected

constructor from the property name and the type

Definition at line 42 of file Property.cpp.

44 : m_name ( std::move(name) )
45 , m_documentation ( m_name )
46 , m_typeinfo ( &type )
47 {}
Property::m_documentation
std::string m_documentation
Definition: Property.h:115
std::move
T move(T...args)
Property::m_name
std::string m_name
Definition: Property.h:113
Property::m_typeinfo
const std::type_info * m_typeinfo
Definition: Property.h:117

Property::Property | ( | std::string | name,
|  | const std::type_info & | type
| ) |  |
| protected

constructor from the property name and the type

Definition at line 55 of file Property.cpp.

57 : m_name ( std::move(name) )
58 , m_documentation ( m_name )
59 , m_typeinfo ( &type )
60 {}
Property::m_documentation
std::string m_documentation
Definition: Property.h:115
std::move
T move(T...args)
Property::m_name
std::string m_name
Definition: Property.h:113
Property::m_typeinfo
const std::type_info * m_typeinfo
Definition: Property.h:117

Property::Property | ( | const Property & |  | ) |
| protected default

copy constructor

## Member Function Documentation

virtual bool Property::assign | ( | const Property & | source | ) |
| pure virtual

import the property value form the source

Implemented in GaudiHandleArrayProperty, GaudiHandleProperty, PropertyWithValue< TYPE >, PropertyWithValue< double >, PropertyWithValue< std::string >, PropertyWithValue< std::vector< std::string > >, PropertyWithValue< int >, PropertyWithValue< unsigned int >, PropertyWithValue< bool >, DataObjIDCollProperty, PropertyList, DataObjIDProperty, and DataObjectHandleProperty.

virtual Property* Property::clone | ( |  | ) | const
| pure virtual

clone: "virtual constructor"

Implemented in GaudiHandleArrayProperty, GaudiHandleProperty, SimplePropertyRef< TYPE, VERIFIER >, SimpleProperty< TYPE, VERIFIER >, SimpleProperty< double >, SimpleProperty< std::string >, SimpleProperty< std::vector< std::string > >, SimpleProperty< int >, SimpleProperty< unsigned int >, SimpleProperty< bool >, DataObjIDCollProperty, DataObjIDProperty, and DataObjectHandleProperty.

Property & Property::declareReadHandler | ( | std::function< void(Property &)> | fun | ) |
| virtual

set new callback for reading

Definition at line 64 of file Property.cpp.

65 {
66 m_readCallBack = std::move(fun);
67 return *this;
68 }
std::move
T move(T...args)
Property::m_readCallBack
std::function< void(Property &)> m_readCallBack
Definition: Property.h:120
template<class HT >

Property& Property::declareReadHandler | ( | void(HT::*)(Property &) | MF,
|  | HT * | instance
| ) |  |
| inline

Definition at line 75 of file Property.h.

76 { return declareReadHandler( [=](Property& p) { (instance->*MF)(p); } ) ; }
Property::declareReadHandler
virtual Property & declareReadHandler(std::function< void(Property &)> fun)
set new callback for reading
Definition: Property.cpp:64
Property
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38

Property & Property::declareUpdateHandler | ( | std::function< void(Property &)> | fun | ) |
| virtual

set new callback for update

Definition at line 72 of file Property.cpp.

73 {
74 m_updateCallBack = std::move(fun);
75 return *this;
76 }
std::move
T move(T...args)
Property::m_updateCallBack
std::function< void(Property &)> m_updateCallBack
Definition: Property.h:122
template<class HT >

Property& Property::declareUpdateHandler | ( | void(HT::*)(Property &) | MF,
|  | HT * | instance
| ) |  |
| inline

Definition at line 79 of file Property.h.

80 { return declareUpdateHandler ( [=](Property& p) { (instance->*MF)(p); } ); }
Property::declareUpdateHandler
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
Property
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38

const std::string& Property::documentation | ( |  | ) | const
| inline

property documentation

Definition at line 47 of file Property.h.

47 { return m_documentation; }
Property::m_documentation
std::string m_documentation
Definition: Property.h:115

std::ostream & Property::fillStream | ( | std::ostream & | stream | ) | const
| virtual

the printout of the property value

Definition at line 111 of file Property.cpp.

112 { return stream << " '" <<name() << "':" << toString() ; }
Property::toString
virtual std::string toString() const =0
value -> string
Property::name
const std::string & name() const
property name
Definition: Property.h:45

virtual StatusCode Property::fromString | ( | const std::string & | value | ) |
| pure virtual

string -> value

Implemented in GaudiHandleArrayProperty, GaudiHandleProperty, PropertyWithValue< TYPE >, PropertyWithValue< double >, PropertyWithValue< std::string >, PropertyWithValue< std::vector< std::string > >, PropertyWithValue< int >, PropertyWithValue< unsigned int >, PropertyWithValue< bool >, DataObjIDCollProperty, DataObjIDProperty, and DataObjectHandleProperty.

virtual bool Property::load | ( | Property & | dest | ) | const
| pure virtual

export the property value to the destination

Implemented in GaudiHandleArrayProperty, GaudiHandleProperty, PropertyWithValue< TYPE >, PropertyWithValue< double >, PropertyWithValue< std::string >, PropertyWithValue< std::vector< std::string > >, PropertyWithValue< int >, PropertyWithValue< unsigned int >, PropertyWithValue< bool >, DataObjIDCollProperty, PropertyList, DataObjIDProperty, and DataObjectHandleProperty.

const std::string& Property::name | ( |  | ) | const
| inline

property name

Definition at line 45 of file Property.h.

45 { return m_name ; }
Property::m_name
std::string m_name
Definition: Property.h:113

Property& Property::operator= | ( | const Property & |  | ) |
| protected default

assignment operator

const std::function<void(Property&)>& Property::readCallBack | ( |  | ) | const
| inline

get a reference to the readCallBack

Definition at line 65 of file Property.h.

65 { return m_readCallBack; }
Property::m_readCallBack
std::function< void(Property &)> m_readCallBack
Definition: Property.h:120

void Property::setDocumentation | ( | std::string | documentation | ) |
| inline

set the documentation string

Definition at line 94 of file Property.h.

94 {
95 m_documentation = std::move(documentation); }
Property::m_documentation
std::string m_documentation
Definition: Property.h:115
std::move
T move(T...args)

void Property::setName | ( | std::string | value | ) |
| inline

set the new value for the property name

Definition at line 92 of file Property.h.

92 { m_name = std::move(value) ; }
std::move
T move(T...args)
Property::m_name
std::string m_name
Definition: Property.h:113

virtual void Property::toStream | ( | std::ostream & | out | ) | const
| pure virtual

value -> stream

Implemented in GaudiHandleArrayProperty, GaudiHandleProperty, PropertyWithValue< TYPE >, PropertyWithValue< double >, PropertyWithValue< std::string >, PropertyWithValue< std::vector< std::string > >, PropertyWithValue< int >, PropertyWithValue< unsigned int >, PropertyWithValue< bool >, DataObjIDCollProperty, DataObjIDProperty, and DataObjectHandleProperty.

virtual std::string Property::toString | ( |  | ) | const
| pure virtual

value -> string

Implemented in GaudiHandleArrayProperty, GaudiHandleProperty, PropertyWithValue< TYPE >, PropertyWithValue< double >, PropertyWithValue< std::string >, PropertyWithValue< std::vector< std::string > >, PropertyWithValue< int >, PropertyWithValue< unsigned int >, PropertyWithValue< bool >, DataObjIDCollProperty, DataObjIDProperty, and DataObjectHandleProperty.

std::string Property::type | ( |  | ) | const
| inline

property type

Definition at line 51 of file Property.h.

51 { return m_typeinfo->name() ; }
std::type_info::name
T name(T...args)
Property::m_typeinfo
const std::type_info * m_typeinfo
Definition: Property.h:117

const std::type_info* Property::type_info | ( |  | ) | const
| inline

property type-info

Definition at line 49 of file Property.h.

49 { return m_typeinfo ; }
Property::m_typeinfo
const std::type_info * m_typeinfo
Definition: Property.h:117

const std::function<void(Property&)>& Property::updateCallBack | ( |  | ) | const
| inline

get a reference to the updateCallBack

Definition at line 67 of file Property.h.

67 { return m_updateCallBack; }
Property::m_updateCallBack
std::function< void(Property &)> m_updateCallBack
Definition: Property.h:122

void Property::useReadHandler | ( |  | ) | const
| virtual

use the call-back function at reading

Definition at line 80 of file Property.cpp.

81 {
82 if ( !m_readCallBack ) { return ; } // RETURN
83 // avoid infinite loop
84 std::function<void(Property&)> theCallBack;
85 theCallBack.swap(m_readCallBack);
86 theCallBack( const_cast<Property&>(*this) ) ;
87 m_readCallBack.swap(theCallBack);
88 }
std::function< void(Property &)>
std::function::swap
T swap(T...args)
Property::m_readCallBack
std::function< void(Property &)> m_readCallBack
Definition: Property.h:120

bool Property::useUpdateHandler | ( |  | ) |
| virtual

use the call-back function at update

Definition at line 92 of file Property.cpp.

93 {
94 bool sc(true);
95 if ( !m_updateCallBack ) { return sc; } // RETURN
96 // avoid infinite loop
97 std::function<void(Property&)> theCallBack;
98 theCallBack.swap(m_updateCallBack);
99 try {
100 theCallBack( *this ) ;
101 } catch(...) {
102 sc = false;
103 }
104 m_updateCallBack.swap(theCallBack);
105 return sc;
106 }
std::function< void(Property &)>
std::function::swap
T swap(T...args)
merge_files.sc
int sc
Definition: merge_files.py:167
Property::m_updateCallBack
std::function< void(Property &)> m_updateCallBack
Definition: Property.h:122

## Member Data Documentation

std::string Property::m_documentation
| private

Definition at line 115 of file Property.h.

std::string Property::m_name
| private

Definition at line 113 of file Property.h.

std::function<void(Property&)> Property::m_readCallBack
| mutable protected

Definition at line 120 of file Property.h.

const std::type_info* Property::m_typeinfo
| private

Definition at line 117 of file Property.h.

std::function<void(Property&)> Property::m_updateCallBack
| protected

Definition at line 122 of file Property.h.

The documentation for this class was generated from the following files:

- GaudiKernel/GaudiKernel/Property.h
- GaudiKernel/src/Lib/Property.cpp