Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
PropertyWithValue< TYPE > Class Template Referenceabstract

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

#include <Property.h>

Inheritance diagram for PropertyWithValue< TYPE >:
Inheritance graph
[legend]
Collaboration diagram for PropertyWithValue< TYPE >:
Collaboration graph
[legend]

Public Types

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

Public Member Functions

 operator const TYPE & () const
 implicit conversion to the type
 
const TYPE & value () const
 explicit conversion
 
virtual bool setValue (const TYPE &value)=0
 NB: abstract : to be implemented when verifier is available.
 
virtual bool assign (const Property &source)
 get the value from another property
 
virtual bool load (Property &dest) const
 set value for another property
 
virtual StatusCode fromString (const std::string &s)
 string -> value
 
virtual std::string toString () const
 value -> string
 
virtual void toStream (std::ostream &out) const
 value -> stream
 
- Public Member Functions inherited from Property
const std::stringname () const
 property name
 
const std::stringdocumentation () const
 property documentation
 
const std::type_infotype_info () const
 property type-info
 
std::string type () const
 property type
 
const PropertyCallbackFunctorreadCallBack () const
 Call-back functor at reading: the functor is owned by property!
 
const PropertyCallbackFunctorupdateCallBack () const
 Call-back functor for update: the functor is owned by property!
 
virtual void declareReadHandler (PropertyCallbackFunctor *pf)
 set new callback for reading
 
virtual void declareUpdateHandler (PropertyCallbackFunctor *pf)
 set new callback for update
 
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
 
virtual bool useUpdateHandler ()
 use the call-back function at update
 
virtual ~Property ()
 virtual destructor
 
virtual Propertyclone () const =0
 clone: "virtual constructor"
 
void setName (const std::string &value)
 set the new value for the property name
 
void setDocumentation (const std::string &documentation)
 set the documentation string
 
virtual std::ostreamfillStream (std::ostream &) const
 the printout of the property value
 

Protected Member Functions

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

Private Attributes

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

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 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.

: Property ( typeid( TYPE ) , name )
, m_value ( value )
, m_own ( own )
{}
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.

: Property( right )
, m_value ( right.m_value )
, m_own ( right.m_own )
{
m_value = Traits::copy ( right.value() , m_own ) ;
}
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.

: Property( right )
, m_value ( right.m_value )
, m_own ( right.m_own )
{
m_value = Traits::copy ( right.value() , m_own ) ;
}
template<class TYPE >
PropertyWithValue< TYPE >::~PropertyWithValue ( )
inlineprotectedvirtual

virtual destructor

Definition at line 262 of file Property.h.

{
Traits::dele ( m_value , m_own ) ;
m_value = 0 ;
}

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.

{
// 1) Is the property of "the same" type?
dynamic_cast<const PropertyWithValue<TYPE>*> ( &source ) ;
if ( 0 != p ) { return setValue ( p->value() ) ; } // RETURN
// 2) Else use the string representation
return this->fromString( source.toString() ).isSuccess() ;
}
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.

{
TYPE tmp ;
StatusCode sc = Gaudi::Parsers::parse ( tmp , source ) ;
if ( sc.isFailure() ) { return sc ; }
}
template<class TYPE>
PVal PropertyWithValue< TYPE >::i_get ( ) const
inlineprotected

get the value

Definition at line 207 of file Property.h.

{
return m_value;
}
template<class TYPE>
void PropertyWithValue< TYPE >::i_set ( const TYPE &  value)
inlineprotected

set the value

Definition at line 203 of file Property.h.

{
Traits::assign(*m_value, value);
}
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.

{
// delegate to the 'opposite' method ;
return dest.assign( *this ) ;
}
template<class TYPE>
PropertyWithValue< TYPE >::operator const TYPE & ( ) const
inline

implicit conversion to the type

Definition at line 181 of file Property.h.

{ return value() ;}
template<class TYPE>
PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= ( const TYPE &  value)
inlineprotected

assignment operator

Definition at line 272 of file Property.h.

{
if ( !setValue ( value ) )
{ throw std::out_of_range( "Value not verified" ) ; }
return *this ;
}
template<class TYPE>
PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< TYPE > &  rhs)
protected

Definition at line 362 of file Property.h.

{
// assign the base class
// assign the value
return *this ;
}
template<class TYPE >
template<class OTHER >
PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< OTHER > &  right)
protected

Definition at line 376 of file Property.h.

{
// assign the base class
// assign the value
return *this ;
}
template<class TYPE>
virtual bool PropertyWithValue< TYPE >::setValue ( const TYPE &  value)
pure virtual
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.

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.

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.

{ useReadHandler() ; return *m_value ; }

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:

Generated at Wed Dec 4 2013 14:33:18 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004