Property Class Referenceabstract

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

#include <GaudiKernel/Property.h>

Inheritance diagram for Property:
Collaboration diagram for Property:

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 PropertydeclareReadHandler (std::function< void(Property &)> fun)
 set new callback for reading More...
 
virtual PropertydeclareUpdateHandler (std::function< void(Property &)> fun)
 set new callback for update More...
 
template<class HT >
PropertydeclareReadHandler (void(HT::*MF)(Property &), HT *instance)
 
template<class HT >
PropertydeclareUpdateHandler (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 Propertyclone () 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...
 
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 PropertydeclareReadHandler (std::function< void(Property &)> fun)
 set new callback for reading More...
 
virtual PropertydeclareUpdateHandler (std::function< void(Property &)> fun)
 set new callback for update More...
 
template<class HT >
PropertydeclareReadHandler (void(HT::*MF)(Property &), HT *instance)
 
template<class HT >
PropertydeclareUpdateHandler (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 Propertyclone () 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...
 
Propertyoperator= (const Property &)=default
 assignment operator More...
 
 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...
 
Propertyoperator= (const Property &)=default
 assignment operator More...
 

Protected Attributes

std::function< void(Property &)> m_readCallBack
 
std::function< void(Property &)> m_updateCallBack
 

Private Member Functions

 Property ()
 
 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 ( )
virtualdefault

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) )
46  , m_typeinfo ( &type )
47 {}
std::string m_documentation
Definition: Property.h:115
const std::string & name() const
property name
Definition: Property.h:45
const std::type_info * m_typeinfo
Definition: Property.h:117
std::string type() const
property type
Definition: Property.h:51
std::string m_name
Definition: Property.h:113
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) )
59  , m_typeinfo ( &type )
60 {}
std::string m_documentation
Definition: Property.h:115
const std::string & name() const
property name
Definition: Property.h:45
const std::type_info * m_typeinfo
Definition: Property.h:117
std::string type() const
property type
Definition: Property.h:51
std::string m_name
Definition: Property.h:113
Property::Property ( const Property )
protecteddefault

copy constructor

Property::Property ( )
private
virtual Property::~Property ( )
virtualdefault

virtual destructor

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

constructor from the property name and the type

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

constructor from the property name and the type

Property::Property ( const Property )
protecteddefault

copy constructor

Member Function Documentation

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

set new callback for reading

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::function< void(Property &)> m_readCallBack
Definition: Property.h:120
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
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); } ) ; }
virtual Property & declareReadHandler(std::function< void(Property &)> fun)
set new callback for reading
Definition: Property.cpp:64
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
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); } ) ; }
virtual Property & declareReadHandler(std::function< void(Property &)> fun)
set new callback for reading
Definition: Property.cpp:64
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
virtual Property& Property::declareUpdateHandler ( std::function< void(Property &)>  fun)
virtual

set new callback for update

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::function< void(Property &)> m_updateCallBack
Definition: Property.h:122
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
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); } ); }
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
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); } ); }
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
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; }
std::string m_documentation
Definition: Property.h:115
const std::string& Property::documentation ( ) const
inline

property documentation

Definition at line 47 of file Property.h.

47 { return 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() ; }
virtual std::string toString() const =0
value -> string
const std::string & name() const
property name
Definition: Property.h:45
virtual std::ostream& Property::fillStream ( std::ostream &  ) const
virtual

the printout of the property value

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

property name

Definition at line 45 of file Property.h.

45 { return m_name ; }
std::string m_name
Definition: Property.h:113
const std::string& Property::name ( ) const
inline

property name

Definition at line 45 of file Property.h.

45 { return m_name ; }
std::string m_name
Definition: Property.h:113
Property& Property::operator= ( const Property )
protecteddefault

assignment operator

Property& Property::operator= ( const Property )
protecteddefault

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; }
std::function< void(Property &)> m_readCallBack
Definition: Property.h:120
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; }
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); }
std::string m_documentation
Definition: Property.h:115
const std::string & documentation() const
property documentation
Definition: Property.h:47
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); }
std::string m_documentation
Definition: Property.h:115
const std::string & documentation() const
property documentation
Definition: Property.h:47
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::string m_name
Definition: Property.h:113
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::string m_name
Definition: Property.h:113
std::string Property::type ( ) const
inline

property type

Definition at line 51 of file Property.h.

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

property type

Definition at line 51 of file Property.h.

51 { return m_typeinfo->name() ; }
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 ; }
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 ; }
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; }
std::function< void(Property &)> m_updateCallBack
Definition: Property.h:122
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; }
std::function< void(Property &)> m_updateCallBack
Definition: Property.h:122
virtual void Property::useReadHandler ( ) const
virtual

use the call-back function at reading

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 &)> 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 &)> m_updateCallBack
Definition: Property.h:122
virtual bool Property::useUpdateHandler ( )
virtual

use the call-back function at update

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
mutableprotected

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: