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 PropertyCallbackFunctorreadCallBack () const
 Call-back functor at reading: the functor is owned by property! More...
 
const PropertyCallbackFunctorupdateCallBack () const
 Call-back functor for update: the functor is owned by property! More...
 
virtual void declareReadHandler (PropertyCallbackFunctor *pf)
 set new callback for reading More...
 
virtual void declareUpdateHandler (PropertyCallbackFunctor *pf)
 set new callback for update More...
 
template<class HT >
void declareReadHandler (void(HT::*MF)(Property &), HT *instance)
 
template<class HT >
void 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 ()
 virtual destructor More...
 
virtual Propertyclone () const =0
 clone: "virtual constructor" More...
 
void setName (const std::string &value)
 set the new value for the property name More...
 
void setDocumentation (const 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 PropertyCallbackFunctorreadCallBack () const
 Call-back functor at reading: the functor is owned by property! More...
 
const PropertyCallbackFunctorupdateCallBack () const
 Call-back functor for update: the functor is owned by property! More...
 
virtual void declareReadHandler (PropertyCallbackFunctor *pf)
 set new callback for reading More...
 
virtual void declareUpdateHandler (PropertyCallbackFunctor *pf)
 set new callback for update More...
 
template<class HT >
void declareReadHandler (void(HT::*MF)(Property &), HT *instance)
 
template<class HT >
void 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 ()
 virtual destructor More...
 
virtual Propertyclone () const =0
 clone: "virtual constructor" More...
 
void setName (const std::string &value)
 set the new value for the property name More...
 
void setDocumentation (const 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, const std::string &name="")
 constructor from the property name and the type More...
 
 Property (const std::string &name, const std::type_info &type)
 constructor from the property name and the type More...
 
 Property (const Property &right)
 copy constructor More...
 
Propertyoperator= (const Property &right)
 assignment operator More...
 
 Property (const std::type_info &type, const std::string &name="")
 constructor from the property name and the type More...
 
 Property (const std::string &name, const std::type_info &type)
 constructor from the property name and the type More...
 
 Property (const Property &right)
 copy constructor More...
 
Propertyoperator= (const Property &right)
 assignment operator More...
 

Protected Attributes

PropertyCallbackFunctorm_readCallBack
 
PropertyCallbackFunctorm_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 43 of file Property.h.

Constructor & Destructor Documentation

Property::~Property ( )
virtual

virtual destructor

Definition at line 112 of file Property.cpp.

113 {
114  if ( 0 != m_readCallBack )
115  { delete m_readCallBack ; m_readCallBack = 0 ; }
116  if ( 0 != m_updateCallBack )
117  { delete m_updateCallBack ; m_updateCallBack = 0 ; }
118 }
PropertyCallbackFunctor * m_updateCallBack
Definition: Property.h:123
PropertyCallbackFunctor * m_readCallBack
Definition: Property.h:121
Property::Property ( const std::type_info &  type,
const std::string &  name = "" 
)
protected

constructor from the property name and the type

Definition at line 48 of file Property.cpp.

50  : m_name ( name )
51  , m_documentation ( name )
52  , m_typeinfo ( &type )
53  , m_readCallBack ( 0 )
54  , m_updateCallBack ( 0 )
55 {}
std::string m_documentation
Definition: Property.h:116
const std::string & name() const
property name
Definition: Property.h:47
const std::type_info * m_typeinfo
Definition: Property.h:118
PropertyCallbackFunctor * m_updateCallBack
Definition: Property.h:123
std::string type() const
property type
Definition: Property.h:53
std::string m_name
Definition: Property.h:114
PropertyCallbackFunctor * m_readCallBack
Definition: Property.h:121
Property::Property ( const std::string &  name,
const std::type_info &  type 
)
protected

constructor from the property name and the type

Definition at line 63 of file Property.cpp.

65  : m_name ( name )
66  , m_documentation ( name )
67  , m_typeinfo ( &type )
68  , m_readCallBack ( 0 )
69  , m_updateCallBack ( 0 )
70 {}
std::string m_documentation
Definition: Property.h:116
const std::string & name() const
property name
Definition: Property.h:47
const std::type_info * m_typeinfo
Definition: Property.h:118
PropertyCallbackFunctor * m_updateCallBack
Definition: Property.h:123
std::string type() const
property type
Definition: Property.h:53
std::string m_name
Definition: Property.h:114
PropertyCallbackFunctor * m_readCallBack
Definition: Property.h:121
Property::Property ( const Property right)
protected

copy constructor

Definition at line 75 of file Property.cpp.

76  : m_name ( right.m_name )
78  , m_typeinfo ( right.m_typeinfo )
79  , m_readCallBack ( 0 )
80  , m_updateCallBack ( 0 )
81 {
82  if ( 0 != right.m_readCallBack )
83  { m_readCallBack = right.m_readCallBack -> clone () ; }
84  if ( 0 != right.m_updateCallBack )
85  { m_updateCallBack = right.m_updateCallBack -> clone () ; }
86 }
std::string m_documentation
Definition: Property.h:116
const std::type_info * m_typeinfo
Definition: Property.h:118
PropertyCallbackFunctor * m_updateCallBack
Definition: Property.h:123
std::string m_name
Definition: Property.h:114
PropertyCallbackFunctor * m_readCallBack
Definition: Property.h:121
virtual Property * clone() const =0
clone: "virtual constructor"
Property::Property ( )
private
virtual Property::~Property ( )
virtual

virtual destructor

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

constructor from the property name and the type

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

constructor from the property name and the type

Property::Property ( const Property right)
protected

copy constructor

Property::Property ( )
private

Member Function Documentation

virtual void Property::declareReadHandler ( PropertyCallbackFunctor pf)
virtual

set new callback for reading

void Property::declareReadHandler ( PropertyCallbackFunctor pf)
virtual

set new callback for reading

Definition at line 132 of file Property.cpp.

133 {
134  if ( 0 != m_readCallBack )
135  { delete m_readCallBack ; m_readCallBack = 0 ; }
136  m_readCallBack = pf ;
137 }
PropertyCallbackFunctor * m_readCallBack
Definition: Property.h:121
template<class HT >
void Property::declareReadHandler ( void(HT::*)(Property &)  MF,
HT *  instance 
)
template<class HT >
void Property::declareReadHandler ( void(HT::*)(Property &)  MF,
HT *  instance 
)
inline

Definition at line 130 of file Property.h.

virtual void declareReadHandler(PropertyCallbackFunctor *pf)
set new callback for reading
Definition: Property.cpp:132
virtual void Property::declareUpdateHandler ( PropertyCallbackFunctor pf)
virtual

set new callback for update

void Property::declareUpdateHandler ( PropertyCallbackFunctor pf)
virtual

set new callback for update

Definition at line 141 of file Property.cpp.

142 {
143  if ( 0 != m_updateCallBack )
144  { delete m_updateCallBack ; m_updateCallBack = 0 ; }
145  m_updateCallBack = pf ;
146 }
PropertyCallbackFunctor * m_updateCallBack
Definition: Property.h:123
template<class HT >
void Property::declareUpdateHandler ( void(HT::*)(Property &)  MF,
HT *  instance 
)
template<class HT >
void Property::declareUpdateHandler ( void(HT::*)(Property &)  MF,
HT *  instance 
)
inline

Definition at line 135 of file Property.h.

virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
const std::string& Property::documentation ( ) const
inline

property documentation

Definition at line 49 of file Property.h.

49 { return m_documentation; }
std::string m_documentation
Definition: Property.h:116
const std::string& Property::documentation ( ) const
inline

property documentation

Definition at line 49 of file Property.h.

49 { return m_documentation; }
std::string m_documentation
Definition: Property.h:116
std::ostream & Property::fillStream ( std::ostream &  stream) const
virtual

the printout of the property value

Definition at line 182 of file Property.cpp.

183 { return stream << " '" <<name() << "':" << toString() ; }
virtual std::string toString() const =0
value -> string
const std::string & name() const
property name
Definition: Property.h:47
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 47 of file Property.h.

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

property name

Definition at line 47 of file Property.h.

47 { return m_name ; }
std::string m_name
Definition: Property.h:114
Property& Property::operator= ( const Property right)
protected

assignment operator

Property & Property::operator= ( const Property right)
protected

assignment operator

Definition at line 90 of file Property.cpp.

91 {
92  if ( &right == this ) { return *this ; }
93  //
94  m_name = right.m_name ;
96  m_typeinfo = right.m_typeinfo ;
97  //
98  if ( 0 != m_readCallBack )
99  { delete m_readCallBack ; m_readCallBack = 0 ; }
100  if ( 0 != m_updateCallBack )
101  { delete m_updateCallBack ; m_updateCallBack = 0 ; }
102  if ( 0 != right.m_readCallBack )
103  { m_readCallBack = right.m_readCallBack -> clone () ; }
104  if ( 0 != right.m_updateCallBack )
105  { m_updateCallBack = right.m_updateCallBack -> clone () ; }
106  //
107  return *this ;
108 }
std::string m_documentation
Definition: Property.h:116
const std::type_info * m_typeinfo
Definition: Property.h:118
PropertyCallbackFunctor * m_updateCallBack
Definition: Property.h:123
std::string m_name
Definition: Property.h:114
PropertyCallbackFunctor * m_readCallBack
Definition: Property.h:121
virtual Property * clone() const =0
clone: "virtual constructor"
const PropertyCallbackFunctor* Property::readCallBack ( ) const

Call-back functor at reading: the functor is owned by property!

const PropertyCallbackFunctor * Property::readCallBack ( ) const

Call-back functor at reading: the functor is owned by property!

Definition at line 122 of file Property.cpp.

123 { return m_readCallBack ; }
PropertyCallbackFunctor * m_readCallBack
Definition: Property.h:121
void Property::setDocumentation ( const std::string &  documentation)
inline

set the documentation string

Definition at line 92 of file Property.h.

92  {
std::string m_documentation
Definition: Property.h:116
const std::string & documentation() const
property documentation
Definition: Property.h:49
void Property::setDocumentation ( const std::string &  documentation)
inline

set the documentation string

Definition at line 92 of file Property.h.

92  {
std::string m_documentation
Definition: Property.h:116
const std::string & documentation() const
property documentation
Definition: Property.h:49
void Property::setName ( const std::string &  value)
inline

set the new value for the property name

Definition at line 90 of file Property.h.

90 { m_name = value ; }
std::string m_name
Definition: Property.h:114
void Property::setName ( const std::string &  value)
inline

set the new value for the property name

Definition at line 90 of file Property.h.

90 { m_name = value ; }
std::string m_name
Definition: Property.h:114
std::string Property::type ( ) const
inline

property type

Definition at line 53 of file Property.h.

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

property type

Definition at line 53 of file Property.h.

53 { return m_typeinfo->name() ; }
const std::type_info * m_typeinfo
Definition: Property.h:118
const std::type_info* Property::type_info ( ) const
inline

property type-info

Definition at line 51 of file Property.h.

51 { return m_typeinfo ; }
const std::type_info * m_typeinfo
Definition: Property.h:118
const std::type_info* Property::type_info ( ) const
inline

property type-info

Definition at line 51 of file Property.h.

51 { return m_typeinfo ; }
const std::type_info * m_typeinfo
Definition: Property.h:118
const PropertyCallbackFunctor * Property::updateCallBack ( ) const

Call-back functor for update: the functor is owned by property!

Definition at line 127 of file Property.cpp.

128 { return m_updateCallBack ; }
PropertyCallbackFunctor * m_updateCallBack
Definition: Property.h:123
const PropertyCallbackFunctor* Property::updateCallBack ( ) const

Call-back functor for update: the functor is owned by property!

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 150 of file Property.cpp.

151 {
152  if ( 0 == m_readCallBack ) { return ; } // RETURN
153  const Property& p = *this ;
155  // avoid infinite loop
156  m_readCallBack = 0;
157  (*theCallBack)( const_cast<Property&>(p) ) ;
158  m_readCallBack = theCallBack;
159 }
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
PropertyCallbackFunctor * m_readCallBack
Definition: Property.h:121
bool Property::useUpdateHandler ( )
virtual

use the call-back function at update

Definition at line 163 of file Property.cpp.

164 {
165  bool sc(true);
166  if ( 0 == m_updateCallBack ) { return sc; } // RETURN
168  // avoid infinite loop
169  m_updateCallBack = 0;
170  try {
171  (*theCallBack)( *this ) ;
172  } catch(...) {
173  sc = false;
174  }
175  m_updateCallBack = theCallBack;
176  return sc;
177 }
PropertyCallbackFunctor * m_updateCallBack
Definition: Property.h:123
virtual bool Property::useUpdateHandler ( )
virtual

use the call-back function at update

Member Data Documentation

std::string Property::m_documentation
private

Definition at line 116 of file Property.h.

std::string Property::m_name
private

Definition at line 114 of file Property.h.

PropertyCallbackFunctor * Property::m_readCallBack
mutableprotected

Definition at line 121 of file Property.h.

const std::type_info * Property::m_typeinfo
private

Definition at line 118 of file Property.h.

PropertyCallbackFunctor * Property::m_updateCallBack
protected

Definition at line 123 of file Property.h.


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