|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
00001 // $Id:$ 00002 // ============================================================================ 00003 /* @file gaudiHistoID.cpp 00004 * 00005 * Implementation file for class GaudiAlg::ID 00006 * 00007 * $Id: GaudiHistoID.cpp,v 1.1 2006/03/09 14:50:22 hmd Exp $ 00008 * 00009 * @author Chris Jones Christopher.Rob.Jones@cern.ch 00010 * @date 03/02/2006 00011 */ 00012 // ============================================================================ 00013 // Include Files 00014 // ============================================================================ 00015 // STD & STL 00016 // ============================================================================ 00017 #include <sstream> 00018 // ============================================================================ 00019 // local 00020 // ============================================================================ 00021 #include "GaudiAlg/GaudiHistoID.h" 00022 // ============================================================================ 00023 // Boost 00024 // ============================================================================ 00025 #include "boost/functional/hash.hpp" 00026 // ============================================================================ 00027 // Implicit constructor from a numeric ID 00028 // ============================================================================ 00029 GaudiAlg::ID::ID ( const GaudiAlg::ID::NumericID id ) 00030 : m_nID ( id ) 00031 , m_aID ( "" ) 00032 , m_hash ( boost::hash_value ( id ) ) 00033 {} 00034 // ============================================================================ 00035 // Implicit constructor from a literal ID 00036 // ============================================================================ 00037 GaudiAlg::ID::ID ( const GaudiAlg::ID::LiteralID& id ) 00038 : m_nID ( -1 ) 00039 , m_aID ( id ) 00040 , m_hash ( boost::hash_value ( id ) ) 00041 {} 00042 // ============================================================================ 00043 // Implicit constructor from a literal ID 00044 // ============================================================================ 00045 GaudiAlg::ID::ID ( const char* id ) 00046 : m_nID ( -1 ) 00047 , m_aID ( id ) 00048 , m_hash ( 0 ) 00049 { m_hash = boost::hash_value ( m_aID ) ; } 00050 // ============================================================================ 00051 GaudiAlg::ID::LiteralID GaudiAlg::ID::idAsString() const 00052 { 00053 std::ostringstream s ; 00054 fillStream ( s ) ; 00055 return s.str() ; 00056 } 00057 // ============================================================================ 00058 // Operator overloading for ostream 00059 // ============================================================================ 00060 std::ostream& GaudiAlg::ID::fillStream( std::ostream& s ) const 00061 { 00062 if ( numeric() ) { s << numericID() ; } 00063 else if ( literal() ) { s << literalID() ; } 00064 else { s << "UNDEFINED" ; } 00065 return s ; 00066 } 00067 // ============================================================================ 00068 // The END 00069 // ============================================================================