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

In This Package:

Param< T > Class Template Reference

Class implementing a polimorfic parameter using templates. More...

#include <DetDesc/Param.h>

Inheritance diagram for Param< T >:

[legend]
Collaboration diagram for Param< T >:
[legend]
List of all members.

Public Types

typedef T value_type

Public Member Functions

 Param ()
 Standard constructor.
 Param (const value_type &val)
 Constructor by value.
virtual ~Param ()
 Destructor.
template<class T1>
void set (const T1 &val)
 Setter (with automatic conversion).
value_typeget ()
 Getter.
const value_typeget () const
 Getter (const version).
virtual std::string toStr () const
 String representation for printout.
virtual std::string toXMLStr (const std::string &name, const std::string &comment="", int precision=16) const
 String representation for printout.
virtual const std::type_info & type () const
 TypeId of the datum.
virtual BasicParamnew_copy () const
 Create a copy of this object on the heap (generic copy).
template<>
std::string toStr () const
 String representation for printout.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<>
std::string toXMLStr (const std::string &name, const std::string &comment, int precision) const
 String representation for XML format.
template<class T>
void set (const T &val)
 Generic setter. Same cosideration as for the getters.

Private Member Functions

virtual void * _get_ptr ()
 Void pointer to the datum (used by BasicParam).
virtual const void * _get_ptr () const
 Void pointer to the datum (used by BasicParam), const version.

Private Attributes

value_type m_val
 Where the datum is stored.

Detailed Description

template<class T>
class Param< T >

Class implementing a polimorfic parameter using templates.

Author:
Marco CLEMENCIC
Date:
2005-02-22

Definition at line 23 of file Param.h.


Member Typedef Documentation

template<class T>
typedef T Param< T >::value_type

Definition at line 25 of file Param.h.


Constructor & Destructor Documentation

template<class T>
Param< T >::Param (  )  [inline]

Standard constructor.

Definition at line 28 of file Param.h.

00028 : m_val() {}

template<class T>
Param< T >::Param ( const value_type val  )  [inline]

Constructor by value.

Definition at line 31 of file Param.h.

00031 : m_val(val) {}

template<class T>
virtual Param< T >::~Param (  )  [inline, virtual]

Destructor.

Definition at line 33 of file Param.h.


Member Function Documentation

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

Setter (with automatic conversion).

Definition at line 37 of file Param.h.

00037 { m_val = val; }

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

Getter.

Reimplemented from BasicParam.

Definition at line 40 of file Param.h.

00040 { return m_val; }

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

Getter (const version).

Reimplemented from BasicParam.

Definition at line 43 of file Param.h.

00043 { return m_val; }

template<class T>
std::string Param< T >::toStr (  )  const [inline, virtual]

String representation for printout.

Implements BasicParam.

Definition at line 74 of file Param.h.

00074                                        {
00075   using namespace GaudiUtils;
00076   std::ostringstream o;
00077   o << m_val;
00078   return o.str();
00079 }

template<class T>
std::string Param< T >::toXMLStr ( const std::string &  name,
const std::string &  comment = "",
int  precision = 16 
) const [virtual]

String representation for printout.

Only a limited number of types are allowed in the XML representation of a ParamValidDataObject

Implements BasicParam.

Definition at line 91 of file Param.h.

00091                                                                           {
00092   throw GaudiException(std::string("Cannot convert parameter of type ") + typeid(m_val).name() + " to XML",
00093                        "Param<T>::toXMLStr()", StatusCode::FAILURE );
00094   return "";
00095 }

template<class T>
virtual const std::type_info& Param< T >::type (  )  const [inline, virtual]

TypeId of the datum.

Implements BasicParam.

Definition at line 54 of file Param.h.

00054 { return typeid(T); }

template<class T>
virtual BasicParam* Param< T >::new_copy (  )  const [inline, virtual]

Create a copy of this object on the heap (generic copy).

Implements BasicParam.

Definition at line 57 of file Param.h.

00057                                         {
00058     return new Param<T>(m_val);
00059   }

template<class T>
virtual void* Param< T >::_get_ptr (  )  [inline, private, virtual]

Void pointer to the datum (used by BasicParam).

Implements BasicParam.

Definition at line 63 of file Param.h.

00063 { return (void*)&m_val;}

template<class T>
virtual const void* Param< T >::_get_ptr (  )  const [inline, private, virtual]

Void pointer to the datum (used by BasicParam), const version.

Implements BasicParam.

Definition at line 65 of file Param.h.

00065 { return (void*)&m_val;}

template<>
std::string Param< double >::toStr (  )  const [inline, virtual]

String representation for printout.

Implements BasicParam.

Definition at line 81 of file Param.h.

00081                                                        {
00082   std::ostringstream o;
00083   o.precision(16);
00084   o << m_val;
00085   return o.str();
00086 }

template<>
std::string Param< int >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< double >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::string >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::vector< int > >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::vector< double > >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::vector< std::string > >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::map< std::string, int > >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::map< std::string, double > >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::map< std::string, std::string > >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::map< int, int > >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::map< int, double > >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

template<>
std::string Param< std::map< int, std::string > >::toXMLStr ( const std::string &  name,
const std::string &  comment,
int  precision 
) const [virtual]

String representation for XML format.

Implements BasicParam.

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

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   }


Member Data Documentation

template<class T>
value_type Param< T >::m_val [private]

Where the datum is stored.

Definition at line 67 of file Param.h.


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:19 2011 for DetDesc by doxygen 1.4.7