The Gaudi Framework  v30r1 (5d4f4ae2)
DataObjID Class Reference

#include <GaudiKernel/DataObjID.h>

Collaboration diagram for DataObjID:

Public Member Functions

 DataObjID ()=default
 
 DataObjID (const DataObjID &)=default
 
 DataObjID (const std::string &key)
 
 DataObjID (const CLID &clid, const std::string &key)
 
 DataObjID (const std::string &className, const std::string &key)
 
const std::stringkey () const
 
std::string fullKey () const
 
CLID clid () const
 
void updateKey (const std::string &key)
 

Public Attributes

friend DataObjID_Hasher
 

Private Member Functions

void hashGen ()
 
void parse (const std::string &key)
 
void setClid ()
 
void setClassName ()
 

Private Attributes

CLID m_clid {0}
 
std::size_t m_hash {0}
 
std::string m_key {"INVALID"}
 
std::string m_className
 

Static Private Attributes

static IClassIDSvcp_clidSvc
 
static std::once_flag m_ip
 

Friends

bool operator< (const DataObjID &lhs, const DataObjID &rhs)
 
bool operator== (const DataObjID &lhs, const DataObjID &rhs)
 
bool operator!= (const DataObjID &lhs, const DataObjID &rhs)
 
StatusCode parse (DataObjID &dest, const std::string &src)
 
std::ostreamtoStream (const DataObjID &v, std::ostream &o)
 
std::ostreamoperator<< (std::ostream &os, const DataObjID &d)
 

Detailed Description

Definition at line 37 of file DataObjID.h.

Constructor & Destructor Documentation

DataObjID::DataObjID ( )
default
DataObjID::DataObjID ( const DataObjID )
default
DataObjID::DataObjID ( const std::string key)
inline

Definition at line 82 of file DataObjID.h.

82 : m_key( key ) { hashGen(); }
std::string m_key
Definition: DataObjID.h:75
void hashGen()
Definition: DataObjID.cpp:67
DataObjID::DataObjID ( const CLID clid,
const std::string key 
)
inline

Definition at line 84 of file DataObjID.h.

84  : m_clid( clid ), m_key( key )
85 {
86  setClassName();
87  hashGen();
88 }
std::string m_key
Definition: DataObjID.h:75
CLID clid() const
Definition: DataObjID.h:54
CLID m_clid
Definition: DataObjID.h:72
void setClassName()
Definition: DataObjID.cpp:58
void hashGen()
Definition: DataObjID.cpp:67
DataObjID::DataObjID ( const std::string className,
const std::string key 
)
inline

Definition at line 90 of file DataObjID.h.

91  : m_key( key ), m_className( className )
92 {
93  setClid();
94  hashGen();
95 }
std::string m_key
Definition: DataObjID.h:75
void setClid()
Definition: DataObjID.cpp:48
std::string m_className
Definition: DataObjID.h:76
void hashGen()
Definition: DataObjID.cpp:67

Member Function Documentation

CLID DataObjID::clid ( ) const
inline

Definition at line 54 of file DataObjID.h.

54 { return m_clid; }
CLID m_clid
Definition: DataObjID.h:72
std::string DataObjID::fullKey ( ) const

Definition at line 84 of file DataObjID.cpp.

85 {
86  return ( m_clid == 0 && m_className.empty() ) ? m_key : ( m_className + '/' + m_key );
87 }
T empty(T...args)
std::string m_key
Definition: DataObjID.h:75
CLID m_clid
Definition: DataObjID.h:72
std::string m_className
Definition: DataObjID.h:76
void DataObjID::hashGen ( )
private

Definition at line 67 of file DataObjID.cpp.

68 {
70  if ( m_clid != 0 ) {
71  // this is a bit redundant since hash<int> is a pass-through
72  m_hash ^= ( std::hash<CLID>()( m_clid ) << 1 );
73  }
74 }
std::string m_key
Definition: DataObjID.h:75
CLID m_clid
Definition: DataObjID.h:72
std::size_t m_hash
Definition: DataObjID.h:73
const std::string& DataObjID::key ( ) const
inline

Definition at line 49 of file DataObjID.h.

49 { return m_key; }
std::string m_key
Definition: DataObjID.h:75
void DataObjID::parse ( const std::string key)
private
void DataObjID::setClassName ( )
private

Definition at line 58 of file DataObjID.cpp.

59 {
60  std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
61 
63  m_className = "UNKNOW_CLID:" + std::to_string( m_clid );
64  }
65 }
virtual StatusCode getTypeNameOfID(const CLID &id, std::string &typeName) const =0
get user assigned type name associated with clID
T to_string(T...args)
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:78
T call_once(T...args)
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
static std::once_flag m_ip
Definition: DataObjID.h:79
CLID m_clid
Definition: DataObjID.h:72
T ref(T...args)
std::string m_className
Definition: DataObjID.h:76
void DataObjID::setClid ( )
private

Definition at line 48 of file DataObjID.cpp.

49 {
50  std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
51 
53  m_clid = 0;
54  m_className = "UNKNOWN_CLASS:" + m_className;
55  }
56 }
virtual StatusCode getIDOfTypeName(const std::string &typeName, CLID &id) const =0
get id associated with type name (if any)
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:78
T call_once(T...args)
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
static std::once_flag m_ip
Definition: DataObjID.h:79
CLID m_clid
Definition: DataObjID.h:72
T ref(T...args)
std::string m_className
Definition: DataObjID.h:76
void DataObjID::updateKey ( const std::string key)
inline

Definition at line 97 of file DataObjID.h.

98 {
99  m_key = key;
100  hashGen();
101 }
std::string m_key
Definition: DataObjID.h:75
const std::string & key() const
Definition: DataObjID.h:49
void hashGen()
Definition: DataObjID.cpp:67

Friends And Related Function Documentation

bool operator!= ( const DataObjID lhs,
const DataObjID rhs 
)
friend

Definition at line 60 of file DataObjID.h.

60 { return !( lhs == rhs ); }
bool operator< ( const DataObjID lhs,
const DataObjID rhs 
)
friend

Definition at line 58 of file DataObjID.h.

58 { return lhs.m_hash < rhs.m_hash; }
std::size_t m_hash
Definition: DataObjID.h:73
std::ostream& operator<< ( std::ostream os,
const DataObjID d 
)
friend

Definition at line 64 of file DataObjID.h.

64 { return toStream( d, os ); }
friend std::ostream & toStream(const DataObjID &v, std::ostream &o)
Definition: DataObjID.cpp:77
bool operator== ( const DataObjID lhs,
const DataObjID rhs 
)
friend

Definition at line 59 of file DataObjID.h.

59 { return lhs.m_hash == rhs.m_hash; }
std::size_t m_hash
Definition: DataObjID.h:73
StatusCode parse ( DataObjID dest,
const std::string src 
)
friend
std::ostream& toStream ( const DataObjID v,
std::ostream o 
)
friend

Definition at line 77 of file DataObjID.cpp.

78 {
80  return ( d.m_clid != 0 || !d.m_className.empty() ) ? toStream( std::tie( d.m_className, d.m_key ), os )
81  : toStream( d.m_key, os );
82 }
friend std::ostream & toStream(const DataObjID &v, std::ostream &o)
Definition: DataObjID.cpp:77
std::ostream & toStream(ITERATOR first, ITERATOR last, std::ostream &s, const std::string &open, const std::string &close, const std::string &delim)
the helper function to print the sequence
Definition: ToStream.h:303
T tie(T...args)

Member Data Documentation

friend DataObjID::DataObjID_Hasher

Definition at line 40 of file DataObjID.h.

std::string DataObjID::m_className
private

Definition at line 76 of file DataObjID.h.

CLID DataObjID::m_clid {0}
private

Definition at line 72 of file DataObjID.h.

std::size_t DataObjID::m_hash {0}
private

Definition at line 73 of file DataObjID.h.

std::once_flag DataObjID::m_ip
staticprivate

Definition at line 79 of file DataObjID.h.

std::string DataObjID::m_key {"INVALID"}
private

Definition at line 75 of file DataObjID.h.

IClassIDSvc * DataObjID::p_clidSvc
staticprivate

Definition at line 78 of file DataObjID.h.


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