| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Private Attributes | List of all members
GaudiAlg::ID Class Reference

ID class for Histogram and Ntuples. More...

`#include <GaudiAlg/GaudiHistoID.h>`

Collaboration diagram for GaudiAlg::ID:
[legend]

## 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 (LiteralID &&id)
| Implicit 'move' constructor from a literal ID. More...
| ID (const LiteralID &id)
| Implicit 'copy' constructor from a literal ID. More...
| ID (const char *id)
| Implicit constructor from a literal ID. More...
| ~ID ()=default
| Destructor. More...
bool | numeric () const noexcept
| Is this ID numeric. More...
bool | literal () const noexcept
| Is this ID numeric. More...
bool | undefined () const noexcept
| Is this ID undefined. More...
const LiteralID & | literalID () const noexcept
| Returns the ID as a LiteralID. More...
NumericID | numericID () const noexcept
| 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 noexcept
| 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 noexcept
| Implement the operator < Implementation depends on type of ID. More...
GAUDI_API std::ostream & | fillStream (std::ostream &s) const
bool | operator! () const noexcept
| good ID? More...
size_t | hash () const noexcept
| return hash value (for python) More...
size_t | __hash__ () const noexcept
| return hash value (for python) More...

## Private Attributes
NumericID | m_nID {-1}
| Internal numeric ID. More...
LiteralID | m_aID
| Internal alpha-numeric ID. More...
size_t | m_hash {0}
| 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 44 of file GaudiHistoID.h.

## Member Typedef Documentation

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

type for internal literal ID

Definition at line 51 of file GaudiHistoID.h.

typedef int GaudiAlg::ID::NumericID

type for internal numeric ID

Definition at line 49 of file GaudiHistoID.h.

## Constructor & Destructor Documentation

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

Implicit constructor from a numeric ID.

Definition at line 56 of file GaudiHistoID.h.

57 : m_nID ( id )
58 , m_hash ( boost::hash_value ( id ) ) { }
GaudiAlg::ID::m_hash
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:139
GaudiAlg::ID::m_nID
NumericID m_nID
Internal numeric ID.
Definition: GaudiHistoID.h:132
Gaudi::hash_value
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
Definition: StringKey.h:216

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

Implicit 'move' constructor from a literal ID.

Definition at line 60 of file GaudiHistoID.h.

61 : m_aID ( std::move(id) )
62 , m_hash ( boost::hash_value ( m_aID ) ) { }
GaudiAlg::ID::m_hash
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:139
Gaudi::hash_value
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
Definition: StringKey.h:216
std::move
T move(T...args)
GaudiAlg::ID::m_aID
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:134

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

Implicit 'copy' constructor from a literal ID.

Definition at line 64 of file GaudiHistoID.h.

65 : m_aID ( id )
66 , m_hash ( boost::hash_value ( m_aID ) ) { }
GaudiAlg::ID::m_hash
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:139
Gaudi::hash_value
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
Definition: StringKey.h:216
GaudiAlg::ID::m_aID
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:134

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

Implicit constructor from a literal ID.

Definition at line 68 of file GaudiHistoID.h.

69 : m_aID ( id )
70 , m_hash ( boost::hash_value ( m_aID ) ) { }
GaudiAlg::ID::m_hash
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:139
Gaudi::hash_value
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
Definition: StringKey.h:216
GaudiAlg::ID::m_aID
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:134

GaudiAlg::ID::~ID | ( |  | ) |
| default

Destructor.

## Member Function Documentation

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

return hash value (for python)

Definition at line 127 of file GaudiHistoID.h.

127 { return hash () ; }
GaudiAlg::ID::hash
size_t hash() const noexcept
return hash value (for python)
Definition: GaudiHistoID.h:125

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

Definition at line 29 of file GaudiHistoID.cpp.

30 {
31 if ( numeric() ) { s << numericID() ; }
32 else if ( literal() ) { s << literalID() ; }
33 else { s << "UNDEFINED" ; }
34 return s ;
35 }
GaudiAlg::ID::numericID
NumericID numericID() const noexcept
Returns the numerical ID.
Definition: GaudiHistoID.h:82
GaudiAlg::ID::literal
bool literal() const noexcept
Is this ID numeric.
Definition: GaudiHistoID.h:76
GaudiAlg::ID::literalID
const LiteralID & literalID() const noexcept
Returns the ID as a LiteralID.
Definition: GaudiHistoID.h:80
gaudirun.s
string s
Definition: gaudirun.py:245
GaudiAlg::ID::numeric
bool numeric() const noexcept
Is this ID numeric.
Definition: GaudiHistoID.h:74

size_t GaudiAlg::ID::hash | ( |  | ) | const
| inline noexcept

return hash value (for python)

Definition at line 125 of file GaudiHistoID.h.

125 { return m_hash ; }
GaudiAlg::ID::m_hash
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:139

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

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

Definition at line 20 of file GaudiHistoID.cpp.

21 {
22 std::ostringstream s ;
23 fillStream ( s ) ;
24 return s.str() ;
25 }
GaudiAlg::ID::fillStream
GAUDI_API std::ostream & fillStream(std::ostream &s) const
Definition: GaudiHistoID.cpp:29
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)
gaudirun.s
string s
Definition: gaudirun.py:245

bool GaudiAlg::ID::literal | ( |  | ) | const
| inline noexcept

Is this ID numeric.

Definition at line 76 of file GaudiHistoID.h.

76 { return !m_aID.empty() ; }
std::string::empty
T empty(T...args)
GaudiAlg::ID::m_aID
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:134

const LiteralID& GaudiAlg::ID::literalID | ( |  | ) | const
| inline noexcept

Returns the ID as a LiteralID.

Definition at line 80 of file GaudiHistoID.h.

80 { return m_aID; }
GaudiAlg::ID::m_aID
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:134

bool GaudiAlg::ID::numeric | ( |  | ) | const
| inline noexcept

Is this ID numeric.

Definition at line 74 of file GaudiHistoID.h.

74 { return -1 != m_nID ; }
GaudiAlg::ID::m_nID
NumericID m_nID
Internal numeric ID.
Definition: GaudiHistoID.h:132

NumericID GaudiAlg::ID::numericID | ( |  | ) | const
| inline noexcept

Returns the numerical ID.

Definition at line 82 of file GaudiHistoID.h.

82 { return m_nID; }
GaudiAlg::ID::m_nID
NumericID m_nID
Internal numeric ID.
Definition: GaudiHistoID.h:132

GaudiAlg::ID::operator std::string | ( |  | ) | const
| inline

cast operator to std::string

Definition at line 86 of file GaudiHistoID.h.

86 { return idAsString () ; }
GaudiAlg::ID::idAsString
GAUDI_API LiteralID idAsString() const
Return ID as string, for both numeric and literal IDs.
Definition: GaudiHistoID.cpp:20

bool GaudiAlg::ID::operator! | ( |  | ) | const
| inline noexcept

good ID?

Definition at line 120 of file GaudiHistoID.h.

120 { return undefined() ; }
GaudiAlg::ID::undefined
bool undefined() const noexcept
Is this ID undefined.
Definition: GaudiHistoID.h:78

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

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

Definition at line 100 of file GaudiHistoID.h.

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

bool GaudiAlg::ID::operator< | ( | const ID & | id | ) | const
| inline noexcept

Implement the operator < Implementation depends on type of ID.

Returns
  boolean indicating the order of the IDs

Definition at line 105 of file GaudiHistoID.h.

106 {
107 return
108 //hash () < id.hash () ? true :
109 //hash () > id.hash () ? false :
110 numeric () && id.numeric() ? numericID() < id.numericID() :
111 literal () && id.literal() ? literalID() < id.literalID() :
112 idAsString () < id.idAsString() ;
113 }
GaudiAlg::ID::numericID
NumericID numericID() const noexcept
Returns the numerical ID.
Definition: GaudiHistoID.h:82
GaudiAlg::ID::literal
bool literal() const noexcept
Is this ID numeric.
Definition: GaudiHistoID.h:76
GaudiAlg::ID::literalID
const LiteralID & literalID() const noexcept
Returns the ID as a LiteralID.
Definition: GaudiHistoID.h:80
GaudiAlg::ID::idAsString
GAUDI_API LiteralID idAsString() const
Return ID as string, for both numeric and literal IDs.
Definition: GaudiHistoID.cpp:20
GaudiAlg::ID::numeric
bool numeric() const noexcept
Is this ID numeric.
Definition: GaudiHistoID.h:74

bool GaudiAlg::ID::operator== | ( | const ID & | id | ) | const
| inline noexcept

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

Returns
  boolean indicating if the IDs are equal

Definition at line 91 of file GaudiHistoID.h.

92 {
93 return
94 hash () != id.hash () ? false :
95 numeric () && id.numeric () ? id.numericID () == numericID () :
96 literal () && id.literal () ? id.literalID () == literalID () :
97 idAsString () == id.idAsString() ;
98 }
GaudiAlg::ID::numericID
NumericID numericID() const noexcept
Returns the numerical ID.
Definition: GaudiHistoID.h:82
GaudiAlg::ID::literal
bool literal() const noexcept
Is this ID numeric.
Definition: GaudiHistoID.h:76
GaudiAlg::ID::literalID
const LiteralID & literalID() const noexcept
Returns the ID as a LiteralID.
Definition: GaudiHistoID.h:80
GaudiAlg::ID::idAsString
GAUDI_API LiteralID idAsString() const
Return ID as string, for both numeric and literal IDs.
Definition: GaudiHistoID.cpp:20
GaudiAlg::ID::numeric
bool numeric() const noexcept
Is this ID numeric.
Definition: GaudiHistoID.h:74
GaudiAlg::ID::hash
size_t hash() const noexcept
return hash value (for python)
Definition: GaudiHistoID.h:125

bool GaudiAlg::ID::undefined | ( |  | ) | const
| inline noexcept

Is this ID undefined.

Definition at line 78 of file GaudiHistoID.h.

78 { return !numeric() && !literal(); }
GaudiAlg::ID::literal
bool literal() const noexcept
Is this ID numeric.
Definition: GaudiHistoID.h:76
GaudiAlg::ID::numeric
bool numeric() const noexcept
Is this ID numeric.
Definition: GaudiHistoID.h:74

## Member Data Documentation

LiteralID GaudiAlg::ID::m_aID
| private

Internal alpha-numeric ID.

Definition at line 134 of file GaudiHistoID.h.

size_t GaudiAlg::ID::m_hash {0}
| private

the hash value of ID

Definition at line 139 of file GaudiHistoID.h.

NumericID GaudiAlg::ID::m_nID {-1}
| private

Internal numeric ID.

Definition at line 132 of file GaudiHistoID.h.

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

- GaudiAlg/GaudiAlg/GaudiHistoID.h
- GaudiAlg/src/lib/GaudiHistoID.cpp