20 #include "GaudiKernel/IProperty.h"
21 #include "GaudiKernel/SmartIF.h"
22 #include "GaudiKernel/Property.h"
23 #include "GaudiKernel/PropertyCallbackFunctor.h"
24 #include "GaudiKernel/GaudiHandle.h"
28 #include "boost/algorithm/string/case_conv.hpp"
48 (
const std::type_info&
type ,
49 const std::string& name )
51 , m_documentation ( name )
52 , m_typeinfo ( &type )
53 , m_readCallBack ( 0 )
54 , m_updateCallBack ( 0 )
63 (
const std::string& name ,
64 const std::type_info& type )
66 , m_documentation ( name )
67 , m_typeinfo ( &type )
68 , m_readCallBack ( 0 )
69 , m_updateCallBack ( 0 )
79 , m_readCallBack ( 0 )
80 , m_updateCallBack ( 0 )
92 if ( &right ==
this ) {
return *this ; }
157 (*theCallBack)(
const_cast<Property&
>(p) ) ;
171 (*theCallBack)( *this ) ;
183 {
return stream <<
" '" <<
name() <<
"':" <<
toString() ; }
205 const std::string& name )
208 if ( 0 == p ) {
return false ; }
233 const std::string& name )
235 if ( 0 == p ) {
return false ; }
247 m_pValue->setPropertyName( name );
299 std::vector< std::string > tmp;
312 struct _ByName_ :
public std::unary_function<const Property*,bool>
315 _ByName_ (
const std::string& name )
316 : m_name (
boost::algorithm::to_lower_copy( name ) ) {}
318 bool operator () (
const Property* p )
const
320 if ( 0 == p ) {
return false ; }
321 return m_name == boost::algorithm::to_lower_copy( p->
name() ) ;
350 const std::string& name )
353 if ( 0 == p ) {
return 0 ; }
355 typedef std::vector<Property*> List ;
357 if ( lst.empty() ) {
return 0 ; }
359 List::const_iterator ifound =
360 std::find_if ( lst.begin() , lst.end() , _ByName_( name ) ) ;
361 if ( lst.end() == ifound ) {
return 0 ; }
388 if ( 0 == p ) {
return 0 ; }
391 if ( 0 == _i ) {
return 0 ; }
393 if ( !property ) {
return 0 ; }
421 (
const std::vector<const Property*>* p ,
422 const std::string& name )
452 (
const std::vector<const Property*>* p ,
453 const std::string& name )
456 if ( 0 == p ) {
return 0 ; }
457 std::vector<const Property*>::const_iterator ifound =
458 std::find_if ( p->begin() , p->end() , _ByName_( name ) ) ;
459 if ( p->end() == ifound ) {
return 0 ; }
480 const std::string& name ,
482 const std::string& doc )
484 const std::string val = std::string( value ) ;
503 const std::string& name ,
504 const std::string& value ,
505 const std::string& doc )
513 if ( 0 != p ) { p -> setDocumentation ( doc ) ; }
543 const std::string& name ,
545 const std::string& doc )
580 const std::string& name ,
582 const std::string& doc )
583 {
return setProperty ( component , name , &property , doc ) ; }
600 const std::string& name ,
601 const std::string& value ,
602 const std::string& doc )
607 return setProperty ( property , name , value , doc ) ;
625 const std::string& name ,
627 const std::string& doc )
629 const std::string val = std::string( value ) ;
630 return setProperty ( component , name , val , doc ) ;
657 const std::string& name ,
659 const std::string& doc )
664 return setProperty ( prop , name , property , doc ) ;
691 const std::string& name ,
693 const std::string& doc )
694 {
return setProperty ( component , name , &property , doc ) ; }
StatusCode setProperty(IProperty *component, const std::string &name, const TYPE &value, const std::string &doc)
simple function to set the property of the given object from the value
std::string m_documentation
virtual void useReadHandler() const
use the call-back function at reading
bool setValue(const GaudiHandleArrayBase &value)
virtual bool assign(const Property &source)=0
import the property value form the source
virtual const std::vector< Property * > & getProperties() const =0
Get list of properties.
virtual std::string toString() const
value -> string
virtual std::string toString() const =0
value -> string
const std::string & name() const
property name
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
GAUDI_API bool hasProperty(const IProperty *p, const std::string &name)
simple function which check the existence of the property with the given name.
virtual void declareReadHandler(PropertyCallbackFunctor *pf)
set new callback for reading
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
const char *PyHelper() getProperty(IInterface *p, char *name)
bool isFailure() const
Test for a status code of FAILURE.
Property & operator=(const Property &right)
assignment operator
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
const std::type_info * m_typeinfo
GaudiHandleArrayProperty(const std::string &name, GaudiHandleArrayBase &ref)
virtual void toStream(std::ostream &out) const
value -> stream
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
GaudiHandleProperty(const std::string &name, GaudiHandleBase &ref)
PropertyCallbackFunctor * m_updateCallBack
std::ostream & toStream(ITERATOR first, ITERATOR last, std::ostream &s, const std::string &open, const std::string &close, const std::string &delim)
the helper function to print the sequence
virtual std::string toString() const
value -> string
bool setTypesAndNames(const std::vector< std::string > &myTypesAndNamesList)
Set the array of handles from list of "type/name" strings in .
virtual bool useUpdateHandler()
use the call-back function at update
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
const PropertyCallbackFunctor * updateCallBack() const
Call-back functor for update: the functor is owned by property!
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
void setDocumentation(const std::string &documentation)
set the documentation string
GAUDI_API Property * getProperty(const IProperty *p, const std::string &name)
simple function which gets the property with given name from the component
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
Base class of array's of various gaudihandles.
Property base class allowing Property* collections to be "homogeneous".
virtual StatusCode fromString(const std::string &s)
string -> value
void setTypeAndName(const std::string &myTypeAndName)
The component "type/name" string.
std::ostream & operator<<(std::ostream &stream, const Property &prop)
The output operator for friendly printout.
GaudiHandleBase * m_pValue
Pointer to the real property.
const std::vector< std::string > typesAndNames() const
Return a vector with "type/name" strings of all handles in the array.
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
std::string typeAndName() const
The full type and name: "type/name".
const PropertyCallbackFunctor * readCallBack() const
Call-back functor at reading: the functor is owned by property!
The IProperty is the basic interface for all components which have properties that can be set or get...
void setPropertyName(const std::string &propName)
set name as used in declareProperty(name,gaudiHandle).
virtual StatusCode fromString(const std::string &s)
string -> value
PropertyCallbackFunctor * m_readCallBack
virtual Property * clone() const =0
clone: "virtual constructor"
virtual ~Property()
virtual destructor
bool setValue(const GaudiHandleBase &value)
virtual void toStream(std::ostream &out) const
value -> stream