| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# PropertyWithValue< TYPE > Class Template Reference

`#include <Property.h>`

Inheritance diagram for PropertyWithValue< TYPE >:

[legend]
Collaboration diagram for PropertyWithValue< TYPE >:

[legend]

List of all members.

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

## Public Member Functions
| operator const TYPE & () const
const TYPE & | value () const
| get the access to the storage
virtual bool | setValue (const TYPE &value)=0
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, TYPE *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)
| assignement operator
PropertyWithValue & | operator= (const PropertyWithValue &rhs)
template<class OTHER>
PropertyWithValue & | operator= (const PropertyWithValue< OTHER > &right)
void | i_set (const TYPE &value)
TYPE * | i_get () const
## Private Attributes
TYPE * | m_value
bool | m_own

## Constructor & Destructor Documentation

template<class TYPE>

PropertyWithValue< TYPE >::PropertyWithValue | ( | const std::string & | name,
|  | TYPE * | value,
|  | const bool | owner |
| ) |  |  | `[inline, protected]`

the constructor with property name and value

Definition at line 197 of file Property.h.

    00200   : Property ( typeid( TYPE ) , name )
    00201   , m_value  ( value )
    00202   , m_own    ( own   )
    00203 {}

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

    00210   : Property( right         )
    00211   , m_value ( right.m_value )
    00212   , m_own   ( right.own     )
    00213 { if ( m_own ) { m_value = new TYPE(right.value()) ; } }

template<class TYPE>
template<class OTHER>

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

copy constructor from any other type

Definition at line 220 of file Property.h.

    00221   : Property( right         )
    00222   , m_value ( right.m_value )
    00223   , m_own   ( right.own     )
    00224 { if ( m_own ) { m_value = new TYPE(right.value()) ; } }

template<class TYPE>

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

virtual destructor

Definition at line 229 of file Property.h.

    00230 { if ( m_own ) { delete m_value ; } ;  m_value = 0 ; }

## Member Function Documentation

template<class TYPE>

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

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

Definition at line 236 of file Property.h.

    00237 {
    00238   if ( !setValue ( value ) )
    00239   { throw std::out_of_range( "Value not verified" ) ; }
    00240   return *this ;
    00241 }

template<class TYPE>

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

Definition at line 324 of file Property.h.

    00325 {
    00326   // assign the base class
    00327   Property::operator=( right ) ;
    00328   // assign the value
    00329   PropertyWithValue<TYPE>::operator=( right.value() ) ;
    00330   return *this ;
    00331 }

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< bool, BoundedVerifier< bool > >, PropertyWithVerifier< std::string, BoundedVerifier< std::string > >, 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< bool >.

Definition at line 338 of file Property.h.

    00339 {
    00340   // assign the base class
    00341   Property::operator=( right ) ;
    00342   // assign the value
    00343   PropertyWithValue<TYPE>::operator=( right.value() ) ;
    00344   return *this ;
    00345 }

template<class TYPE>

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

Definition at line 172 of file Property.h.

    00172 { return value() ;}

template<class TYPE>

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

get the access to the storage

Definition at line 306 of file Property.h.

    00307 { useReadHandler() ; return *m_value ; }

template<class TYPE>

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

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>

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

get the value from another property

implementation of Property::assign

Implements Property.

Definition at line 247 of file Property.h.

    00248 {
    00249   // 1) Is the property of "the same" type?
    00250   const PropertyWithValue<TYPE>* p =
    00251     dynamic_cast<const PropertyWithValue<TYPE>*>       ( &source ) ;
    00252   if ( 0 != p ) { return setValue ( p->value() ) ; }       // RETURN
    00253   // 2) Else use the string representation
    00254   return this->fromString( source.toString() ).isSuccess() ;
    00255 }

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

    00262 {
    00263   // gelegate to the 'opposite' method ;
    00264   return dest.assign( *this ) ;
    00265 }

template<class TYPE>

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

string -> value

Implementation of PropertyWithValue::fromString.

Implements Property.

Definition at line 281 of file Property.h.

    00282 {
    00283   TYPE tmp ;
    00284   StatusCode sc = Gaudi::Parsers::parse ( tmp , source ) ;
    00285   if ( sc.isFailure() ) { return sc ; }
    00286   return setValue ( tmp ) ? StatusCode::SUCCESS : StatusCode::FAILURE ;
    00287 }

template<class TYPE>

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

value -> string

Implementation of PropertyWithValue::toString.

Implements Property.

Definition at line 271 of file Property.h.

    00272 {
    00273   useReadHandler();
    00274   return Gaudi::Utils::toString( *m_value ) ;
    00275 }

template<class TYPE>

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

Definition at line 313 of file Property.h.

    00313 { *m_value = value ; }

template<class TYPE>

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

Definition at line 318 of file Property.h.

    00318 { return m_value ; }

## Member Data Documentation

template<class TYPE>

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

Definition at line 189 of file Property.h.

template<class TYPE>

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

Definition at line 190 of file Property.h.

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

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