| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

BasicParam Class Reference

Simple class used to provide common handle for generic parameters. More...

#include <DetDesc/BasicParam.h>

Inheritance diagram for BasicParam:

[legend]
List of all members.

Public Member Functions

virtual ~BasicParam ()
 Virtual destructor, just to be safe.
template<class T>
T & get ()
 Generic getter.
template<class T>
const T & get () const
 Generic getter (const version). see above.
template<class T>
void set (const T &val)
 Generic setter. Same cosideration as for the getters.
virtual std::string toStr () const =0
 String representation for printout.
virtual std::string toXMLStr (const std::string &name, const std::string &comment="", int precision=16) const =0
 String representation for XML format.
virtual const std::type_info & type () const =0
 TypeId of the datum.
virtual BasicParamnew_copy () const =0
 Used for generic copy.

Private Member Functions

virtual void * _get_ptr ()=0
 Handle to access the real datum.
virtual const void * _get_ptr () const =0
 Handle to access the real datum.

Detailed Description

Simple class used to provide common handle for generic parameters.

Author:
Marco CLEMENCIC
Date:
2005-02-22

Definition at line 15 of file BasicParam.h.


Constructor & Destructor Documentation

virtual BasicParam::~BasicParam (  )  [inline, virtual]

Virtual destructor, just to be safe.

Definition at line 19 of file BasicParam.h.

00019 {};


Member Function Documentation

template<class T>
T& BasicParam::get (  )  [inline]

Generic getter.

When accessing the datum of a parameter through the base class you should specify the exact type (no automatic conversion implemented).

Reimplemented in Param< T >.

Definition at line 24 of file BasicParam.h.

00024                   {
00025     if (type() != typeid(T)) { throw std::bad_cast(); }
00026     return *(T*)_get_ptr();
00027   }

template<class T>
const T& BasicParam::get (  )  const [inline]

Generic getter (const version). see above.

Reimplemented in Param< T >.

Definition at line 30 of file BasicParam.h.

00030                               {
00031     if (type() != typeid(T)) { throw std::bad_cast(); }
00032     return *(T*)_get_ptr();
00033   }

template<class T>
void BasicParam::set ( const T &  val  )  [inline]

Generic setter. Same cosideration as for the getters.

Definition at line 37 of file BasicParam.h.

00037                                 {
00038     if (type() != typeid(T)) { throw std::bad_cast(); }
00039     *(T*)_get_ptr() = val;
00040   }

virtual std::string BasicParam::toStr (  )  const [pure virtual]

String representation for printout.

Implemented in Param< T >, and Param< T >.

virtual std::string BasicParam::toXMLStr ( const std::string &  name,
const std::string &  comment = "",
int  precision = 16 
) const [pure virtual]

String representation for XML format.

Implemented in Param< T >, Param< T >, Param< T >, Param< T >, Param< T >, Param< T >, Param< T >, Param< T >, Param< T >, Param< T >, Param< T >, Param< T >, and Param< T >.

virtual const std::type_info& BasicParam::type (  )  const [pure virtual]

TypeId of the datum.

Implemented in Param< T >.

virtual BasicParam* BasicParam::new_copy (  )  const [pure virtual]

Used for generic copy.

You can copy type-safely a parameter via the base class. (Needed by ParamList)

Implemented in Param< T >.

virtual void* BasicParam::_get_ptr (  )  [private, pure virtual]

Handle to access the real datum.

Implemented in Param< T >.

virtual const void* BasicParam::_get_ptr (  )  const [private, pure virtual]

Handle to access the real datum.

Implemented in Param< T >.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:00:17 2011 for DetDesc by doxygen 1.4.7