Gaudi Framework, version v20r2

Generated: 18 Jul 2008

Property Class Reference

#include <GaudiKernel/Property.h>

Inheritance diagram for Property:

Inheritance graph
[legend]
Collaboration diagram for Property:

Collaboration graph
[legend]
List of all members.

Detailed Description

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

Author:
Paul Maley

CTDay

Vanya BELYAEV ibelyaev@physics.syr.edu

Definition at line 45 of file Property.h.

Public Member Functions

const std::stringname () const
 property name
const std::stringdocumentation () const
 property documentation
const std::type_infotype_info () const
 property type-info
std::string type () const
 property type
virtual bool load (Property &dest) const =0
 export the property value to the destination
virtual bool assign (const Property &source)=0
 import the property value form the source
virtual std::string toString () const=0
 value -> string
virtual StatusCode fromString (const std::string &value)=0
 string -> value
const PropertyCallbackFunctorreadCallBack () const
 Call-back functor at reading: the functor is ownered by property!
const PropertyCallbackFunctorupdateCallBack () const
 Call-back functor for update: the funtor is ownered by property!
virtual void declareReadHandler (PropertyCallbackFunctor *pf)
 set new callback for reading
virtual void declareUpdateHandler (PropertyCallbackFunctor *pf)
 set new callback for update
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
virtual void useUpdateHandler ()
 use the call-back function at update
virtual ~Property ()
 virtual destructor
virtual Propertyclone () const=0
 clone: "virtual constructor"
void setName (const std::string &value)
 set the new value for the property name
void setDocumentation (const std::string &documentation)
 set the documentation string
virtual std::ostreamfillStream (std::ostream &) const
 the printout of the property value

Protected Member Functions

 Property (const std::type_info &type, const std::string &name="")
 constructor from the property name and the type
 Property (const std::string &name, const std::type_info &type)
 constructor from the property name and the type
 Property (const Property &right)
 copy constructor
Propertyoperator= (const Property &right)
 assignement operator

Protected Attributes

PropertyCallbackFunctorm_readCallBack
PropertyCallbackFunctorm_updateCallBack

Private Member Functions

 Property ()

Private Attributes

std::string m_name
std::string m_documentation
const std::type_infom_typeinfo


Constructor & Destructor Documentation

Property::~Property (  )  [virtual]

virtual destructor

Definition at line 112 of file Property.cpp.

References m_readCallBack, and m_updateCallBack.

00113 {
00114   if ( 0 != m_readCallBack   ) 
00115   { delete m_readCallBack    ; m_readCallBack    = 0 ; }
00116   if ( 0 != m_updateCallBack ) 
00117   { delete m_updateCallBack  ; m_updateCallBack  = 0 ; }  
00118 } 

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.

00050   : m_name            (  name ) 
00051   , m_documentation   ( name )
00052   , m_typeinfo        ( &type )
00053   , m_readCallBack    (  0  ) 
00054   , m_updateCallBack  (  0  )
00055 {}  

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.

00065   : m_name            (  name ) 
00066   , m_documentation   ( name )
00067   , m_typeinfo        ( &type )
00068   , m_readCallBack    (  0  ) 
00069   , m_updateCallBack  (  0  )
00070 {}  

Property::Property ( const Property right  )  [protected]

copy constructor

Definition at line 75 of file Property.cpp.

References m_readCallBack, and m_updateCallBack.

00076   : m_name     ( right.m_name     ) 
00077   , m_documentation ( right.m_documentation )
00078   , m_typeinfo ( right.m_typeinfo )
00079   , m_readCallBack   ( 0 ) 
00080   , m_updateCallBack ( 0 )
00081 {
00082   if ( 0 != right.m_readCallBack   ) 
00083   { m_readCallBack   = right.m_readCallBack   -> clone () ; }
00084   if ( 0 != right.m_updateCallBack ) 
00085   { m_updateCallBack = right.m_updateCallBack -> clone () ; }  
00086 }

Property::Property (  )  [private]


Member Function Documentation

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

property name

Definition at line 49 of file Property.h.

References m_name.

Referenced by JobOptionsCatalogue::addProperty(), JobOptionsSvc::addPropertyToCatalogue(), fillStream(), GaudiHandleArrayProperty::GaudiHandleArrayProperty(), PropertyMgr::getProperty(), GaudiCommon< PBASE >::msgLevelHandler(), configGenerator::pythonizeValue(), PropertyMgr::setProperty(), MessageSvc::setupColors(), IssueLogger::setupLevels(), MessageSvc::setupLimits(), IssueLogger::setupStreams(), and MessageSvc::setupThreshold().

00049 { return m_name             ; } ;

const std::string& Property::documentation (  )  const [inline]

property documentation

Definition at line 51 of file Property.h.

References m_documentation.

Referenced by setDocumentation().

00051 { return m_documentation; };

const std::type_info* Property::type_info (  )  const [inline]

property type-info

Definition at line 53 of file Property.h.

References m_typeinfo.

Referenced by configGenerator::pythonizeValue().

00053 { return m_typeinfo         ; } ;

std::string Property::type (  )  const [inline]

property type

Definition at line 55 of file Property.h.

References m_typeinfo, and std::type_info::name().

00055 { return m_typeinfo->name() ; } ;  

virtual bool Property::load ( Property dest  )  const [pure virtual]

export the property value to the destination

Implemented in PropertyWithValue< TYPE >, GaudiHandleProperty, GaudiHandleArrayProperty, PropertyList, and PropertyWithValue< std::vectorstring >.

Referenced by JobOptionsSvc::addPropertyToCatalogue(), and PropertyMgr::getProperty().

virtual bool Property::assign ( const Property source  )  [pure virtual]

import the property value form the source

Implemented in PropertyWithValue< TYPE >, GaudiHandleProperty, GaudiHandleArrayProperty, PropertyList, PropertyWithValue< std::vectorstring >, and PropertyWithValue< TYPE >.

Referenced by GaudiHandleArrayProperty::load(), GaudiHandleProperty::load(), PropertyWithValue< TYPE >::load(), PropertyMgr::setProperty(), and Gaudi::Utils::setProperty().

virtual std::string Property::toString (  )  const [pure virtual]

value -> string

Implemented in PropertyWithValue< TYPE >, GaudiHandleProperty, GaudiHandleArrayProperty, PropertyWithValue< std::vectorstring >, and PropertyWithValue< TYPE >.

Referenced by GaudiHandleArrayProperty::assign(), GaudiHandleProperty::assign(), PropertyWithValue< TYPE >::assign(), fillStream(), PropertyMgr::getProperty(), and configGenerator::pythonizeValue().

virtual StatusCode Property::fromString ( const std::string value  )  [pure virtual]

string -> value

Implemented in PropertyWithValue< TYPE >, GaudiHandleProperty, GaudiHandleArrayProperty, and PropertyWithValue< std::vectorstring >.

Referenced by PropertyMgr::setProperty().

const PropertyCallbackFunctor * Property::readCallBack (  )  const

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

Definition at line 122 of file Property.cpp.

References m_readCallBack.

00123 { return m_readCallBack ; }  

const PropertyCallbackFunctor * Property::updateCallBack (  )  const

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

Definition at line 127 of file Property.cpp.

References m_updateCallBack.

00128 { return m_updateCallBack ; }

void Property::declareReadHandler ( PropertyCallbackFunctor pf  )  [virtual]

set new callback for reading

Definition at line 132 of file Property.cpp.

References m_readCallBack.

00133 {
00134   if ( 0 != m_readCallBack   ) 
00135   { delete m_readCallBack    ; m_readCallBack    = 0 ; }
00136   m_readCallBack = pf ;
00137 } 

void Property::declareUpdateHandler ( PropertyCallbackFunctor pf  )  [virtual]

set new callback for update

Definition at line 141 of file Property.cpp.

References m_updateCallBack.

Referenced by Algorithm::Algorithm(), AlgTool::AlgTool(), ApplicationMgr::configure(), GaudiSequencer::GaudiSequencer(), HistogramSvc::HistogramSvc(), IssueLogger::IssueLogger(), MinimalEventLoopMgr::MinimalEventLoopMgr(), PersistencySvc::PersistencySvc(), Sequencer::Sequencer(), Service::Service(), and THistSvc::THistSvc().

00142 {
00143   if ( 0 != m_updateCallBack   ) 
00144   { delete m_updateCallBack    ; m_updateCallBack    = 0 ; }
00145   m_updateCallBack = pf ;
00146 } 

template<class HT>
void Property::declareReadHandler ( void(HT::*)(Property &)  MF,
HT *  instance 
) [inline]

Definition at line 130 of file Property.h.

template<class HT>
void Property::declareUpdateHandler ( void(HT::*)(Property &)  MF,
HT *  instance 
) [inline]

Definition at line 135 of file Property.h.

void Property::useReadHandler (  )  const [virtual]

use the call-back function at reading

Definition at line 150 of file Property.cpp.

References m_readCallBack, and return.

Referenced by GaudiHandleArrayProperty::toString(), GaudiHandleProperty::toString(), PropertyWithValue< TYPE >::toString(), GaudiHandleArrayProperty::value(), GaudiHandleProperty::value(), and PropertyWithValue< TYPE >::value().

00151 {
00152   if ( 0 == m_readCallBack ) { return ; }               // RETURN
00153   const Property& p = *this ;
00154   PropertyCallbackFunctor* theCallBack = m_readCallBack;
00155   // avoid infinite loop
00156   m_readCallBack = 0;
00157   (*theCallBack)( const_cast<Property&>(p) ) ;
00158   m_readCallBack = theCallBack;
00159 } 

void Property::useUpdateHandler (  )  [virtual]

use the call-back function at update

Definition at line 163 of file Property.cpp.

References m_updateCallBack, and return.

Referenced by GaudiHandleArrayProperty::fromString(), GaudiHandleProperty::fromString(), PropertyWithVerifier< TYPE, VERIFIER >::set(), GaudiHandleArrayProperty::setValue(), and GaudiHandleProperty::setValue().

00164 {
00165   if ( 0 == m_updateCallBack ) { return ; }              // RETURN
00166   PropertyCallbackFunctor* theCallBack = m_updateCallBack;
00167   // avoid infinite loop
00168   m_updateCallBack = 0;
00169   (*theCallBack)( *this ) ;
00170   m_updateCallBack = theCallBack;
00171 } 

virtual Property* Property::clone (  )  const [pure virtual]

clone: "virtual constructor"

Implemented in SimpleProperty< TYPE, VERIFIER >, SimplePropertyRef< TYPE, VERIFIER >, GaudiHandleProperty, GaudiHandleArrayProperty, and SimpleProperty< std::vectorstring > >.

Referenced by PropertyMgr::operator=(), operator=(), and PropertyMgr::PropertyMgr().

void Property::setName ( const std::string value  )  [inline]

set the new value for the property name

Definition at line 90 of file Property.h.

References m_name.

00090 { m_name = value ; }

void Property::setDocumentation ( const std::string documentation  )  [inline]

set the documentation string

Definition at line 92 of file Property.h.

References documentation(), and m_documentation.

Referenced by PropertyMgr::declareProperty(), and Gaudi::Utils::setProperty().

00092                                                           { 
00093     m_documentation = documentation; };

std::ostream & Property::fillStream ( std::ostream  )  const [virtual]

the printout of the property value

Definition at line 176 of file Property.cpp.

References name(), and toString().

Referenced by HistorySvc::dumpProp(), and operator<<().

00177 { return stream << " '" <<name() << "':" << toString() ; }

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

assignement operator

Definition at line 90 of file Property.cpp.

References clone(), m_documentation, m_name, m_readCallBack, m_typeinfo, and m_updateCallBack.

00091 {
00092   if ( &right == this ) { return *this ; }
00093   //
00094   m_name     = right.m_name ;
00095   m_documentation = right.m_documentation ;
00096   m_typeinfo = right.m_typeinfo ;  
00097   //
00098   if ( 0 !=       m_readCallBack   ) 
00099   { delete m_readCallBack   ; m_readCallBack   = 0 ; }
00100   if ( 0 !=       m_updateCallBack ) 
00101   { delete m_updateCallBack ; m_updateCallBack = 0 ; }
00102   if ( 0 != right.m_readCallBack   ) 
00103   { m_readCallBack   = right.m_readCallBack   -> clone () ; }
00104   if ( 0 != right.m_updateCallBack ) 
00105   { m_updateCallBack = right.m_updateCallBack -> clone () ; }  
00106   // 
00107   return *this ;
00108 } 


Member Data Documentation

std::string Property::m_name [private]

Definition at line 114 of file Property.h.

Referenced by name(), operator=(), and setName().

std::string Property::m_documentation [private]

Definition at line 116 of file Property.h.

Referenced by documentation(), operator=(), and setDocumentation().

const std::type_info* Property::m_typeinfo [private]

Definition at line 118 of file Property.h.

Referenced by operator=(), type(), and type_info().

PropertyCallbackFunctor* Property::m_readCallBack [mutable, protected]

Definition at line 121 of file Property.h.

Referenced by declareReadHandler(), operator=(), Property(), readCallBack(), useReadHandler(), and ~Property().

PropertyCallbackFunctor* Property::m_updateCallBack [protected]

Definition at line 123 of file Property.h.

Referenced by declareUpdateHandler(), operator=(), Property(), updateCallBack(), useUpdateHandler(), and ~Property().


The documentation for this class was generated from the following files:
Generated at Fri Jul 18 12:09:02 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004