All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiAlg::ID Class Reference

ID class for Histogram and Ntuples. More...

#include <GaudiAlg/GaudiHistoID.h>

Collaboration diagram for GaudiAlg::ID:

Public Types

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

Public Member Functions

 ID (const NumericID id=-1)
 Implicit constructor from a numeric ID. More...
 
 ID (const LiteralID &id)
 Implicit constructor from a literal ID. More...
 
 ID (const char *id)
 Implicit constructor from a literal ID. More...
 
 ~ID ()
 Destructor. More...
 
bool numeric () const
 Is this ID numeric. More...
 
bool literal () const
 Is this ID numeric. More...
 
bool undefined () const
 Is this ID undefined. More...
 
const LiteralID & literalID () const
 Returns the ID as a LiteralID. More...
 
NumericID numericID () const
 Returns the numerical ID. More...
 
GAUDI_API LiteralID idAsString () const
 Return ID as string, for both numeric and literal IDs. More...
 
 operator std::string () const
 cast operator to std::string More...
 
bool operator== (const ID &id) const
 Implement the operator == Implementation depends on type of ID. More...
 
bool operator!= (const ID &id) const
 Implement the != operator, using the == operator. More...
 
bool operator< (const ID &id) const
 Implement the operator < Implementation depends on type of ID. More...
 
GAUDI_API std::ostream & fillStream (std::ostream &s) const
 
bool operator! () const
 good ID? More...
 
size_t hash () const
 return hash value (for python) More...
 
size_t __hash__ () const
 return hash value (for python) More...
 

Private Attributes

NumericID m_nID
 Internal numeric ID. More...
 
LiteralID m_aID
 Internal alpha-numeric ID. More...
 
size_t m_hash
 the hash value of ID More...
 

Detailed Description

ID class for Histogram and Ntuples.

Internally handles both numeric and string like IDs

Author
Chris Jones Chris.nosp@m.toph.nosp@m.er.Ro.nosp@m.b.Jo.nosp@m.nes@c.nosp@m.ern..nosp@m.ch
Date
2005-08-12

Definition at line 46 of file GaudiHistoID.h.

Member Typedef Documentation

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

type for internal literal ID

Definition at line 53 of file GaudiHistoID.h.

type for internal numeric ID

Definition at line 51 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.

30  : m_nID ( id )
31  , m_aID ( "" )
32  , m_hash ( boost::hash_value ( id ) )
33 {}
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:131
NumericID m_nID
Internal numeric ID.
Definition: GaudiHistoID.h:124
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
Definition: StringKey.h:214
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:126
GaudiAlg::ID::ID ( const LiteralID &  id)

Implicit constructor from a literal ID.

Definition at line 37 of file GaudiHistoID.cpp.

38  : m_nID ( -1 )
39  , m_aID ( id )
40  , m_hash ( boost::hash_value ( id ) )
41 {}
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:131
NumericID m_nID
Internal numeric ID.
Definition: GaudiHistoID.h:124
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
Definition: StringKey.h:214
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:126
GaudiAlg::ID::ID ( const char *  id)

Implicit constructor from a literal ID.

Definition at line 45 of file GaudiHistoID.cpp.

46  : m_nID ( -1 )
47  , m_aID ( id )
48  , m_hash ( 0 )
49 { m_hash = boost::hash_value ( m_aID ) ; }
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:131
NumericID m_nID
Internal numeric ID.
Definition: GaudiHistoID.h:124
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
Definition: StringKey.h:214
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:126
GaudiAlg::ID::~ID ( )
inline

Destructor.

Definition at line 64 of file GaudiHistoID.h.

64 {} ;

Member Function Documentation

size_t GaudiAlg::ID::__hash__ ( ) const
inline

return hash value (for python)

Definition at line 119 of file GaudiHistoID.h.

119 { return hash () ; }
size_t hash() const
return hash value (for python)
Definition: GaudiHistoID.h:117
std::ostream & GaudiAlg::ID::fillStream ( std::ostream &  s) const

Definition at line 60 of file GaudiHistoID.cpp.

61 {
62  if ( numeric() ) { s << numericID() ; }
63  else if ( literal() ) { s << literalID() ; }
64  else { s << "UNDEFINED" ; }
65  return s ;
66 }
NumericID numericID() const
Returns the numerical ID.
Definition: GaudiHistoID.h:74
const LiteralID & literalID() const
Returns the ID as a LiteralID.
Definition: GaudiHistoID.h:72
string s
Definition: gaudirun.py:210
bool literal() const
Is this ID numeric.
Definition: GaudiHistoID.h:68
bool numeric() const
Is this ID numeric.
Definition: GaudiHistoID.h:66
size_t GaudiAlg::ID::hash ( ) const
inline

return hash value (for python)

Definition at line 117 of file GaudiHistoID.h.

117 { return m_hash ; }
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:131
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.

52 {
53  std::ostringstream s ;
54  fillStream ( s ) ;
55  return s.str() ;
56 }
GAUDI_API std::ostream & fillStream(std::ostream &s) const
string s
Definition: gaudirun.py:210
bool GaudiAlg::ID::literal ( ) const
inline

Is this ID numeric.

Definition at line 68 of file GaudiHistoID.h.

68 { return !m_aID.empty() ; }
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:126
const LiteralID& GaudiAlg::ID::literalID ( ) const
inline

Returns the ID as a LiteralID.

Definition at line 72 of file GaudiHistoID.h.

72 { return m_aID; }
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:126
bool GaudiAlg::ID::numeric ( ) const
inline

Is this ID numeric.

Definition at line 66 of file GaudiHistoID.h.

66 { return -1 != m_nID ; }
NumericID m_nID
Internal numeric ID.
Definition: GaudiHistoID.h:124
NumericID GaudiAlg::ID::numericID ( ) const
inline

Returns the numerical ID.

Definition at line 74 of file GaudiHistoID.h.

74 { return m_nID; }
NumericID m_nID
Internal numeric ID.
Definition: GaudiHistoID.h:124
GaudiAlg::ID::operator std::string ( ) const
inline

cast operator to std::string

Definition at line 78 of file GaudiHistoID.h.

78 { return idAsString () ; }
GAUDI_API LiteralID idAsString() const
Return ID as string, for both numeric and literal IDs.
bool GaudiAlg::ID::operator! ( ) const
inline

good ID?

Definition at line 112 of file GaudiHistoID.h.

112 { return undefined() ; }
bool undefined() const
Is this ID undefined.
Definition: GaudiHistoID.h:70
bool GaudiAlg::ID::operator!= ( const ID &  id) const
inline

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

Definition at line 92 of file GaudiHistoID.h.

92 { 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.

98  {
99  return
100  //hash () < id.hash () ? true :
101  //hash () > id.hash () ? false :
102  numeric () && id.numeric() ? numericID() < id.numericID() :
103  literal () && id.literal() ? literalID() < id.literalID() :
104  idAsString () < id.idAsString() ;
105  }
NumericID numericID() const
Returns the numerical ID.
Definition: GaudiHistoID.h:74
const LiteralID & literalID() const
Returns the ID as a LiteralID.
Definition: GaudiHistoID.h:72
GAUDI_API LiteralID idAsString() const
Return ID as string, for both numeric and literal IDs.
bool literal() const
Is this ID numeric.
Definition: GaudiHistoID.h:68
bool numeric() const
Is this ID numeric.
Definition: GaudiHistoID.h:66
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.

84  {
85  return
86  hash () != id.hash () ? false :
87  numeric () && id.numeric () ? id.numericID () == numericID () :
88  literal () && id.literal () ? id.literalID () == literalID () :
89  idAsString () == id.idAsString() ;
90  }
size_t hash() const
return hash value (for python)
Definition: GaudiHistoID.h:117
NumericID numericID() const
Returns the numerical ID.
Definition: GaudiHistoID.h:74
const LiteralID & literalID() const
Returns the ID as a LiteralID.
Definition: GaudiHistoID.h:72
GAUDI_API LiteralID idAsString() const
Return ID as string, for both numeric and literal IDs.
bool literal() const
Is this ID numeric.
Definition: GaudiHistoID.h:68
bool numeric() const
Is this ID numeric.
Definition: GaudiHistoID.h:66
bool GaudiAlg::ID::undefined ( ) const
inline

Is this ID undefined.

Definition at line 70 of file GaudiHistoID.h.

70 { return !numeric() && !literal(); }
bool literal() const
Is this ID numeric.
Definition: GaudiHistoID.h:68
bool numeric() const
Is this ID numeric.
Definition: GaudiHistoID.h:66

Member Data Documentation

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.

NumericID GaudiAlg::ID::m_nID
private

Internal numeric ID.

Definition at line 124 of file GaudiHistoID.h.


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