#include <DetDesc/BasicParam.h>
Inheritance diagram for BasicParam:
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 BasicParam * | new_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. |
Definition at line 15 of file BasicParam.h.
virtual BasicParam::~BasicParam | ( | ) | [inline, virtual] |
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 }
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 }
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] |
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] |
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] |
virtual const void* BasicParam::_get_ptr | ( | ) | const [private, pure virtual] |