The Gaudi Framework  v30r3 (a5ef0a68)
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 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 81 of file DataObjID.h.

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

Definition at line 83 of file DataObjID.h.

83  : m_clid( clid ), m_key( key )
84 {
85  setClassName();
86  hashGen();
87 }
std::string m_key
Definition: DataObjID.h:74
CLID clid() const
Definition: DataObjID.h:54
CLID m_clid
Definition: DataObjID.h:71
void setClassName()
Definition: DataObjID.cpp:73
void hashGen()
Definition: DataObjID.cpp:82
DataObjID::DataObjID ( const std::string className,
const std::string key 
)
inline

Definition at line 89 of file DataObjID.h.

90  : m_key( key ), m_className( className )
91 {
92  setClid();
93  hashGen();
94 }
std::string m_key
Definition: DataObjID.h:74
void setClid()
Definition: DataObjID.cpp:63
std::string m_className
Definition: DataObjID.h:75
void hashGen()
Definition: DataObjID.cpp:82

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:71
std::string DataObjID::fullKey ( ) const

Definition at line 99 of file DataObjID.cpp.

100 {
101  return ( m_clid == 0 && m_className.empty() ) ? m_key : ( m_className + '/' + m_key );
102 }
T empty(T...args)
std::string m_key
Definition: DataObjID.h:74
CLID m_clid
Definition: DataObjID.h:71
std::string m_className
Definition: DataObjID.h:75
void DataObjID::hashGen ( )
private

Definition at line 82 of file DataObjID.cpp.

83 {
85  if ( m_clid != 0 ) {
86  // this is a bit redundant since hash<int> is a pass-through
87  m_hash ^= ( std::hash<CLID>()( m_clid ) << 1 );
88  }
89 }
std::string m_key
Definition: DataObjID.h:74
CLID m_clid
Definition: DataObjID.h:71
std::size_t m_hash
Definition: DataObjID.h:72
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:74
void DataObjID::setClassName ( )
private

Definition at line 73 of file DataObjID.cpp.

74 {
75  std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
76 
78  m_className = "UNKNOW_CLID:" + std::to_string( m_clid );
79  }
80 }
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:77
T call_once(T...args)
bool isFailure() const
Definition: StatusCode.h:139
static std::once_flag m_ip
Definition: DataObjID.h:78
CLID m_clid
Definition: DataObjID.h:71
T ref(T...args)
std::string m_className
Definition: DataObjID.h:75
void DataObjID::setClid ( )
private

Definition at line 63 of file DataObjID.cpp.

64 {
65  std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
66 
68  m_clid = 0;
69  m_className = "UNKNOWN_CLASS:" + m_className;
70  }
71 }
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:77
T call_once(T...args)
bool isFailure() const
Definition: StatusCode.h:139
static std::once_flag m_ip
Definition: DataObjID.h:78
CLID m_clid
Definition: DataObjID.h:71
T ref(T...args)
std::string m_className
Definition: DataObjID.h:75
void DataObjID::updateKey ( const std::string key)
inline

Definition at line 96 of file DataObjID.h.

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

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:72
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:92
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:72
StatusCode parse ( DataObjID dest,
const std::string src 
)
friend

Definition at line 52 of file DataObjID.cpp.

52 { return Gaudi::Parsers::parse_( dest, quote( src ) ); }
StatusCode parse_(ResultT &result, const std::string &input)
std::ostream& toStream ( const DataObjID v,
std::ostream o 
)
friend

Definition at line 92 of file DataObjID.cpp.

93 {
95  return ( d.m_clid != 0 || !d.m_className.empty() ) ? toStream( std::tie( d.m_className, d.m_key ), os )
96  : toStream( d.m_key, os );
97 }
friend std::ostream & toStream(const DataObjID &v, std::ostream &o)
Definition: DataObjID.cpp:92
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 75 of file DataObjID.h.

CLID DataObjID::m_clid {0}
private

Definition at line 71 of file DataObjID.h.

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

Definition at line 72 of file DataObjID.h.

std::once_flag DataObjID::m_ip
staticprivate

Definition at line 78 of file DataObjID.h.

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

Definition at line 74 of file DataObjID.h.

IClassIDSvc * DataObjID::p_clidSvc
staticprivate

Definition at line 77 of file DataObjID.h.


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