| # Gaudi Framework, version v21r7p1 |

Home |  | Generated: 15 Feb 2010

# PropertyWithValue< TYPE > Class Template Reference

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

`#include <Property.h>`

Inheritance diagram for PropertyWithValue< TYPE >:

[legend]
Collaboration diagram for PropertyWithValue< TYPE >:

[legend]

List of all members.

## 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
## 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
PropertyWithValue & | operator= (const TYPE &value)
| assignment operator
PropertyWithValue & | operator= (const PropertyWithValue &rhs)
template<class OTHER>
PropertyWithValue & | operator= (const PropertyWithValue< OTHER > &right)
void | i_set (const TYPE &value)
| set the value
PVal | i_get () const
| get the value
## Private Attributes
PVal | m_value
| the actual property value
bool | m_own
| owner of the storage

## Detailed Description

### template<class TYPE>
class PropertyWithValue< TYPE >

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

Author:
  Vanya BELYAEV ibelyaev@physics.syr.edu

Date:
  2006-02-27

Definition at line 145 of file Property.h.

## Member Typedef Documentation

template<class TYPE>

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

the type-traits for properties

Reimplemented in SimpleProperty< TYPE, VERIFIER >, SimpleProperty< double >, SimpleProperty< std::string >, SimpleProperty< std::vector< std::string > >, SimpleProperty< int >, SimpleProperty< unsigned int >, and SimpleProperty< char >.

Definition at line 150 of file Property.h.

template<class TYPE>

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

the actual storage type

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 |
| ) |  |  | `[inline, protected]`

the constructor with property name and value

Definition at line 221 of file Property.h.

    00224   : Property ( typeid( TYPE ) , name )
    00225   , m_value  ( value )
    00226   , m_own    ( own   )
    00227 {}

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

    00234   : Property( right         )
    00235   , m_value ( right.m_value )
    00236   , m_own   ( right.m_own   )
    00237 {
    00238   m_value = Traits::copy ( right.value() , m_own ) ;
    00239 }

template<class TYPE>
template<class OTHER>

PropertyWithValue< TYPE >::PropertyWithValue | ( | const PropertyWithValue< OTHER > & | right | ) | `[inline, protected]`

copy constructor from any other type

Definition at line 246 of file Property.h.

    00247   : Property( right         )
    00248   , m_value ( right.m_value )
    00249   , m_own   ( right.m_own   )
    00250 {
    00251   m_value = Traits::copy ( right.value() , m_own ) ;
    00252 }

template<class TYPE>

PropertyWithValue< TYPE >::~PropertyWithValue | ( |  | ) | `[inline, protected, virtual]`

virtual destructor

Definition at line 257 of file Property.h.

    00258 {
    00259   Traits::dele ( m_value , m_own ) ;
    00260   m_value = 0 ;
    00261 }

## Member Function Documentation

template<class TYPE>

PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= | ( | const TYPE & | value | ) | `[inline, protected]`

assignment operator

Reimplemented in PropertyWithVerifier< TYPE, VERIFIER >, SimpleProperty< TYPE, VERIFIER >, SimplePropertyRef< TYPE, VERIFIER >, PropertyWithVerifier< int, BoundedVerifier< int > >, PropertyWithVerifier< double, BoundedVerifier< double > >, PropertyWithVerifier< unsigned int, BoundedVerifier< unsigned int > >, PropertyWithVerifier< std::string, BoundedVerifier< std::string > >, PropertyWithVerifier< char, BoundedVerifier< char > >, and PropertyWithVerifier< std::vector< std::string >, BoundedVerifier< std::vector< std::string > > >.

Definition at line 267 of file Property.h.

    00268 {
    00269   if ( !setValue ( value ) )
    00270   { throw std::out_of_range( "Value not verified" ) ; }
    00271   return *this ;
    00272 }

template<class TYPE>

PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= | ( | const PropertyWithValue< TYPE > & | rhs | ) | `[inline, protected]`

Definition at line 347 of file Property.h.

    00348 {
    00349   // assign the base class
    00350   Property::operator=( right ) ;
    00351   // assign the value
    00352   PropertyWithValue<TYPE>::operator=( right.value() ) ;
    00353   return *this ;
    00354 }

template<class TYPE>
template<class OTHER>

PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= | ( | const PropertyWithValue< OTHER > & | right | ) | `[inline, protected]`

Reimplemented in PropertyWithVerifier< TYPE, VERIFIER >, SimpleProperty< TYPE, VERIFIER >, SimplePropertyRef< TYPE, VERIFIER >, PropertyWithVerifier< int, BoundedVerifier< int > >, PropertyWithVerifier< double, BoundedVerifier< double > >, PropertyWithVerifier< unsigned int, BoundedVerifier< unsigned int > >, PropertyWithVerifier< std::string, BoundedVerifier< std::string > >, PropertyWithVerifier< char, BoundedVerifier< char > >, PropertyWithVerifier< std::vector< std::string >, BoundedVerifier< std::vector< std::string > > >, SimpleProperty< double >, SimpleProperty< std::string >, SimpleProperty< std::vector< std::string > >, SimpleProperty< int >, SimpleProperty< unsigned int >, and SimpleProperty< char >.

Definition at line 361 of file Property.h.

    00362 {
    00363   // assign the base class
    00364   Property::operator=( right ) ;
    00365   // assign the value
    00366   PropertyWithValue<TYPE>::operator=( right.value() ) ;
    00367   return *this ;
    00368 }

template<class TYPE>

PropertyWithValue< TYPE >::operator const TYPE & | ( |  | ) | const`[inline]`

implicit conversion to the type

Definition at line 179 of file Property.h.

    00179 { return value() ;}

template<class TYPE>

const TYPE & PropertyWithValue< TYPE >::value | ( |  | ) | const`[inline]`

explicit conversion

get the access to the storage

Definition at line 340 of file Property.h.

    00341 { useReadHandler() ; return *m_value ; }

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< std::string, BoundedVerifier< std::string > >, PropertyWithVerifier< char, BoundedVerifier< char > >, and PropertyWithVerifier< std::vector< std::string >, BoundedVerifier< std::vector< std::string > > >.

template<class TYPE>

bool PropertyWithValue< TYPE >::assign | ( | const Property & | source | ) | `[inline, virtual]`

get the value from another property

implementation of Property::assign

Implements Property.

Definition at line 278 of file Property.h.

    00279 {
    00280   // 1) Is the property of "the same" type?
    00281   const PropertyWithValue<TYPE>* p =
    00282     dynamic_cast<const PropertyWithValue<TYPE>*>       ( &source ) ;
    00283   if ( 0 != p ) { return setValue ( p->value() ) ; }       // RETURN
    00284   // 2) Else use the string representation
    00285   return this->fromString( source.toString() ).isSuccess() ;
    00286 }

template<class TYPE>

bool PropertyWithValue< TYPE >::load | ( | Property & | dest | ) | const`[inline, virtual]`

set value for another property

implementation of Property::load

Implements Property.

Definition at line 292 of file Property.h.

    00293 {
    00294   // delegate to the 'opposite' method ;
    00295   return dest.assign( *this ) ;
    00296 }

template<class TYPE>

StatusCode PropertyWithValue< TYPE >::fromString | ( | const std::string & | s | ) | `[inline, virtual]`

string -> value

Implementation of PropertyWithValue::fromString.

Implements Property.

Definition at line 312 of file Property.h.

    00313 {
    00314   TYPE tmp ;
    00315   StatusCode sc = Gaudi::Parsers::parse ( tmp , source ) ;
    00316   if ( sc.isFailure() ) { return sc ; }
    00317   return setValue ( tmp ) ? StatusCode::SUCCESS : StatusCode::FAILURE ;
    00318 }

template<class TYPE>

std::string PropertyWithValue< TYPE >::toString | ( |  | ) | const`[inline, virtual]`

value -> string

Implementation of PropertyWithValue::toString.

Implements Property.

Definition at line 302 of file Property.h.

    00303 {
    00304   useReadHandler();
    00305   return Gaudi::Utils::toString( *m_value ) ;
    00306 }

template<class TYPE>

void PropertyWithValue< TYPE >::i_set | ( | const TYPE & | value | ) | `[inline, protected]`

set the value

Definition at line 199 of file Property.h.

    00199                                            {
    00200     Traits::assign(*m_value, value);
    00201   }

template<class TYPE>

PVal PropertyWithValue< TYPE >::i_get | ( |  | ) | const`[inline, protected]`

get the value

Definition at line 203 of file Property.h.

    00203                               {
    00204     return m_value;
    00205   }

## Member Data Documentation

template<class TYPE>

PVal PropertyWithValue< TYPE >::m_value`[private]`

the actual property value

Definition at line 210 of file Property.h.

template<class TYPE>

bool PropertyWithValue< TYPE >::m_own`[private]`

owner of the storage

Definition at line 212 of file Property.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiKernel/GaudiKernel/Property.h