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

In This Package:

GaudiAlg::ID Class Reference

ID class for Histogram and Ntuples. More...

#include <GaudiAlg/GaudiHistoID.h>

List of all members.


Public Types

typedef int NumericID
 type for internal numeric ID
typedef std::string LiteralID
 type for internal literal ID

Public Member Functions

 ID (const NumericID id=-1)
 Implicit constructor from a numeric ID.
 ID (const LiteralID &id)
 Implicit constructor from a literal ID.
 ID (const char *id)
 Implicit constructor from a char *.
 ~ID ()
 Destructor.
bool numeric () const
 Is this ID numeric.
bool literal () const
 Is this ID numeric.
bool undefined () const
 Is this ID undefined.
const LiteralIDliteralID () const
 Returns the ID as a LiteralID.
NumericID numericID () const
 Returns the numerical ID.
IDoperator++ ()
 Operator ++ (prefix).
ID operator++ (int)
 Operator ++(int) (postfix).
IDoperator-- ()
 Operator -- (prefix).
ID operator-- (int)
 Operator --(int) (postfix).
LiteralID idAsString () const
 Return ID as string, for both numeric and literal IDs.
 operator std::string () const
 cast operator to std::striqng
bool operator== (const ID &id) const
 Implement the operator == Implementation depends on type of ID.
bool operator!= (const ID &id) const
 Implement the != operator, using the == operator.
bool operator< (const ID &id) const
 Implement the operator < Implementation depends on type of ID.

Private Attributes

NumericID m_nID
 Internal numeric ID.
LiteralID m_aID
 Internal alpha-numeric ID.

Detailed Description

ID class for Histogram and Ntuples.

Internally handles both numeric and string like IDs

Author:
Chris Jones Christopher.Rob.Jones@cern.ch
Date:
2005-08-12

Definition at line 42 of file GaudiHistoID.h.


Member Typedef Documentation

typedef int GaudiAlg::ID::NumericID

type for internal numeric ID

Definition at line 46 of file GaudiHistoID.h.

typedef std::string GaudiAlg::ID::LiteralID

type for internal literal ID

Definition at line 48 of file GaudiHistoID.h.


Constructor & Destructor Documentation

GaudiAlg::ID::ID ( const NumericID  id = -1  )  [inline]

Implicit constructor from a numeric ID.

Definition at line 51 of file GaudiHistoID.h.

00051 : m_nID ( id ) , m_aID( "" ) { }

GaudiAlg::ID::ID ( const LiteralID id  )  [inline]

Implicit constructor from a literal ID.

Definition at line 53 of file GaudiHistoID.h.

00053 : m_nID ( -1 ) , m_aID( id ) { }

GaudiAlg::ID::ID ( const char *  id  )  [inline]

Implicit constructor from a char *.

Definition at line 55 of file GaudiHistoID.h.

00055 : m_nID ( -1 ) , m_aID( id ) { }

GaudiAlg::ID::~ID (  )  [inline]

Destructor.

Definition at line 57 of file GaudiHistoID.h.

00057 { }


Member Function Documentation

bool GaudiAlg::ID::numeric (  )  const [inline]

Is this ID numeric.

Definition at line 59 of file GaudiHistoID.h.

00059 { return -1 != m_nID ;    }

bool GaudiAlg::ID::literal (  )  const [inline]

Is this ID numeric.

Definition at line 61 of file GaudiHistoID.h.

00061 { return !m_aID.empty() ; }

bool GaudiAlg::ID::undefined (  )  const [inline]

Is this ID undefined.

Definition at line 63 of file GaudiHistoID.h.

00063 { return !numeric() && !literal(); }

const LiteralID& GaudiAlg::ID::literalID (  )  const [inline]

Returns the ID as a LiteralID.

Definition at line 65 of file GaudiHistoID.h.

00065 { return m_aID; }

NumericID GaudiAlg::ID::numericID (  )  const [inline]

Returns the numerical ID.

Definition at line 67 of file GaudiHistoID.h.

00067 { return m_nID; }

ID& GaudiAlg::ID::operator++ (  )  [inline]

Operator ++ (prefix).

Attention:
Only valid for numeric IDs. Has NO effect on literal IDs

Definition at line 71 of file GaudiHistoID.h.

00072     { 
00073       if ( numeric() ) { ++m_nID; } ; 
00074       return *this ; 
00075     }

ID GaudiAlg::ID::operator++ ( int   )  [inline]

Operator ++(int) (postfix).

Attention:
Only valid for numeric IDs. Has NO effect on literal IDs

Definition at line 79 of file GaudiHistoID.h.

00080     { 
00081       const ID retID = *this;
00082       this->operator++();
00083       return retID;
00084     }

ID& GaudiAlg::ID::operator-- (  )  [inline]

Operator -- (prefix).

Attention:
Only valid for numeric IDs. Has NO effect on literal IDs

Definition at line 88 of file GaudiHistoID.h.

00089     { 
00090       if ( numeric() ) { --m_nID; } ; 
00091       return *this ; 
00092     }

ID GaudiAlg::ID::operator-- ( int   )  [inline]

Operator --(int) (postfix).

Attention:
Only valid for numeric IDs. Has NO effect on literal IDs

Definition at line 96 of file GaudiHistoID.h.

00097     { 
00098       const ID retID = *this;
00099       this->operator--();
00100       return retID;
00101     }

GaudiAlg::ID::LiteralID GaudiAlg::ID::idAsString (  )  const

Return ID as string, for both numeric and literal IDs.

Definition at line 22 of file GaudiHistoID.cpp.

00023 {
00024   return ( literal() ? literalID() : 
00025            boost::lexical_cast<LiteralID>(numericID()) );
00026 }

GaudiAlg::ID::operator std::string (  )  const [inline]

cast operator to std::striqng

Definition at line 105 of file GaudiHistoID.h.

00105 { return idAsString () ; }

bool GaudiAlg::ID::operator== ( const ID id  )  const [inline]

Implement the operator == Implementation depends on type of ID.

Returns:
boolean indicating if the IDs are equal

Definition at line 110 of file GaudiHistoID.h.

00111     {
00112       return ( numeric() && id.numeric()   ? id.numericID() == numericID() :
00113                ( literal() && id.literal() ? id.literalID() == literalID() :
00114                  id.idAsString() == idAsString() ) );
00115     }

bool GaudiAlg::ID::operator!= ( const ID id  )  const [inline]

Implement the != operator, using the == operator.

Definition at line 117 of file GaudiHistoID.h.

00118     {
00119       return ! this->operator==(id);
00120     }

bool GaudiAlg::ID::operator< ( const ID id  )  const [inline]

Implement the operator < Implementation depends on type of ID.

Returns:
boolean indicating the order of the IDs

Definition at line 125 of file GaudiHistoID.h.

00126     {
00127       return ( numeric() && id.numeric()   ? this->numericID() < id.numericID() :
00128                ( literal() && id.literal() ? this->literalID() < id.literalID() :
00129                  this->idAsString() < id.idAsString() ) );
00130     }


Member Data Documentation

NumericID GaudiAlg::ID::m_nID [private]

Internal numeric ID.

Definition at line 133 of file GaudiHistoID.h.

LiteralID GaudiAlg::ID::m_aID [private]

Internal alpha-numeric ID.

Definition at line 135 of file GaudiHistoID.h.


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

Generated on Mon Apr 11 19:58:22 2011 for GaudiAlg by doxygen 1.4.7