GaudiHistoID.cpp
Go to the documentation of this file.
1 // ============================================================================
2 /* @file gaudiHistoID.cpp
3  *
4  * Implementation file for class GaudiAlg::ID
5  *
6  * @author Chris Jones Christopher.Rob.Jones@cern.ch
7  * @date 03/02/2006
8  */
9 // ============================================================================
10 // Include Files
11 // ============================================================================
12 // STD & STL
13 // ============================================================================
14 #include <sstream>
15 // ============================================================================
16 // local
17 // ============================================================================
18 #include "GaudiAlg/GaudiHistoID.h"
19 // ============================================================================
20 // Boost
21 // ============================================================================
22 #include "boost/functional/hash.hpp"
23 // ============================================================================
24 // Implicit constructor from a numeric ID
25 // ============================================================================
27  : m_nID ( id )
28  , m_hash ( boost::hash_value ( id ) )
29 {}
30 // ============================================================================
31 // Implicit constructor from a literal ID
32 // ============================================================================
34  : m_nID ( -1 )
35  , m_aID ( id )
36  , m_hash ( boost::hash_value ( m_aID ) )
37 {}
38 // ============================================================================
39 // Implicit constructor from a literal ID
40 // ============================================================================
41 GaudiAlg::ID::ID ( const char* id )
42  : m_nID ( -1 )
43  , m_aID ( id )
44  , m_hash ( boost::hash_value ( m_aID ) )
45 {}
46 // ============================================================================
48 {
50  fillStream ( s ) ;
51  return s.str() ;
52 }
53 // ============================================================================
54 // Operator overloading for ostream
55 // ============================================================================
57 {
58  if ( numeric() ) { s << numericID() ; }
59  else if ( literal() ) { s << literalID() ; }
60  else { s << "UNDEFINED" ; }
61  return s ;
62 }
63 // ============================================================================
64 // The END
65 // ============================================================================
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:129
The namespace threadpool contains a thread pool and related utility classes.
Definition: iter_pos.hpp:13
GAUDI_API std::ostream & fillStream(std::ostream &s) const
int NumericID
type for internal numeric ID
Definition: GaudiHistoID.h:49
NumericID m_nID
Internal numeric ID.
Definition: GaudiHistoID.h:122
STL class.
NumericID numericID() const
Returns the numerical ID.
Definition: GaudiHistoID.h:72
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
Definition: StringKey.h:216
ID(const NumericID id=-1)
Implicit constructor from a numeric ID.
const LiteralID & literalID() const
Returns the ID as a LiteralID.
Definition: GaudiHistoID.h:70
GAUDI_API LiteralID idAsString() const
Return ID as string, for both numeric and literal IDs.
string s
Definition: gaudirun.py:245
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:124
bool literal() const
Is this ID numeric.
Definition: GaudiHistoID.h:66
STL class.
bool numeric() const
Is this ID numeric.
Definition: GaudiHistoID.h:64