PropertyWithValue< TYPE > Class Template Referenceabstract

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

#include </scratch/z5/marcocle/GaudiDocs/lhcb-release/825/GAUDI/GAUDI_v26r3/InstallArea/x86_64-slc6-gcc48-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...
 
virtual bool assign (const Property &source)
 get the value from another property More...
 
virtual bool load (Property &dest) const
 set value for another property More...
 
virtual StatusCode fromString (const std::string &s)
 string -> value More...
 
virtual std::string toString () const
 value -> string More...
 
virtual void toStream (std::ostream &out) const
 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...
 
virtual bool assign (const Property &source)
 get the value from another property More...
 
virtual bool load (Property &dest) const
 set value for another property More...
 
virtual StatusCode fromString (const std::string &s)
 string -> value More...
 
virtual std::string toString () const
 value -> string More...
 
virtual void toStream (std::ostream &out) const
 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 PropertyCallbackFunctorreadCallBack () const
 Call-back functor at reading: the functor is owned by property! More...
 
const PropertyCallbackFunctorupdateCallBack () const
 Call-back functor for update: the functor is owned by property! More...
 
virtual void declareReadHandler (PropertyCallbackFunctor *pf)
 set new callback for reading More...
 
virtual void declareUpdateHandler (PropertyCallbackFunctor *pf)
 set new callback for update More...
 
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 More...
 
virtual bool useUpdateHandler ()
 use the call-back function at update More...
 
virtual ~Property ()
 virtual destructor More...
 
virtual Propertyclone () const =0
 clone: "virtual constructor" More...
 
void setName (const std::string &value)
 set the new value for the property name More...
 
void setDocumentation (const 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 PropertyCallbackFunctorreadCallBack () const
 Call-back functor at reading: the functor is owned by property! More...
 
const PropertyCallbackFunctorupdateCallBack () const
 Call-back functor for update: the functor is owned by property! More...
 
virtual void declareReadHandler (PropertyCallbackFunctor *pf)
 set new callback for reading More...
 
virtual void declareUpdateHandler (PropertyCallbackFunctor *pf)
 set new callback for update More...
 
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 More...
 
virtual bool useUpdateHandler ()
 use the call-back function at update More...
 
virtual ~Property ()
 virtual destructor More...
 
virtual Propertyclone () const =0
 clone: "virtual constructor" More...
 
void setName (const std::string &value)
 set the new value for the property name More...
 
void setDocumentation (const 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 (const 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...
 
virtual ~PropertyWithValue ()
 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 (const 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...
 
virtual ~PropertyWithValue ()
 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, const std::string &name="")
 constructor from the property name and the type More...
 
 Property (const std::string &name, const std::type_info &type)
 constructor from the property name and the type More...
 
 Property (const Property &right)
 copy constructor More...
 
Propertyoperator= (const Property &right)
 assignment operator More...
 
 Property (const std::type_info &type, const std::string &name="")
 constructor from the property name and the type More...
 
 Property (const std::string &name, const std::type_info &type)
 constructor from the property name and the type More...
 
 Property (const Property &right)
 copy constructor More...
 
Propertyoperator= (const Property &right)
 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
PropertyCallbackFunctorm_readCallBack
 
PropertyCallbackFunctorm_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 147 of file Property.h.

Member Typedef Documentation

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

the actual storage type

Definition at line 154 of file Property.h.

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

the actual storage type

Definition at line 154 of file Property.h.

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

the type-traits for properties

Definition at line 152 of file Property.h.

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

the type-traits for properties

Definition at line 152 of file Property.h.

Constructor & Destructor Documentation

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

the constructor with property name and value

Definition at line 226 of file Property.h.

229  : Property ( typeid( TYPE ) , name )
230  , m_value ( value )
231  , m_own ( own )
232 {}
const std::string & name() const
property name
Definition: Property.h:47
PVal m_value
the actual property value
Definition: Property.h:214
const TYPE & value() const
explicit conversion
Definition: Property.h:355
bool m_own
owner of the storage
Definition: Property.h:216
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 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:214
bool m_own
owner of the storage
Definition: Property.h:216
template<class TYPE >
template<class OTHER >
PropertyWithValue< TYPE >::PropertyWithValue ( const PropertyWithValue< OTHER > &  right)
inlineprotected

copy constructor from any other type

Definition at line 251 of file Property.h.

252  : Property( right )
253  , m_value ( right.m_value )
254  , m_own ( right.m_own )
255 {
256  m_value = Traits::copy ( right.value() , m_own ) ;
257 }
PVal m_value
the actual property value
Definition: Property.h:214
const TYPE & value() const
explicit conversion
Definition: Property.h:355
bool m_own
owner of the storage
Definition: Property.h:216
template<class TYPE >
PropertyWithValue< TYPE >::~PropertyWithValue ( )
inlineprotectedvirtual

virtual destructor

Definition at line 262 of file Property.h.

263 {
264  Traits::dele ( m_value , m_own ) ;
265  m_value = 0 ;
266 }
PVal m_value
the actual property value
Definition: Property.h:214
bool m_own
owner of the storage
Definition: Property.h:216
template<class TYPE>
PropertyWithValue< TYPE >::PropertyWithValue ( const 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>
virtual PropertyWithValue< TYPE >::~PropertyWithValue ( )
inlineprotectedvirtual

virtual destructor

Member Function Documentation

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

get the value from another property

implementation of Property::assign

Implements Property.

Definition at line 283 of file Property.h.

284 {
285  // 1) Is the property of "the same" type?
286  const PropertyWithValue<TYPE>* p =
287  dynamic_cast<const PropertyWithValue<TYPE>*> ( &source ) ;
288  if ( 0 != p ) { return setValue ( p->value() ) ; } // RETURN
289  // 2) Else use the string representation
290  return this->fromString( source.toString() ).isSuccess() ;
291 }
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:147
virtual StatusCode fromString(const std::string &s)
string -> value
Definition: Property.h:327
const TYPE & value() const
explicit conversion
Definition: Property.h:355
template<class TYPE>
virtual bool PropertyWithValue< TYPE >::assign ( const Property source)
virtual

get the value from another property

Implements Property.

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

string -> value

Implementation of PropertyWithValue::fromString.

Implements Property.

Definition at line 327 of file Property.h.

328 {
329  TYPE tmp ;
330  StatusCode sc = Gaudi::Parsers::parse ( tmp , source ) ;
331  if ( sc.isFailure() ) { return sc ; }
333 }
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:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
template<class TYPE>
virtual StatusCode PropertyWithValue< TYPE >::fromString ( const std::string &  s)
virtual

string -> value

Implements Property.

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

get the value

Definition at line 207 of file Property.h.

207  {
208  return m_value;
209  }
PVal m_value
the actual property value
Definition: Property.h:214
template<class TYPE>
PVal PropertyWithValue< TYPE >::i_get ( ) const
inlineprotected

get the value

Definition at line 207 of file Property.h.

207  {
208  return m_value;
209  }
PVal m_value
the actual property value
Definition: Property.h:214
template<class TYPE>
void PropertyWithValue< TYPE >::i_set ( const TYPE &  value)
inlineprotected

set the value

Definition at line 203 of file Property.h.

203  {
204  Traits::assign(*m_value, value);
205  }
PVal m_value
the actual property value
Definition: Property.h:214
const TYPE & value() const
explicit conversion
Definition: Property.h:355
template<class TYPE>
void PropertyWithValue< TYPE >::i_set ( const TYPE &  value)
inlineprotected

set the value

Definition at line 203 of file Property.h.

203  {
204  Traits::assign(*m_value, value);
205  }
PVal m_value
the actual property value
Definition: Property.h:214
const TYPE & value() const
explicit conversion
Definition: Property.h:355
template<class TYPE >
bool PropertyWithValue< TYPE >::load ( Property dest) const
inlinevirtual

set value for another property

implementation of Property::load

Implements Property.

Definition at line 297 of file Property.h.

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

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 181 of file Property.h.

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

implicit conversion to the type

Definition at line 181 of file Property.h.

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

assignment operator

Definition at line 272 of file Property.h.

273 {
274  if ( !setValue ( value ) )
275  { throw std::out_of_range( "Value not verified" ) ; }
276  return *this ;
277 }
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:355
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 362 of file Property.h.

363 {
364  // assign the base class
365  Property::operator=( right ) ;
366  // assign the value
367  PropertyWithValue<TYPE>::operator=( right.value() ) ;
368  return *this ;
369 }
PropertyWithValue & operator=(const TYPE &value)
assignment operator
Definition: Property.h:272
Property & operator=(const Property &right)
assignment operator
Definition: Property.cpp:90
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 376 of file Property.h.

377 {
378  // assign the base class
379  Property::operator=( right ) ;
380  // assign the value
382  return *this ;
383 }
PropertyWithValue & operator=(const TYPE &value)
assignment operator
Definition: Property.h:272
Property & operator=(const Property &right)
assignment operator
Definition: Property.cpp:90
const TYPE & value() const
explicit conversion
Definition: Property.h:355
template<class TYPE >
void PropertyWithValue< TYPE >::toStream ( std::ostream &  out) const
inlinevirtual

value -> stream

Implementation of PropertyWithValue::toStream.

Implements Property.

Definition at line 317 of file Property.h.

318 {
319  useReadHandler();
321 }
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:150
PVal m_value
the actual property value
Definition: Property.h:214
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:341
template<class TYPE>
virtual void PropertyWithValue< TYPE >::toStream ( std::ostream &  out) const
virtual

value -> stream

Implements Property.

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

value -> string

Implementation of PropertyWithValue::toString.

Implements Property.

Definition at line 307 of file Property.h.

308 {
309  useReadHandler();
310  return Gaudi::Utils::toString( *m_value ) ;
311 }
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:150
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:403
PVal m_value
the actual property value
Definition: Property.h:214
template<class TYPE>
virtual std::string PropertyWithValue< TYPE >::toString ( ) const
virtual

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 355 of file Property.h.

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

Member Data Documentation

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

owner of the storage

Definition at line 216 of file Property.h.

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

the actual property value

Definition at line 214 of file Property.h.


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