Gaudi Framework, version v23r7

Home   Generated: Wed Mar 20 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiHistoID.h
Go to the documentation of this file.
1 // $Id:
2 // ============================================================================
3 #ifndef GAUDIALG_GAUDIHISTOID_H
4 #define GAUDIALG_GAUDIHISTOID_H 1
5 // ============================================================================
6 // Include files
7 // ============================================================================
8 // STD&STL
9 // ============================================================================
10 #include <string>
11 // ============================================================================
12 // GaudiKernel
13 // ============================================================================
14 #include "GaudiKernel/Kernel.h"
15 #include "GaudiKernel/Hash.h"
16 // ============================================================================
17 /* @file
18  *
19  * Header file for class GaudiAlg::ID
20  *
21  * @author Chris Jones Christopher.Rob.Jones@cern.ch
22  * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
23  * @date 2004-01-23
24  */
25 // ============================================================================
34 // ============================================================================
35 namespace GaudiAlg
36 {
37  // ==========================================================================
46  class GAUDI_API ID
47  {
48  public:
49  // ========================================================================
51  typedef int NumericID;
54  // ========================================================================
55  public:
56  // ========================================================================
58  ID ( const NumericID id = -1 ) ;
60  ID ( const LiteralID& id ) ;
62  ID ( const char* id ) ;
64  ~ID ( ) {} ;
66  inline bool numeric () const { return -1 != m_nID ; }
68  inline bool literal () const { return !m_aID.empty() ; }
70  inline bool undefined () const { return !numeric() && !literal(); }
72  inline const LiteralID& literalID() const { return m_aID; }
74  inline NumericID numericID() const { return m_nID; }
76  GAUDI_API LiteralID idAsString() const ;
78  operator std::string () const { return idAsString () ; }
83  inline bool operator==( const ID& id ) const
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  }
92  inline bool operator!=( const ID& id ) const { return ! ( *this == id ) ; }
97  inline bool operator<( const ID& id ) const
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  }
106  // ========================================================================
107  GAUDI_API std::ostream& fillStream ( std::ostream& s ) const ;
108  // ========================================================================
109  public:
110  // ========================================================================
112  bool operator!() const { return undefined() ; }
113  // ========================================================================
114  public:
115  // ========================================================================
117  inline size_t hash () const { return m_hash ; }
119  inline size_t __hash__ () const { return hash () ; }
120  // ========================================================================
121  private:
122  // ========================================================================
124  NumericID m_nID ; // Internal numeric ID
126  LiteralID m_aID ; // Internal alpha-numeric ID
127  // ========================================================================
128  private:
129  // ========================================================================
131  size_t m_hash ; // the hash value of ID
132  // ========================================================================
133  };
134  // ==========================================================================
137  { return id.fillStream ( str ) ; }
138  // ==========================================================================
139 } // end of namespace GaudiAlg
140 // ============================================================================
141 namespace GaudiUtils
142 {
143  // ==========================================================================
145  template <>
146  inline size_t Hash<GaudiAlg::ID>::operator()
147  ( const GaudiAlg::ID& key ) const { return key.hash () ; }
148  // ==========================================================================
149 } // end of namespace GaudiUtils
150 // ============================================================================
151 // The END
152 // ============================================================================
153 #endif // GAUDIALG_GAUDIHISTOID_H
154 // ============================================================================

Generated at Wed Mar 20 2013 17:59:36 for Gaudi Framework, version v23r7 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004