1 #ifndef GAUDIKERNEL_PROPERTY_H
2 #define GAUDIKERNEL_PROPERTY_H
55 virtual bool assign (
const Property& source ) = 0 ;
76 {
return declareReadHandler( [=](
Property& p) { (instance->*MF)(p); } ) ; }
80 {
return declareUpdateHandler ( [=](
Property& p) { (instance->*MF)(p); } ); }
83 virtual void useReadHandler ()
const ;
85 virtual bool useUpdateHandler () ;
90 virtual Property* clone ()
const = 0 ;
95 m_documentation =
std::move(documentation); }
133 template <
class TYPE>
141 typedef typename Traits::PVal
PVal ;
153 template <
class OTHER>
162 template <
class OTHER>
168 operator const TYPE& ()
const {
return value() ;}
170 inline const TYPE&
value()
const ;
191 Traits::assign(*
m_value, value);
210 template <
class TYPE>
223 template <
class TYPE>
228 , m_own ( right.
m_own )
230 m_value = Traits::copy ( right.
value() , m_own ) ;
235 template <
class TYPE>
236 template <
class OTHER>
241 , m_own ( right.
m_own )
243 m_value = Traits::copy ( right.
value() , m_own ) ;
248 template <
class TYPE>
251 Traits::dele ( m_value , m_own ) ;
256 template <
class TYPE>
260 if ( !setValue ( value ) )
267 template <
class TYPE>
274 if ( p ) {
return setValue ( p->
value() ) ; }
276 return this->fromString( source.
toString() ).isSuccess() ;
281 template <
class TYPE>
286 return dest.
assign( *
this ) ;
291 template <
class TYPE>
301 template <
class TYPE>
311 template <
class TYPE>
328 return this->
value() ;
339 template <
class TYPE>
342 { useReadHandler() ;
return *m_value ; }
346 template <
class TYPE>
359 template <
class TYPE>
360 template <
class OTHER>
381 template<
class TYPE,
class VERIFIER>
404 bool set(
const TYPE& value ) ;
406 bool setValue(
const TYPE& value )
override {
return set( value ) ; }
408 template <
class OTHER,
class OTHERVERIFIER>
412 template <
class OTHER>
432 template <
class TYPE,
class VERIFIER>
437 if ( !m_verifier.isValid( &value ) ) {
return false ; }
439 this->i_set( value ) ;
441 return this->useUpdateHandler() ;
446 template <
class TYPE,
class VERIFIER>
456 template <
class TYPE,
class VERIFIER>
457 template <
class OTHER>
467 template <
class TYPE,
class VERIFIER>
468 template <
class OTHER,
class OTHERVERIFIER>
489 template <
class TYPE,
class VERIFIER = BoundedVerifier<TYPE> >
501 ( VERIFIER
verifier = VERIFIER() ) ;
504 (
const TYPE& value ,
512 template <
class OTHER>
523 template <
class OTHER>
530 template <
class TYPE,
class VERIFIER>
532 ( VERIFIER verifier )
534 (
"" , Traits::new_() , true , verifier )
539 template <
class TYPE,
class VERIFIER>
541 (
const TYPE& value ,
544 (
"" , Traits::new_(value) , true , verifier )
549 template <
class TYPE,
class VERIFIER>
555 (
std::move(name) , Traits::new_(value) , true , verifier )
560 template <
class TYPE,
class VERIFIER>
561 template <
class OTHER>
565 ( right.
name() , Traits::new_( right.
value() ) ,
true , VERIFIER() )
570 template <
class TYPE,
class VERIFIER>
579 template <
class TYPE,
class VERIFIER>
587 template <
class TYPE,
class VERIFIER>
598 template <
class TYPE,
class VERIFIER>
599 template <
class OTHER>
620 template<
class TYPE,
class VERIFIER = NullVerifier<TYPE> >
629 VERIFIER verifier = VERIFIER() ) ;
639 template <
class OTHER>
648 template <
class TYPE,
class VERIFIER>
658 template <
class TYPE,
class VERIFIER>
667 template <
class TYPE,
class VERIFIER>
675 template <
class TYPE,
class VERIFIER>
686 template <
class TYPE,
class VERIFIER>
687 template <
class OTHER>
825 return destination.
assign( *
this );
885 return destination.
assign( *
this );
1056 template <
class TYPE>
1085 template <
class TYPE>
1143 template <
unsigned N>
1147 const char (&value)[
N] ,
1150 return component ?
setProperty ( component , name ,
1185 template <
class TYPE>
1274 template <
class TYPE>
1281 return setProperty ( component , name , &value , doc ) ;
1304 template <
class TYPE>
1313 return property ?
setProperty ( property , name , value , doc )
1366 template <
unsigned N>
1370 const char (&value)[N] ,
1454 template <
class TYPE>
1462 return setProperty ( component , name , &value , doc ) ;
1472 #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
SimpleProperty< std::vector< char > > CharArrayProperty
SimplePropertyRef< long long > LongLongPropertyRef
std::string m_documentation
helper structure to define the types for properties
bool load(Property &destination) const override
export the property value to the destination
virtual void useReadHandler() const
use the call-back function at reading
GaudiHandleArrayProperty * clone() const override
clone: "virtual constructor"
SimplePropertyRef< unsigned short > UnsignedShortPropertyRef
PropertyWithValue(std::string name, PVal value, const bool owner)
the constructor with property name and value
SimplePropertyRef< char > CharPropertyRef
PVal i_get() const
get the value
bool setValue(const GaudiHandleArrayBase &value)
virtual bool assign(const Property &source)=0
import the property value form the source
const std::function< void(Property &)> & updateCallBack() const
get a reference to the updateCallBack
~PropertyWithValue() override
virtual destructor
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 & copy constructors are deleted
Helper intermediate class which represent partly implemented property with value of concrete type and...
SimpleProperty< std::vector< bool > > BooleanArrayProperty
GaudiHandleProperty * clone() const override
clone: "virtual constructor"
bool assign(const Property &source) override
import the property value form the source
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
SimplePropertyRef< std::vector< char > > CharArrayPropertyRef
StatusCode fromString(const std::string &s) override
string -> value
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
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
void setDocumentation(std::string documentation)
set the documentation string
~SimplePropertyRef() override=default
virtual Destructor
SimpleProperty< std::vector< unsigned int > > UnsignedIntegerArrayProperty
SimplePropertyRef & operator=(const TYPE &value)
assignment form the value
SimplePropertyRef< std::vector< unsigned long > > UnsignedLongArrayPropertyRef
SimplePropertyRef< std::vector< float > > FloatArrayPropertyRef
bool setValue(const TYPE &value) override
implementation of PropertyWithValue::setValue
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
const std::function< void(Property &)> & readCallBack() const
get a reference to the readCallBack
Property & declareUpdateHandler(void(HT::*MF)(Property &), HT *instance)
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
Gaudi::Utils::PropertyTypeTraits< TYPE > Traits
the type-traits for properties
SimpleProperty< std::vector< signed char > > SignedCharArrayProperty
bool assign(const Property &source) override
import the property value form the source
SimplePropertyRef< bool > BooleanPropertyRef
bool isFailure() const
Test for a status code of FAILURE.
SimpleProperty< char > CharProperty
SimpleProperty< std::string > StringProperty
SimpleProperty< std::vector< float > > FloatArrayProperty
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
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
GaudiHandleProperty(std::string name, GaudiHandleBase &ref)
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.
std::string toString() const override
value -> string
SimplePropertyRef< std::vector< unsigned char > > UnsignedCharArrayPropertyRef
Definition of the basic interface.
SimpleProperty< std::vector< std::string > > StringArrayProperty
SimpleProperty< std::vector< short > > ShortArrayProperty
GaudiHandleArrayProperty(std::string name, GaudiHandleArrayBase &ref)
void i_set(const TYPE &value)
set the value
SimpleProperty< unsigned short > UnsignedShortProperty
const VERIFIER & verifier() const
SimpleProperty< unsigned char > UnsignedCharProperty
~SimpleProperty() override=default
virtual Destructor
SimpleProperty< long > LongProperty
SimplePropertyRef< std::vector< int > > IntegerArrayPropertyRef
Property & declareReadHandler(void(HT::*MF)(Property &), HT *instance)
Gaudi::Utils::PropertyTypeTraits< TYPE > Traits
SimpleProperty< int > IntegerProperty
SimpleProperty< float > FloatProperty
const TYPE & value() const
explicit conversion
SimpleProperty * clone() const override
implementation of Property::clone
std::function< void(Property &)> m_readCallBack
StatusCode fromString(const std::string &s) override
string -> value
Property & operator=(const Property &)=default
assignment operator
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".
bool assign(const Property &source) override
get the value from another property
SimplePropertyRef< std::vector< std::string > > StringArrayPropertyRef
StatusCode fromString(const std::string &s) override
string -> value
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
void setName(std::string value)
set the new value for the property name
SimplePropertyRef * clone() const override
implementation of Property::clone
GaudiHandleArrayProperty & operator=(const GaudiHandleArrayBase &value)
void toStream(std::ostream &out) const override
value -> stream
GaudiHandleArrayBase * m_pValue
Pointer to the real property.
double fun(const std::vector< double > &x)
std::function< void(Property &)> m_updateCallBack
const GaudiHandleBase & value() const
SimpleProperty< std::vector< double > > DoubleArrayProperty
SimpleProperty< unsigned long long > UnsignedLongLongProperty
SimpleProperty< std::vector< long double > > LongDoubleArrayProperty
bool load(Property &destination) const override
export the property value to the destination
const std::type_info * type_info() const
property type-info
SimpleProperty< unsigned int > UnsignedIntegerProperty
bool load(Property &dest) const override
set value for another property
SimpleProperty< double > DoubleProperty
SimplePropertyRef< unsigned char > UnsignedCharPropertyRef
SimpleProperty< std::vector< unsigned short > > UnsignedShortArrayProperty
Base class to handles to be used in lieu of naked pointers to various Gaudi components.
SimpleProperty< std::vector< unsigned long > > UnsignedLongArrayProperty
implementation of various functions for streaming.
const std::type_info * m_typeinfo
SimpleProperty< short > ShortProperty
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 Property * clone() const =0
clone: "virtual constructor"
~PropertyWithVerifier() override=default
virtual destructor
Helper functions to set/get the application return code.
SimplePropertyRef< long double > LongDoublePropertyRef
SimplePropertyRef< std::vector< bool > > BooleanArrayPropertyRef
bool setValue(const GaudiHandleBase &value)
SimplePropertyRef< std::string > StringPropertyRef
virtual void toStream(std::ostream &out) const =0
value -> stream
SimplePropertyRef< signed char > SignedCharPropertyRef
SimpleProperty< signed char > SignedCharProperty
virtual StatusCode fromString(const std::string &value)=0
string -> value