5 #ifndef GAUDIKERNEL_PROPERTY_H
6 #define GAUDIKERNEL_PROPERTY_H
47 const std::string&
name ()
const {
return m_name ; }
51 const std::type_info*
type_info ()
const {
return m_typeinfo ; }
53 std::string
type ()
const {
return m_typeinfo->name() ; }
57 virtual bool assign (
const Property& source ) = 0 ;
60 virtual std::string
toString ()
const = 0 ;
62 virtual void toStream(std::ostream& out)
const = 0;
75 void declareReadHandler
76 (
void ( HT::* MF ) (
Property& ) , HT* instance ) ;
78 void declareUpdateHandler
79 (
void ( HT::* MF ) (
Property& ) , HT* instance ) ;
81 virtual void useReadHandler ()
const ;
83 virtual bool useUpdateHandler () ;
88 virtual Property* clone ()
const = 0 ;
93 m_documentation = documentation; }
95 virtual std::ostream& fillStream ( std::ostream& )
const ;
99 (
const std::type_info&
type ,
100 const std::string& name =
"" ) ;
103 (
const std::string& name ,
104 const std::type_info&
type ) ;
146 template <
class TYPE>
154 typedef typename Traits::PVal
PVal ;
160 (
const std::string&
name ,
166 template <
class OTHER>
175 template <
class OTHER>
181 operator const TYPE& ()
const {
return value() ;}
183 inline const TYPE&
value()
const ;
196 virtual std::string
toString ()
const ;
198 virtual void toStream (std::ostream& out)
const ;
204 Traits::assign(*
m_value, value);
223 template <
class TYPE>
226 (
const std::string& name ,
229 :
Property (
typeid( TYPE ) , name )
236 template <
class TYPE>
241 , m_own ( right.
m_own )
243 m_value = Traits::copy ( right.
value() , m_own ) ;
248 template <
class TYPE>
249 template <
class OTHER>
254 , m_own ( right.
m_own )
256 m_value = Traits::copy ( right.
value() , m_own ) ;
261 template <
class TYPE>
264 Traits::dele ( m_value , m_own ) ;
270 template <
class TYPE>
274 if ( !setValue ( value ) )
275 {
throw std::out_of_range(
"Value not verified" ) ; }
281 template <
class TYPE>
288 if ( 0 != p ) {
return setValue ( p->
value() ) ; }
290 return this->fromString( source.
toString() ).isSuccess() ;
295 template <
class TYPE>
300 return dest.
assign( *
this ) ;
305 template <
class TYPE>
315 template <
class TYPE>
325 template <
class TYPE>
342 return this->
value() ;
353 template <
class TYPE>
356 { useReadHandler() ;
return *m_value ; }
360 template <
class TYPE>
373 template <
class TYPE>
374 template <
class OTHER>
395 template<
class TYPE,
class VERIFIER>
403 (
const std::string& name ,
418 bool set(
const TYPE& value ) ;
420 virtual bool setValue(
const TYPE& value ) {
return set( value ) ; }
422 template <
class OTHER,
class OTHERVERIFIER>
426 template <
class OTHER>
447 template <
class TYPE,
class VERIFIER>
452 if ( !m_verifier.isValid( &value ) ) {
return false ; }
454 this->i_set( value ) ;
456 return this->useUpdateHandler() ;
461 template <
class TYPE,
class VERIFIER>
471 template <
class TYPE,
class VERIFIER>
472 template <
class OTHER>
482 template <
class TYPE,
class VERIFIER>
483 template <
class OTHER,
class OTHERVERIFIER>
504 template <
class TYPE,
class VERIFIER = BoundedVerifier<TYPE> >
516 ( VERIFIER
verifier = VERIFIER() ) ;
519 (
const TYPE& value ,
523 (
const std::string& name ,
527 template <
class OTHER>
538 template <
class OTHER>
545 template <
class TYPE,
class VERIFIER>
547 ( VERIFIER verifier )
549 (
"" , Traits::new_() , true , verifier )
554 template <
class TYPE,
class VERIFIER>
556 (
const TYPE& value ,
559 (
"" , Traits::new_(value) , true , verifier )
564 template <
class TYPE,
class VERIFIER>
566 (
const std::string& name ,
570 ( name , Traits::new_(value) , true , verifier )
575 template <
class TYPE,
class VERIFIER>
576 template <
class OTHER>
580 ( right.
name() , Traits::new_( right.
value() ) ,
true , VERIFIER() )
585 template <
class TYPE,
class VERIFIER>
594 template <
class TYPE,
class VERIFIER>
599 template <
class TYPE,
class VERIFIER>
607 template <
class TYPE,
class VERIFIER>
618 template <
class TYPE,
class VERIFIER>
619 template <
class OTHER>
640 template<
class TYPE,
class VERIFIER = NullVerifier<TYPE> >
647 (
const std::string& name ,
649 VERIFIER verifier = VERIFIER() ) ;
659 template <
class OTHER>
668 template <
class TYPE,
class VERIFIER>
670 (
const std::string& name ,
678 template <
class TYPE,
class VERIFIER>
687 template <
class TYPE,
class VERIFIER>
692 template <
class TYPE,
class VERIFIER>
700 template <
class TYPE,
class VERIFIER>
711 template <
class TYPE,
class VERIFIER>
712 template <
class OTHER>
820 virtual std::string
toString()
const;
822 virtual void toStream(std::ostream& out)
const;
850 return destination.
assign( *
this );
879 virtual std::string
toString()
const;
881 virtual void toStream(std::ostream& out)
const;
910 return destination.
assign( *
this );
984 (
const IProperty* p ,
const std::string& name ) ;
1004 (
const IInterface* p ,
const std::string& name ) ;
1029 (
const std::vector<const Property*>* p ,
1030 const std::string& name ) ;
1055 (
const std::vector<const Property*>* p ,
1056 const std::string& name ) ;
1081 template <
class TYPE>
1084 const std::string& name ,
1086 const std::string& doc ) ;
1110 template <
class TYPE>
1113 const std::string& name ,
1115 {
return setProperty ( component , name , value , std::string() ) ; }
1132 const std::string& name ,
1133 const std::string& value ,
1134 const std::string& doc =
"" ) ;
1151 const std::string& name ,
1153 const std::string& doc =
"" ) ;
1168 template <
unsigned N>
1171 const std::string& name ,
1172 const char (&value)[
N] ,
1173 const std::string& doc =
"" )
1176 const std::string val = std::string ( value , value + N ) ;
1177 return setProperty ( component , name , val , doc ) ;
1210 template <
class TYPE>
1213 const std::string& name ,
1215 const std::string& doc )
1246 const std::string& name ,
1248 const std::string& doc =
"" ) ;
1273 const std::string& name ,
1275 const std::string& doc =
"" ) ;
1299 template <
class TYPE>
1302 const std::string& name ,
1304 const std::string& doc =
"" )
1307 return setProperty ( component , name , property , doc ) ;
1330 template <
class TYPE>
1333 const std::string& name ,
1335 const std::string& doc =
"" )
1340 return setProperty ( property , name , value , doc ) ;
1357 const std::string& name ,
1358 const std::string& value ,
1359 const std::string& doc =
"" ) ;
1375 const std::string& name ,
1377 const std::string& doc =
"" ) ;
1392 template <
unsigned N>
1395 const std::string& name ,
1396 const char (&value)[N] ,
1397 const std::string& doc =
"" )
1400 const std::string val = std::string ( value , value + N ) ;
1401 return setProperty ( component , name , val , doc ) ;
1427 const std::string& name ,
1429 const std::string& doc =
"" ) ;
1454 const std::string& name ,
1456 const std::string& doc =
"" ) ;
1480 template <
class TYPE>
1484 const std::string& name ,
1486 const std::string& doc =
"" )
1489 return setProperty ( component , name , property , doc ) ;
1499 #endif // GAUDIKERNEL_PROPERTY_H
SimplePropertyRef< unsigned int > UnsignedIntegerPropertyRef
SimplePropertyRef< float > FloatPropertyRef
SimpleProperty< std::vector< int > > IntegerArrayProperty
GaudiHandleProperty & operator=(const GaudiHandleBase &value)
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
const GaudiHandleArrayBase & value() const
PropertyWithValue(const std::string &name, PVal value, const bool owner)
the constructor with property name and value
SimpleProperty< std::vector< char > > CharArrayProperty
SimplePropertyRef< long long > LongLongPropertyRef
std::string m_documentation
helper structure to define the types for properties
PropertyCallbackFunctor * m_updateCallBack
virtual void useReadHandler() const
use the call-back function at reading
SimplePropertyRef< unsigned short > UnsignedShortPropertyRef
SimplePropertyRef< char > CharPropertyRef
PVal i_get() const
get the value
bool setValue(const GaudiHandleArrayBase &value)
virtual ~SimplePropertyRef()
virtual Destructor
virtual bool assign(const Property &source)=0
import the property value form the source
PropertyWithValue & operator=(const TYPE &value)
assignment operator
GAUDI_API std::ostream & operator<<(std::ostream &stream, const Property &prop)
The output operator for friendly printout.
SimpleProperty< std::vector< long > > LongArrayProperty
SimplePropertyRef< std::vector< unsigned int > > UnsignedIntegerArrayPropertyRef
virtual std::string toString() const =0
value -> string
SimplePropertyRef< double > DoublePropertyRef
SimpleProperty & operator=(const TYPE &value)
assignment form the value
SimplePropertyRef templated class.
const std::string & name() const
property name
virtual bool setValue(const TYPE &value)=0
NB: abstract : to be implemented when verifier is available.
SimplePropertyRef< std::vector< double > > DoubleArrayPropertyRef
PropertyWithVerifier()
the default constructor is disabled
Helper intermediate class which represent partly implemented property with value of concrete type and...
SimpleProperty< std::vector< bool > > BooleanArrayProperty
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
SimplePropertyRef< std::vector< char > > CharArrayPropertyRef
virtual ~PropertyWithValue()
virtual destructor
SimplePropertyRef< std::vector< long long > > LongLongArrayPropertyRef
GAUDI_API bool hasProperty(const IProperty *p, const std::string &name)
simple function which check the existence of the property with the given name.
SimplePropertyRef< std::vector< unsigned long long > > UnsignedLongLongArrayPropertyRef
virtual bool assign(const Property &source)
import the property value form the source
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
SimpleProperty< std::vector< unsigned int > > UnsignedIntegerArrayProperty
PropertyCallbackFunctor * m_readCallBack
SimplePropertyRef & operator=(const TYPE &value)
assignment form the value
SimplePropertyRef< std::vector< unsigned long > > UnsignedLongArrayPropertyRef
SimplePropertyRef< std::vector< float > > FloatArrayPropertyRef
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.
bool set(const TYPE &value)
update the value of the property/check the verifier
virtual bool load(Property &dest) const =0
export the property value to the destination
SimplePropertyRef< std::vector< short > > ShortArrayPropertyRef
SimplePropertyRef< std::vector< long double > > LongDoubleArrayPropertyRef
GAUDI_API Property * getProperty(const IProperty *p, const std::string &name)
simple function which gets the property with given name from the component
PropertyWithVerifier & operator=(const PropertyWithVerifier< OTHER, OTHERVERIFIER > &right)
templated assignment
SimpleProperty< bool > BooleanProperty
const std::string & documentation() const
property documentation
virtual GaudiHandleProperty * clone() const
clone: "virtual constructor"
Gaudi::Utils::PropertyTypeTraits< TYPE > Traits
the type-traits for properties
SimpleProperty< std::vector< signed char > > SignedCharArrayProperty
SimplePropertyRef< bool > BooleanPropertyRef
bool isFailure() const
Test for a status code of FAILURE.
Property & operator=(const Property &right)
assignment operator
SimpleProperty< char > CharProperty
SimpleProperty< std::string > StringProperty
virtual bool load(Property &destination) const
export the property value to the destination
virtual bool assign(const Property &source)
import the property value form the source
SimpleProperty< std::vector< float > > FloatArrayProperty
virtual SimpleProperty * clone() const
implementation of Property::clone
GaudiHandleArrayProperty(const std::string &name, GaudiHandleArrayBase &ref)
SimpleProperty< std::vector< unsigned char > > UnsignedCharArrayProperty
SimpleProperty concrete class which implements the full Property interface.
PVal m_value
the actual property value
SimpleProperty< long double > LongDoubleProperty
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
GaudiHandleProperty(const std::string &name, GaudiHandleBase &ref)
std::string type() const
property type
SimplePropertyRef< std::vector< signed char > > SignedCharArrayPropertyRef
SimpleProperty< unsigned long > UnsignedLongProperty
GaudiHandleBase * m_pValue
Pointer to the real property.
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
SimplePropertyRef< long > LongPropertyRef
SimplePropertyRef< std::vector< unsigned short > > UnsignedShortArrayPropertyRef
SimpleProperty< long long > LongLongProperty
Helper intermediate class which represent partly implemented property with value of concrete type...
SimpleProperty< std::vector< unsigned long long > > UnsignedLongLongArrayProperty
SimplePropertyRef< unsigned long > UnsignedLongPropertyRef
This class is used for returning status codes from appropriate routines.
virtual StatusCode fromString(const std::string &s)
string -> value
virtual std::string toString() const
value -> string
SimplePropertyRef< std::vector< unsigned char > > UnsignedCharArrayPropertyRef
Definition of the basic interface.
SimpleProperty< std::vector< std::string > > StringArrayProperty
SimpleProperty< std::vector< short > > ShortArrayProperty
void i_set(const TYPE &value)
set the value
SimpleProperty< unsigned short > UnsignedShortProperty
const VERIFIER & verifier() const
SimpleProperty< unsigned char > UnsignedCharProperty
void setDocumentation(const std::string &documentation)
set the documentation string
SimpleProperty< long > LongProperty
SimplePropertyRef< std::vector< int > > IntegerArrayPropertyRef
Gaudi::Utils::PropertyTypeTraits< TYPE > Traits
SimpleProperty< int > IntegerProperty
SimpleProperty< float > FloatProperty
const TYPE & value() const
explicit conversion
virtual bool setValue(const TYPE &value)
implementation of PropertyWithValue::setValue
virtual bool assign(const Property &source)
get the value from another property
SimplePropertyRef< std::vector< long > > LongArrayPropertyRef
SimpleProperty(VERIFIER verifier=VERIFIER())
"Almost default" constructor from verifier
Base class of array's of various gaudihandles.
Property base class allowing Property* collections to be "homogeneous".
virtual SimplePropertyRef * clone() const
implementation of Property::clone
SimplePropertyRef< std::vector< std::string > > StringArrayPropertyRef
SimplePropertyRef< unsigned long long > UnsignedLongLongPropertyRef
bool m_own
owner of the storage
SimplePropertyRef< int > IntegerPropertyRef
VERIFIER m_verifier
the verifier itself
SimpleProperty< std::vector< long long > > LongLongArrayProperty
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
virtual void toStream(std::ostream &out) const
value -> stream
const GaudiHandleBase & value() const
virtual StatusCode fromString(const std::string &s)
string -> value
SimpleProperty< std::vector< double > > DoubleArrayProperty
void setName(const std::string &value)
set the new value for the property name
SimpleProperty< unsigned long long > UnsignedLongLongProperty
SimpleProperty< std::vector< long double > > LongDoubleArrayProperty
const std::type_info * type_info() const
property type-info
SimpleProperty< unsigned int > UnsignedIntegerProperty
SimpleProperty< double > DoubleProperty
SimplePropertyRef< unsigned char > UnsignedCharPropertyRef
SimpleProperty< std::vector< unsigned short > > UnsignedShortArrayProperty
virtual bool load(Property &dest) const
set value for another property
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
virtual ~SimpleProperty()
virtual Destructor
SimpleProperty< std::vector< unsigned long > > UnsignedLongArrayProperty
implemenattiono fvarioud functions for streaming.
const std::type_info * m_typeinfo
SimpleProperty< short > ShortProperty
This is a number of static methods for bootstrapping the Gaudi framework.
The IProperty is the basic interface for all components which have properties that can be set or get...
SimplePropertyRef< short > ShortPropertyRef
Traits::PVal PVal
the actual storage type
virtual GaudiHandleArrayProperty * clone() const
clone: "virtual constructor"
virtual StatusCode fromString(const std::string &s)
string -> value
virtual Property * clone() const =0
clone: "virtual constructor"
SimplePropertyRef< long double > LongDoublePropertyRef
SimplePropertyRef< std::vector< bool > > BooleanArrayPropertyRef
bool setValue(const GaudiHandleBase &value)
SimplePropertyRef< std::string > StringPropertyRef
virtual bool load(Property &destination) const
export the property value to the destination
virtual void toStream(std::ostream &out) const =0
value -> stream
virtual ~PropertyWithVerifier()
virtual destructor
SimplePropertyRef< signed char > SignedCharPropertyRef
SimpleProperty< signed char > SignedCharProperty
virtual StatusCode fromString(const std::string &value)=0
string -> value