Gaudi Framework, version v20r2

Generated: 18 Jul 2008

GaudiAlg::ID Class Reference

#include <GaudiAlg/GaudiHistoID.h>

Collaboration diagram for GaudiAlg::ID:

Collaboration graph
[legend]
List of all members.

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.

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 LiteralID & literalID () const
 Returns the ID as a LiteralID.
NumericID numericID () const
 Returns the numerical ID.
ID & operator++ ()
 Operator ++ (prefix).
ID operator++ (int)
 Operator ++(int) (postfix).
ID & operator-- ()
 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.


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.

References m_nID.

Referenced by operator++(), operator--(), and undefined().

00059 { return -1 != m_nID ;    }

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

Is this ID numeric.

Definition at line 61 of file GaudiHistoID.h.

References std::basic_string< _CharT, _Traits, _Alloc >::empty(), and m_aID.

Referenced by idAsString(), and undefined().

00061 { return !m_aID.empty() ; }

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

Is this ID undefined.

Definition at line 63 of file GaudiHistoID.h.

References literal(), and numeric().

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.

References m_aID.

Referenced by idAsString().

00065 { return m_aID; }

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

Returns the numerical ID.

Definition at line 67 of file GaudiHistoID.h.

References m_nID.

Referenced by idAsString().

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.

References m_nID, and numeric().

Referenced by operator++().

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.

References operator++().

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.

References m_nID, and numeric().

Referenced by operator--().

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.

References operator--().

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.

References literal(), literalID(), and numericID().

Referenced by operator std::string(), GaudiAlg::PrintTuple::print(), GaudiAlg::Print2DProf::toString(), GaudiAlg::Print1DProf::toString(), GaudiAlg::Print3D::toString(), GaudiAlg::Print2D::toString(), and GaudiAlg::Print1D::toString().

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.

References idAsString().

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.

References operator==().

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.

Referenced by numeric(), numericID(), operator++(), and operator--().

LiteralID GaudiAlg::ID::m_aID [private]

Internal alpha-numeric ID.

Definition at line 135 of file GaudiHistoID.h.

Referenced by literal(), and literalID().


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