PropertyWithValue< TYPE > Class Template Referenceabstract

Helper intermediate class which represent partly implemented property with value of concrete type. More...

#include </tmp/marcocle/lhcb-release/1122/GAUDI/GAUDI_v27r0/InstallArea/x86_64-slc6-gcc49-opt/include/GaudiKernel/Property.h>

Inheritance diagram for PropertyWithValue< TYPE >:
Collaboration diagram for PropertyWithValue< TYPE >:

Public Types

typedef Gaudi::Utils::PropertyTypeTraits< TYPE > Traits
 the type-traits for properties More...
 
typedef Traits::PVal PVal
 the actual storage type More...
 
typedef Gaudi::Utils::PropertyTypeTraits< TYPE > Traits
 the type-traits for properties More...
 
typedef Traits::PVal PVal
 the actual storage type More...
 

Public Member Functions

 operator const TYPE & () const
 implicit conversion to the type More...
 
const TYPE & value () const
 explicit conversion More...
 
virtual bool setValue (const TYPE &value)=0
 NB: abstract : to be implemented when verifier is available. More...
 
bool assign (const Property &source) override
 get the value from another property More...
 
bool load (Property &dest) const override
 set value for another property More...
 
StatusCode fromString (const std::string &s) override
 string -> value More...
 
std::string toString () const override
 value -> string More...
 
void toStream (std::ostream &out) const override
 value -> stream More...
 
 operator const TYPE & () const
 implicit conversion to the type More...
 
const TYPE & value () const
 explicit conversion More...
 
virtual bool setValue (const TYPE &value)=0
 NB: abstract : to be implemented when verifier is available. More...
 
bool assign (const Property &source) override
 get the value from another property More...
 
bool load (Property &dest) const override
 set value for another property More...
 
StatusCode fromString (const std::string &s) override
 string -> value More...
 
std::string toString () const override
 value -> string More...
 
void toStream (std::ostream &out) const override
 value -> stream More...
 
template<class OTHER >
PropertyWithValue< TYPE > & operator= (const PropertyWithValue< OTHER > &right)
 
- Public Member Functions inherited from Property
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...
 
const std::function< void(Property &)> & readCallBack () const
 get a reference to the readCallBack More...
 
const std::function< void(Property &)> & updateCallBack () const
 get a reference to the updateCallBack More...
 
virtual PropertydeclareReadHandler (std::function< void(Property &)> fun)
 set new callback for reading More...
 
virtual PropertydeclareUpdateHandler (std::function< void(Property &)> fun)
 set new callback for update More...
 
template<class HT >
PropertydeclareReadHandler (void(HT::*MF)(Property &), HT *instance)
 
template<class HT >
PropertydeclareUpdateHandler (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 ()=default
 virtual destructor More...
 
virtual Propertyclone () const =0
 clone: "virtual constructor" More...
 
void setName (std::string value)
 set the new value for the property name More...
 
void setDocumentation (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...
 
const std::function< void(Property &)> & readCallBack () const
 get a reference to the readCallBack More...
 
const std::function< void(Property &)> & updateCallBack () const
 get a reference to the updateCallBack More...
 
virtual PropertydeclareReadHandler (std::function< void(Property &)> fun)
 set new callback for reading More...
 
virtual PropertydeclareUpdateHandler (std::function< void(Property &)> fun)
 set new callback for update More...
 
template<class HT >
PropertydeclareReadHandler (void(HT::*MF)(Property &), HT *instance)
 
template<class HT >
PropertydeclareUpdateHandler (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 ()=default
 virtual destructor More...
 
virtual Propertyclone () const =0
 clone: "virtual constructor" More...
 
void setName (std::string value)
 set the new value for the property name More...
 
void setDocumentation (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

 PropertyWithValue (std::string name, PVal value, const bool owner)
 the constructor with property name and value More...
 
 PropertyWithValue (const PropertyWithValue &rhs)
 copy constructor (don't let the compiler generate a buggy one) More...
 
template<class OTHER >
 PropertyWithValue (const PropertyWithValue< OTHER > &right)
 copy constructor from any other type More...
 
 ~PropertyWithValue () override
 virtual destructor More...
 
PropertyWithValueoperator= (const TYPE &value)
 assignment operator More...
 
PropertyWithValueoperator= (const PropertyWithValue &rhs)
 
template<class OTHER >
PropertyWithValueoperator= (const PropertyWithValue< OTHER > &right)
 
void i_set (const TYPE &value)
 set the value More...
 
PVal i_get () const
 get the value More...
 
 PropertyWithValue (std::string name, PVal value, const bool owner)
 the constructor with property name and value More...
 
 PropertyWithValue (const PropertyWithValue &rhs)
 copy constructor (don't let the compiler generate a buggy one) More...
 
template<class OTHER >
 PropertyWithValue (const PropertyWithValue< OTHER > &right)
 copy constructor from any other type More...
 
 ~PropertyWithValue () override
 virtual destructor More...
 
PropertyWithValueoperator= (const TYPE &value)
 assignment operator More...
 
PropertyWithValueoperator= (const PropertyWithValue &rhs)
 
template<class OTHER >
PropertyWithValueoperator= (const PropertyWithValue< OTHER > &right)
 
void i_set (const TYPE &value)
 set the value More...
 
PVal i_get () const
 get the value More...
 
- Protected Member Functions inherited from Property
 Property (const std::type_info &type, std::string name="")
 constructor from the property name and the type More...
 
 Property (std::string name, const std::type_info &type)
 constructor from the property name and the type More...
 
 Property (const Property &)=default
 copy constructor More...
 
Propertyoperator= (const Property &)=default
 assignment operator More...
 
 Property (const std::type_info &type, std::string name="")
 constructor from the property name and the type More...
 
 Property (std::string name, const std::type_info &type)
 constructor from the property name and the type More...
 
 Property (const Property &)=default
 copy constructor More...
 
Propertyoperator= (const Property &)=default
 assignment operator More...
 

Private Attributes

PVal m_value
 the actual property value More...
 
bool m_own
 owner of the storage More...
 

Additional Inherited Members

- Protected Attributes inherited from Property
std::function< void(Property &)> m_readCallBack
 
std::function< void(Property &)> m_updateCallBack
 

Detailed Description

template<class TYPE>
class PropertyWithValue< TYPE >

Helper intermediate class which represent partly implemented property with value of concrete type.

Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2006-02-27

Definition at line 134 of file Property.h.

Member Typedef Documentation

template<class TYPE>
typedef Traits::PVal PropertyWithValue< TYPE >::PVal

the actual storage type

Definition at line 141 of file Property.h.

template<class TYPE>
typedef Traits::PVal PropertyWithValue< TYPE >::PVal

the actual storage type

Definition at line 141 of file Property.h.

template<class TYPE>
typedef Gaudi::Utils::PropertyTypeTraits<TYPE> PropertyWithValue< TYPE >::Traits

the type-traits for properties

Definition at line 139 of file Property.h.

template<class TYPE>
typedef Gaudi::Utils::PropertyTypeTraits<TYPE> PropertyWithValue< TYPE >::Traits

the type-traits for properties

Definition at line 139 of file Property.h.

Constructor & Destructor Documentation

template<class TYPE >
PropertyWithValue< TYPE >::PropertyWithValue ( std::string  name,
PVal  value,
const bool  owner 
)
inlineprotected

the constructor with property name and value

Definition at line 213 of file Property.h.

216  : Property ( typeid( TYPE ) , std::move(name) )
217  , m_value ( value )
218  , m_own ( own )
219 {}
const std::string & name() const
property name
Definition: Property.h:45
PVal m_value
the actual property value
Definition: Property.h:201
const TYPE & value() const
explicit conversion
Definition: Property.h:341
bool m_own
owner of the storage
Definition: Property.h:203
template<class TYPE >
PropertyWithValue< TYPE >::PropertyWithValue ( const PropertyWithValue< TYPE > &  rhs)
inlineprotected

copy constructor (don't let the compiler generate a buggy one)

Definition at line 225 of file Property.h.

226  : Property( right )
227  , m_value ( right.m_value )
228  , m_own ( right.m_own )
229 {
230  m_value = Traits::copy ( right.value() , m_own ) ;
231 }
PVal m_value
the actual property value
Definition: Property.h:201
bool m_own
owner of the storage
Definition: Property.h:203
template<class TYPE >
template<class OTHER >
PropertyWithValue< TYPE >::PropertyWithValue ( const PropertyWithValue< OTHER > &  right)
inlineprotected

copy constructor from any other type

Definition at line 238 of file Property.h.

239  : Property( right )
240  , m_value ( right.m_value )
241  , m_own ( right.m_own )
242 {
243  m_value = Traits::copy ( right.value() , m_own ) ;
244 }
PVal m_value
the actual property value
Definition: Property.h:201
const TYPE & value() const
explicit conversion
Definition: Property.h:341
bool m_own
owner of the storage
Definition: Property.h:203
template<class TYPE >
PropertyWithValue< TYPE >::~PropertyWithValue ( )
inlineoverrideprotected

virtual destructor

Definition at line 249 of file Property.h.

250 {
251  Traits::dele ( m_value , m_own ) ;
252 }
PVal m_value
the actual property value
Definition: Property.h:201
bool m_own
owner of the storage
Definition: Property.h:203
template<class TYPE>
PropertyWithValue< TYPE >::PropertyWithValue ( std::string  name,
PVal  value,
const bool  owner 
)
inlineprotected

the constructor with property name and value

template<class TYPE>
PropertyWithValue< TYPE >::PropertyWithValue ( const PropertyWithValue< TYPE > &  rhs)
inlineprotected

copy constructor (don't let the compiler generate a buggy one)

template<class TYPE>
template<class OTHER >
PropertyWithValue< TYPE >::PropertyWithValue ( const PropertyWithValue< OTHER > &  right)
inlineprotected

copy constructor from any other type

template<class TYPE>
PropertyWithValue< TYPE >::~PropertyWithValue ( )
overrideprotected

virtual destructor

Member Function Documentation

template<class TYPE >
bool PropertyWithValue< TYPE >::assign ( const Property source)
inlineoverridevirtual

get the value from another property

implementation of Property::assign

Implements Property.

Definition at line 269 of file Property.h.

270 {
271  // 1) Is the property of "the same" type?
272  const PropertyWithValue<TYPE>* p =
273  dynamic_cast<const PropertyWithValue<TYPE>*> ( &source ) ;
274  if ( p ) { return setValue ( p->value() ) ; } // RETURN
275  // 2) Else use the string representation
276  return this->fromString( source.toString() ).isSuccess() ;
277 }
virtual std::string toString() const =0
value -> string
virtual bool setValue(const TYPE &value)=0
NB: abstract : to be implemented when verifier is available.
Helper intermediate class which represent partly implemented property with value of concrete type...
Definition: Property.h:134
const TYPE & value() const
explicit conversion
Definition: Property.h:341
StatusCode fromString(const std::string &s) override
string -> value
Definition: Property.h:313
template<class TYPE>
bool PropertyWithValue< TYPE >::assign ( const Property source)
overridevirtual

get the value from another property

Implements Property.

template<class TYPE >
StatusCode PropertyWithValue< TYPE >::fromString ( const std::string &  s)
inlineoverridevirtual

string -> value

Implementation of PropertyWithValue::fromString.

Implements Property.

Definition at line 313 of file Property.h.

314 {
315  TYPE tmp ;
316  StatusCode sc = Gaudi::Parsers::parse ( tmp , source ) ;
317  if ( sc.isFailure() ) { return sc ; }
319 }
virtual bool setValue(const TYPE &value)=0
NB: abstract : to be implemented when verifier is available.
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
template<class TYPE>
StatusCode PropertyWithValue< TYPE >::fromString ( const std::string &  s)
overridevirtual

string -> value

Implements Property.

template<class TYPE>
PVal PropertyWithValue< TYPE >::i_get ( ) const
inlineprotected

get the value

Definition at line 194 of file Property.h.

194  {
195  return m_value;
196  }
PVal m_value
the actual property value
Definition: Property.h:201
template<class TYPE>
PVal PropertyWithValue< TYPE >::i_get ( ) const
inlineprotected

get the value

Definition at line 194 of file Property.h.

194  {
195  return m_value;
196  }
PVal m_value
the actual property value
Definition: Property.h:201
template<class TYPE>
void PropertyWithValue< TYPE >::i_set ( const TYPE &  value)
inlineprotected

set the value

Definition at line 190 of file Property.h.

190  {
191  Traits::assign(*m_value, value);
192  }
PVal m_value
the actual property value
Definition: Property.h:201
const TYPE & value() const
explicit conversion
Definition: Property.h:341
template<class TYPE>
void PropertyWithValue< TYPE >::i_set ( const TYPE &  value)
inlineprotected

set the value

Definition at line 190 of file Property.h.

190  {
191  Traits::assign(*m_value, value);
192  }
PVal m_value
the actual property value
Definition: Property.h:201
const TYPE & value() const
explicit conversion
Definition: Property.h:341
template<class TYPE >
bool PropertyWithValue< TYPE >::load ( Property dest) const
inlineoverridevirtual

set value for another property

implementation of Property::load

Implements Property.

Definition at line 283 of file Property.h.

284 {
285  // delegate to the 'opposite' method ;
286  return dest.assign( *this ) ;
287 }
virtual bool assign(const Property &source)=0
import the property value form the source
template<class TYPE>
bool PropertyWithValue< TYPE >::load ( Property dest) const
overridevirtual

set value for another property

Implements Property.

template<class TYPE>
PropertyWithValue< TYPE >::operator const TYPE & ( ) const
inline

implicit conversion to the type

Definition at line 168 of file Property.h.

168 { return value() ;}
const TYPE & value() const
explicit conversion
Definition: Property.h:341
template<class TYPE>
PropertyWithValue< TYPE >::operator const TYPE & ( ) const
inline

implicit conversion to the type

Definition at line 168 of file Property.h.

168 { return value() ;}
const TYPE & value() const
explicit conversion
Definition: Property.h:341
template<class TYPE>
PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= ( const TYPE &  value)
inlineprotected

assignment operator

Definition at line 258 of file Property.h.

259 {
260  if ( !setValue ( value ) )
261  { throw std::out_of_range( "Value not verified" ) ; }
262  return *this ;
263 }
virtual bool setValue(const TYPE &value)=0
NB: abstract : to be implemented when verifier is available.
const TYPE & value() const
explicit conversion
Definition: Property.h:341
template<class TYPE>
PropertyWithValue& PropertyWithValue< TYPE >::operator= ( const TYPE &  value)
protected

assignment operator

template<class TYPE>
PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< TYPE > &  rhs)
protected

Definition at line 348 of file Property.h.

349 {
350  // assign the base class
351  Property::operator=( right ) ;
352  // assign the value
353  PropertyWithValue<TYPE>::operator=( right.value() ) ;
354  return *this ;
355 }
PropertyWithValue & operator=(const TYPE &value)
assignment operator
Definition: Property.h:258
Property & operator=(const Property &)=default
assignment operator
template<class TYPE>
PropertyWithValue& PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< TYPE > &  rhs)
protected
template<class TYPE>
template<class OTHER >
PropertyWithValue& PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< OTHER > &  right)
protected
template<class TYPE>
template<class OTHER >
PropertyWithValue& PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< OTHER > &  right)
protected
template<class TYPE >
template<class OTHER >
PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< OTHER > &  right)

Definition at line 362 of file Property.h.

363 {
364  // assign the base class
365  Property::operator=( right ) ;
366  // assign the value
368  return *this ;
369 }
PropertyWithValue & operator=(const TYPE &value)
assignment operator
Definition: Property.h:258
const TYPE & value() const
explicit conversion
Definition: Property.h:341
Property & operator=(const Property &)=default
assignment operator
template<class TYPE >
void PropertyWithValue< TYPE >::toStream ( std::ostream &  out) const
inlineoverridevirtual

value -> stream

Implementation of PropertyWithValue::toStream.

Implements Property.

Definition at line 303 of file Property.h.

304 {
305  useReadHandler();
307 }
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
PVal m_value
the actual property value
Definition: Property.h:201
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
Definition: ToStream.h:319
template<class TYPE>
void PropertyWithValue< TYPE >::toStream ( std::ostream &  out) const
overridevirtual

value -> stream

Implements Property.

template<class TYPE >
std::string PropertyWithValue< TYPE >::toString ( ) const
inlineoverridevirtual

value -> string

Implementation of PropertyWithValue::toString.

Implements Property.

Definition at line 293 of file Property.h.

294 {
295  useReadHandler();
296  return Gaudi::Utils::toString( *m_value ) ;
297 }
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:371
PVal m_value
the actual property value
Definition: Property.h:201
template<class TYPE>
std::string PropertyWithValue< TYPE >::toString ( ) const
overridevirtual

value -> string

Implements Property.

template<class TYPE>
const TYPE& PropertyWithValue< TYPE >::value ( ) const
inline

explicit conversion

template<class TYPE >
const TYPE & PropertyWithValue< TYPE >::value ( ) const
inline

explicit conversion

get the access to the storage

Definition at line 341 of file Property.h.

342 { useReadHandler() ; return *m_value ; }
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
PVal m_value
the actual property value
Definition: Property.h:201

Member Data Documentation

template<class TYPE>
bool PropertyWithValue< TYPE >::m_own
private

owner of the storage

Definition at line 203 of file Property.h.

template<class TYPE>
PVal PropertyWithValue< TYPE >::m_value
private

the actual property value

Definition at line 201 of file Property.h.


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