| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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 <GaudiKernel/Property.h>`

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

## Public Types
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...
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 Property & | declareReadHandler (std::function< void(Property &)> fun)
| set new callback for reading More...
virtual Property & | declareUpdateHandler (std::function< void(Property &)> fun)
| set new callback for update More...
template<class HT >
Property & | declareReadHandler (void(HT::*MF)(Property &), HT *instance)
template<class HT >
Property & | 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 ()=default
| virtual destructor More...
virtual Property * | clone () 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...
PropertyWithValue & | operator= (const TYPE &value)
| assignment operator More...
PropertyWithValue & | operator= (const PropertyWithValue &rhs)
template<class OTHER >
PropertyWithValue & | operator= (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...
Property & | operator= (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 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
| ) |  |
| inline protected

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 {}
PropertyWithValue::m_value
PVal m_value
the actual property value
Definition: Property.h:201
Property::Property
Property()
std::move
T move(T...args)
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
PropertyWithValue::m_own
bool m_own
owner of the storage
Definition: Property.h:203
template<class TYPE >

PropertyWithValue< TYPE >::PropertyWithValue | ( | const PropertyWithValue< TYPE > & | rhs | ) |
| inline protected

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 }
std::right
T right(T...args)
PropertyWithValue::m_value
PVal m_value
the actual property value
Definition: Property.h:201
Property::Property
Property()
PropertyWithValue::m_own
bool m_own
owner of the storage
Definition: Property.h:203
template<class TYPE >
template<class OTHER >

PropertyWithValue< TYPE >::PropertyWithValue | ( | const PropertyWithValue< OTHER > & | right | ) |
| inline protected

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 }
PropertyWithValue::m_value
PVal m_value
the actual property value
Definition: Property.h:201
Property::Property
Property()
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
PropertyWithValue::m_own
bool m_own
owner of the storage
Definition: Property.h:203
template<class TYPE >

PropertyWithValue< TYPE >::~PropertyWithValue | ( |  | ) |
| inline override protected

virtual destructor

Definition at line 249 of file Property.h.

250 {
251 Traits::dele ( m_value , m_own ) ;
252 }
PropertyWithValue::m_value
PVal m_value
the actual property value
Definition: Property.h:201
PropertyWithValue::m_own
bool m_own
owner of the storage
Definition: Property.h:203

## Member Function Documentation

template<class TYPE >

bool PropertyWithValue< TYPE >::assign | ( | const Property & | source | ) |
| inline override virtual

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 }
Property::toString
virtual std::string toString() const =0
value -> string
PropertyWithValue::setValue
virtual bool setValue(const TYPE &value)=0
NB: abstract : to be implemented when verifier is available.
PropertyWithValue
Helper intermediate class which represent partly implemented property with value of concrete type...
Definition: Property.h:134
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
PropertyWithValue::fromString
StatusCode fromString(const std::string &s) override
string -> value
Definition: Property.h:313
template<class TYPE >

StatusCode PropertyWithValue< TYPE >::fromString | ( | const std::string & | s | ) |
| inline override virtual

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 ; }
318 return setValue ( tmp ) ? StatusCode::SUCCESS : StatusCode::FAILURE ;
319 }
PropertyWithValue::setValue
virtual bool setValue(const TYPE &value)=0
NB: abstract : to be implemented when verifier is available.
Gaudi::Parsers::parse
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
Definition: DODBasicMapper.cpp:11
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
template<class TYPE>

PVal PropertyWithValue< TYPE >::i_get | ( |  | ) | const
| inline protected

get the value

Definition at line 194 of file Property.h.

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

void PropertyWithValue< TYPE >::i_set | ( | const TYPE & | value | ) |
| inline protected

set the value

Definition at line 190 of file Property.h.

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

bool PropertyWithValue< TYPE >::load | ( | Property & | dest | ) | const
| inline override virtual

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 }
Property::assign
virtual bool assign(const Property &source)=0
import the property value form the source
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() ;}
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
template<class TYPE>

PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= | ( | const TYPE & | value | ) |
| inline protected

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 }
std::out_of_range
STL class.
PropertyWithValue::setValue
virtual bool setValue(const TYPE &value)=0
NB: abstract : to be implemented when verifier is available.
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
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=
PropertyWithValue & operator=(const TYPE &value)
assignment operator
Definition: Property.h:258
std::right
T right(T...args)
Property::operator=
Property & operator=(const Property &)=default
assignment operator
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
367 PropertyWithValue<TYPE>::operator=( right.value() ) ;
368 return *this ;
369 }
PropertyWithValue::operator=
PropertyWithValue & operator=(const TYPE &value)
assignment operator
Definition: Property.h:258
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
Property::operator=
Property & operator=(const Property &)=default
assignment operator
template<class TYPE>

virtual bool PropertyWithValue< TYPE >::setValue | ( | const TYPE & | value | ) |
| pure virtual

NB: abstract : to be implemented when verifier is available.

Implemented in PropertyWithVerifier< TYPE, VERIFIER >, PropertyWithVerifier< int, BoundedVerifier< int > >, PropertyWithVerifier< double, BoundedVerifier< double > >, PropertyWithVerifier< unsigned int, BoundedVerifier< unsigned int > >, PropertyWithVerifier< bool, BoundedVerifier< bool > >, PropertyWithVerifier< std::string, BoundedVerifier< std::string > >, and PropertyWithVerifier< std::vector< std::string >, BoundedVerifier< std::vector< std::string > > >.

template<class TYPE >

void PropertyWithValue< TYPE >::toStream | ( | std::ostream & | out | ) | const
| inline override virtual

value -> stream

Implementation of PropertyWithValue::toStream.

Implements Property.

Definition at line 303 of file Property.h.

304 {
305 useReadHandler();
306 Gaudi::Utils::toStream( *m_value, out ) ;
307 }
Property::useReadHandler
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
PropertyWithValue::m_value
PVal m_value
the actual property value
Definition: Property.h:201
Gaudi::Utils::toStream
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 >

std::string PropertyWithValue< TYPE >::toString | ( |  | ) | const
| inline override virtual

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 }
Property::useReadHandler
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:371
PropertyWithValue::m_value
PVal m_value
the actual property value
Definition: Property.h:201
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 ; }
Property::useReadHandler
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
PropertyWithValue::m_value
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:

- GaudiKernel/GaudiKernel/Property.h