Gaudi Framework, version v20r2

Generated: 18 Jul 2008

PropertyWithValue< TYPE > Class Template Reference

#include <Property.h>

Inheritance diagram for PropertyWithValue< TYPE >:

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

Collaboration graph
[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 147 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
template<>
std::string toString () const
 value -> string
template<>
bool assign (const Property &source)
 import the property value form the source

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
PropertyWithValueoperator= (const TYPE &value)
 assignement operator
PropertyWithValueoperator= (const PropertyWithValue &rhs)
template<class OTHER>
PropertyWithValueoperator= (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 196 of file Property.h.

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

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

References PropertyWithValue< TYPE >::value().

00209   : Property( right         )
00210   , m_value ( right.m_value )
00211   , m_own   ( right.own     ) 
00212 { 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 219 of file Property.h.

References PropertyWithValue< TYPE >::value().

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

template<class TYPE>
PropertyWithValue< TYPE >::~PropertyWithValue (  )  [inline, protected, virtual]

virtual destructor

Definition at line 228 of file Property.h.

References PropertyWithValue< TYPE >::m_own, and PropertyWithValue< TYPE >::m_value.

00229 { 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 >, and PropertyWithVerifier< std::vectorstring, BoundedVerifier< std::vectorstring > >.

Definition at line 235 of file Property.h.

References PropertyWithValue< TYPE >::setValue().

Referenced by PropertyWithVerifier< TYPE, VERIFIER >::operator=(), and PropertyWithValue< TYPE >::operator=().

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

template<class TYPE>
PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< TYPE > &  rhs  )  [protected]

Definition at line 323 of file Property.h.

References PropertyWithValue< TYPE >::operator=(), and PropertyWithValue< TYPE >::value().

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

template<class TYPE>
template<class OTHER>
PropertyWithValue< TYPE > & PropertyWithValue< TYPE >::operator= ( const PropertyWithValue< OTHER > &  right  )  [protected]

Reimplemented in PropertyWithVerifier< TYPE, VERIFIER >, SimpleProperty< TYPE, VERIFIER >, SimplePropertyRef< TYPE, VERIFIER >, PropertyWithVerifier< std::vectorstring, BoundedVerifier< std::vectorstring > >, and SimpleProperty< std::vectorstring > >.

Definition at line 337 of file Property.h.

References PropertyWithValue< TYPE >::operator=(), and PropertyWithValue< TYPE >::value().

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

template<class TYPE>
PropertyWithValue< TYPE >::operator const TYPE & (  )  const [inline]

Definition at line 171 of file Property.h.

References PropertyWithValue< TYPE >::value().

00171 { return value() ;}

template<class TYPE>
const TYPE & PropertyWithValue< TYPE >::value (  )  const [inline]

get the access to the storage

Definition at line 305 of file Property.h.

References PropertyWithValue< TYPE >::m_value, and Property::useReadHandler().

Referenced by Algorithm::Algorithm(), AlgTool::AlgTool(), PropertyWithValue< TYPE >::assign(), AIDATupleSvc::connect(), NTupleSvc::createService(), OutputStream::decodeAlgorithms(), ApplicationMgr::decodeCreateSvcNameList(), ApplicationMgr::decodeDllNameList(), ApplicationMgr::decodeExtSvcNameList(), ApplicationMgr::decodeMultiThreadSvcNameList(), Sequencer::decodeNames(), GaudiSequencer::decodeNames(), MinimalEventLoopMgr::decodeOutStreams(), MinimalEventLoopMgr::decodeTopAlgs(), MessageSvc::finalize(), ChronoStatSvc::finalize(), HbookCnv::HFileCnv::initialize(), StatusCodeSvc::initialize(), HistorySvc::initialize(), ExceptionSvc::initialize(), PythonScriptingSvc::initialize(), PoolDbCnvSvc::initialize(), PoolDbCacheSvc::initialize(), MinimalEventLoopMgr::initialize(), Sequencer::isStopOverride(), PropertyWithValue< TYPE >::operator const TYPE &(), PropertyWithValue< TYPE >::operator=(), Service::outputLevel(), PropertyWithValue< TYPE >::PropertyWithValue(), MessageSvc::reportMessage(), ChronoStatSvc::saveStats(), PersistencySvc::service(), Service::Service(), CommandProperty::set(), MessageSvc::setupColors(), THistSvc::setupInputFile(), IssueLogger::setupLevels(), THistSvc::setupOutputFile(), IssueLogger::setupStreams(), MessageSvc::setupThreshold(), StatusCodeSvc::suppressCheck(), and PropertyWithValue< TYPE >::toString().

00306 { useReadHandler() ; return *m_value ; }

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

Implemented in PropertyWithVerifier< TYPE, VERIFIER >, and PropertyWithVerifier< std::vectorstring, BoundedVerifier< std::vectorstring > >.

Referenced by PropertyWithValue< TYPE >::assign(), PropertyWithValue< TYPE >::fromString(), and PropertyWithValue< TYPE >::operator=().

template<class TYPE>
bool PropertyWithValue< TYPE >::assign ( const Property source  )  [inline, virtual]

get the value from another property

Implements Property.

Definition at line 246 of file Property.h.

References PropertyWithValue< TYPE >::fromString(), PropertyWithValue< TYPE >::setValue(), Property::toString(), and PropertyWithValue< TYPE >::value().

Referenced by AlgTool::AlgTool(), RootHistCnv::RConverter::convertId(), PythonScriptingSvc::initialize(), and PoolDbCnvSvc::initialize().

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

template<class TYPE>
bool PropertyWithValue< TYPE >::load ( Property dest  )  const [inline, virtual]

set value for another property

Implements Property.

Definition at line 260 of file Property.h.

References Property::assign().

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

template<class TYPE>
StatusCode PropertyWithValue< TYPE >::fromString ( const std::string s  )  [inline, virtual]

string -> value

Implements Property.

Definition at line 280 of file Property.h.

References StatusCode::FAILURE, StatusCode::isFailure(), Gaudi::Parsers::parse(), PropertyWithValue< TYPE >::setValue(), and StatusCode::SUCCESS.

Referenced by PropertyWithValue< TYPE >::assign().

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

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

value -> string

Implements Property.

Definition at line 270 of file Property.h.

References PropertyWithValue< TYPE >::m_value, Gaudi::Utils::toString(), and Property::useReadHandler().

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

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

Definition at line 312 of file Property.h.

Referenced by PropertyWithVerifier< TYPE, VERIFIER >::set().

00312 { *m_value = value ; }

template<class TYPE>
TYPE * PropertyWithValue< TYPE >::i_get (  )  const [inline, protected]

Definition at line 317 of file Property.h.

References PropertyWithValue< TYPE >::m_value.

00317 { return m_value ; }

template<>
std::string PropertyWithValue< std::string >::toString (  )  const [inline, virtual]

value -> string

Implements Property.

Definition at line 292 of file Property.h.

References PropertyWithValue< TYPE >::value().

00293 { return this->value() ; }

template<>
bool PropertyWithValue< std::string >::assign ( const Property source  )  [inline, virtual]

import the property value form the source

Implements Property.

Definition at line 296 of file Property.h.

References PropertyWithValue< TYPE >::fromString(), and Property::toString().

00297 { return this->fromString( source.toString() ).isSuccess() ; }


Member Data Documentation

template<class TYPE>
TYPE* PropertyWithValue< TYPE >::m_value [private]

Definition at line 188 of file Property.h.

Referenced by PropertyWithValue< TYPE >::i_get(), PropertyWithValue< TYPE >::toString(), PropertyWithValue< TYPE >::value(), and PropertyWithValue< TYPE >::~PropertyWithValue().

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

Definition at line 189 of file Property.h.

Referenced by PropertyWithValue< TYPE >::~PropertyWithValue().


The documentation for this class was generated from the following file:
Generated at Fri Jul 18 12:09:05 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004