| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# GaudiAlg::ID Class Reference

ID class for Histogram and Ntuples. More...

`#include <GaudiAlg/GaudiHistoID.h>`

Collaboration diagram for GaudiAlg::ID:

[legend]

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 literal ID.
| ~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.
GAUDI_API LiteralID | idAsString () const
| Return ID as string, for both numeric and literal IDs.
| operator std::string () const
| cast operator to std::string
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.
GAUDI_API std::ostream & | fillStream (std::ostream &s) const
bool | operator! () const
| good ID?
size_t | hash () const
| return hash value (for python)
size_t | __hash__ () const
| return hash value (for python)
## Private Attributes
NumericID | m_nID
| Internal numeric ID.
LiteralID | m_aID
| Internal alpha-numeric ID.
size_t | m_hash
| the hash value of 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 46 of file GaudiHistoID.h.

## Member Typedef Documentation

typedef int GaudiAlg::ID::NumericID

type for internal numeric ID

Definition at line 51 of file GaudiHistoID.h.

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

type for internal literal ID

Definition at line 53 of file GaudiHistoID.h.

## Constructor & Destructor Documentation

GaudiAlg::ID::ID | ( | const NumericID | id = `-1` | ) |

Implicit constructor from a numeric ID.

Definition at line 29 of file GaudiHistoID.cpp.

    00030   : m_nID  ( id )
    00031   , m_aID  ( "" )
    00032   , m_hash ( boost::hash_value ( id ) )
    00033 {}

GaudiAlg::ID::ID | ( | const LiteralID & | id | ) |

Implicit constructor from a literal ID.

Definition at line 37 of file GaudiHistoID.cpp.

    00038   : m_nID ( -1 )
    00039   , m_aID ( id )
    00040   , m_hash ( boost::hash_value ( id ) )
    00041 {}

GaudiAlg::ID::ID | ( | const char * | id | ) |

Implicit constructor from a literal ID.

Definition at line 45 of file GaudiHistoID.cpp.

    00046   : m_nID  ( -1 )
    00047   , m_aID  ( id )
    00048   , m_hash ( 0 )
    00049 { m_hash = boost::hash_value ( m_aID ) ; }

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

Destructor.

Definition at line 64 of file GaudiHistoID.h.

    00064 {} ;

## Member Function Documentation

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

Is this ID numeric.

Definition at line 66 of file GaudiHistoID.h.

    00066 { return -1 != m_nID ;    }

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

Is this ID numeric.

Definition at line 68 of file GaudiHistoID.h.

    00068 { return !m_aID.empty() ; }

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

Is this ID undefined.

Definition at line 70 of file GaudiHistoID.h.

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

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

Returns the ID as a LiteralID.

Definition at line 72 of file GaudiHistoID.h.

    00072 { return m_aID; }

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

Returns the numerical ID.

Definition at line 74 of file GaudiHistoID.h.

    00074 { return m_nID; }

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

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

Definition at line 51 of file GaudiHistoID.cpp.

    00052 {
    00053   std::ostringstream s ;
    00054   fillStream ( s ) ;
    00055   return s.str() ;
    00056 }

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

cast operator to std::string

Definition at line 78 of file GaudiHistoID.h.

    00078 { 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 83 of file GaudiHistoID.h.

    00084     {
    00085       return
    00086         hash    () != id.hash    () ? false                           :
    00087         numeric () && id.numeric () ? id.numericID () == numericID () :
    00088         literal () && id.literal () ? id.literalID () == literalID () :
    00089         idAsString () == id.idAsString() ;
    00090     }

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

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

Definition at line 92 of file GaudiHistoID.h.

    00092 { return ! ( *this == id ) ; }

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 97 of file GaudiHistoID.h.

    00098     {
    00099       return
    00100         //hash () < id.hash () ? true  :
    00101         //hash () > id.hash () ? false :
    00102         numeric    () && id.numeric() ? numericID() < id.numericID() :
    00103         literal    () && id.literal() ? literalID() < id.literalID() :
    00104         idAsString () < id.idAsString() ;
    00105     }

std::ostream & GaudiAlg::ID::fillStream | ( | std::ostream & | s | ) | const

Definition at line 60 of file GaudiHistoID.cpp.

    00061 {
    00062   if      ( numeric() ) { s << numericID() ; }
    00063   else if ( literal() ) { s << literalID() ; }
    00064   else                  { s << "UNDEFINED" ; }
    00065   return s ;
    00066 }

bool GaudiAlg::ID::operator! | ( |  | ) | const`[inline]`

good ID?

Definition at line 112 of file GaudiHistoID.h.

    00112 { return undefined() ; }

size_t GaudiAlg::ID::hash | ( |  | ) | const`[inline]`

return hash value (for python)

Definition at line 117 of file GaudiHistoID.h.

    00117 { return m_hash    ; }

size_t GaudiAlg::ID::__hash__ | ( |  | ) | const`[inline]`

return hash value (for python)

Definition at line 119 of file GaudiHistoID.h.

    00119 { return   hash () ; }

## Member Data Documentation

NumericID GaudiAlg::ID::m_nID`[private]`

Internal numeric ID.

Definition at line 124 of file GaudiHistoID.h.

LiteralID GaudiAlg::ID::m_aID`[private]`

Internal alpha-numeric ID.

Definition at line 126 of file GaudiHistoID.h.

size_t GaudiAlg::ID::m_hash`[private]`

the hash value of ID

Definition at line 131 of file GaudiHistoID.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiAlg/GaudiAlg/GaudiHistoID.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiAlg/src/lib/GaudiHistoID.cpp