All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiHistoID.cpp
Go to the documentation of this file.
1 // $Id:$
2 // ============================================================================
3 /* @file gaudiHistoID.cpp
4  *
5  * Implementation file for class GaudiAlg::ID
6  *
7  * $Id: GaudiHistoID.cpp,v 1.1 2006/03/09 14:50:22 hmd Exp $
8  *
9  * @author Chris Jones Christopher.Rob.Jones@cern.ch
10  * @date 03/02/2006
11  */
12 // ============================================================================
13 // Include Files
14 // ============================================================================
15 // STD & STL
16 // ============================================================================
17 #include <sstream>
18 // ============================================================================
19 // local
20 // ============================================================================
21 #include "GaudiAlg/GaudiHistoID.h"
22 // ============================================================================
23 // Boost
24 // ============================================================================
25 #include "boost/functional/hash.hpp"
26 // ============================================================================
27 // Implicit constructor from a numeric ID
28 // ============================================================================
30  : m_nID ( id )
31  , m_aID ( "" )
32  , m_hash ( boost::hash_value ( id ) )
33 {}
34 // ============================================================================
35 // Implicit constructor from a literal ID
36 // ============================================================================
38  : m_nID ( -1 )
39  , m_aID ( id )
40  , m_hash ( boost::hash_value ( id ) )
41 {}
42 // ============================================================================
43 // Implicit constructor from a literal ID
44 // ============================================================================
45 GaudiAlg::ID::ID ( const char* id )
46  : m_nID ( -1 )
47  , m_aID ( id )
48  , m_hash ( 0 )
49 { m_hash = boost::hash_value ( m_aID ) ; }
50 // ============================================================================
52 {
53  std::ostringstream s ;
54  fillStream ( s ) ;
55  return s.str() ;
56 }
57 // ============================================================================
58 // Operator overloading for ostream
59 // ============================================================================
60 std::ostream& GaudiAlg::ID::fillStream( std::ostream& s ) const
61 {
62  if ( numeric() ) { s << numericID() ; }
63  else if ( literal() ) { s << literalID() ; }
64  else { s << "UNDEFINED" ; }
65  return s ;
66 }
67 // ============================================================================
68 // The END
69 // ============================================================================
size_t m_hash
the hash value of ID
Definition: GaudiHistoID.h:131
GAUDI_API std::ostream & fillStream(std::ostream &s) const
int NumericID
type for internal numeric ID
Definition: GaudiHistoID.h:51
std::size_t hash_value(const Gaudi::StringKey &key)
hash-function: heeded for boost::hash
Definition: StringKey.h:214
ID(const NumericID id=-1)
Implicit constructor from a numeric ID.
std::string LiteralID
type for internal literal ID
Definition: GaudiHistoID.h:53
GAUDI_API LiteralID idAsString() const
Return ID as string, for both numeric and literal IDs.
string s
Definition: gaudirun.py:210
LiteralID m_aID
Internal alpha-numeric ID.
Definition: GaudiHistoID.h:126