The Gaudi Framework  v33r0 (d5ea422b)
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 47 of file DataObjID.h.

Constructor & Destructor Documentation

◆ DataObjID() [1/5]

DataObjID::DataObjID ( )
default

◆ DataObjID() [2/5]

DataObjID::DataObjID ( const DataObjID )
default

◆ DataObjID() [3/5]

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

Definition at line 90 of file DataObjID.h.

90 : m_key( key ) { hashGen(); }
std::string m_key
Definition: DataObjID.h:83
const std::string & key() const
Definition: DataObjID.h:58
void hashGen()
Definition: DataObjID.cpp:83

◆ DataObjID() [4/5]

DataObjID::DataObjID ( const CLID clid,
const std::string key 
)
inline

Definition at line 92 of file DataObjID.h.

92  : m_clid( clid ), m_key( key ) {
93  setClassName();
94  hashGen();
95 }
std::string m_key
Definition: DataObjID.h:83
CLID clid() const
Definition: DataObjID.h:63
CLID m_clid
Definition: DataObjID.h:80
const std::string & key() const
Definition: DataObjID.h:58
void setClassName()
Definition: DataObjID.cpp:75
void hashGen()
Definition: DataObjID.cpp:83

◆ DataObjID() [5/5]

DataObjID::DataObjID ( const std::string className,
const std::string key 
)
inline

Definition at line 97 of file DataObjID.h.

98  : m_key( key ), m_className( className ) {
99  setClid();
100  hashGen();
101 }
std::string m_key
Definition: DataObjID.h:83
const std::string & key() const
Definition: DataObjID.h:58
void setClid()
Definition: DataObjID.cpp:66
std::string m_className
Definition: DataObjID.h:84
void hashGen()
Definition: DataObjID.cpp:83

Member Function Documentation

◆ clid()

CLID DataObjID::clid ( ) const
inline

Definition at line 63 of file DataObjID.h.

63 { return m_clid; }
CLID m_clid
Definition: DataObjID.h:80

◆ fullKey()

std::string DataObjID::fullKey ( ) const

Definition at line 98 of file DataObjID.cpp.

98  {
99  return ( m_clid == 0 && m_className.empty() ) ? m_key : ( m_className + '/' + m_key );
100 }
T empty(T... args)
std::string m_key
Definition: DataObjID.h:83
CLID m_clid
Definition: DataObjID.h:80
std::string m_className
Definition: DataObjID.h:84

◆ hashGen()

void DataObjID::hashGen ( )
private

Definition at line 83 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:83
CLID m_clid
Definition: DataObjID.h:80
std::size_t m_hash
Definition: DataObjID.h:81

◆ key()

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

Definition at line 58 of file DataObjID.h.

58 { return m_key; }
std::string m_key
Definition: DataObjID.h:83

◆ setClassName()

void DataObjID::setClassName ( )
private

Definition at line 75 of file DataObjID.cpp.

75  {
76  std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
77 
79  m_className = "UNKNOW_CLID:" + std::to_string( m_clid );
80  }
81 }
T to_string(T... args)
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:86
T call_once(T... args)
static std::once_flag m_ip
Definition: DataObjID.h:87
virtual StatusCode getTypeNameOfID(const CLID &id, std::string &typeName) const =0
get user assigned type name associated with clID
CLID m_clid
Definition: DataObjID.h:80
T ref(T... args)
bool isFailure() const
Definition: StatusCode.h:141
std::string m_className
Definition: DataObjID.h:84

◆ setClid()

void DataObjID::setClid ( )
private

Definition at line 66 of file DataObjID.cpp.

66  {
67  std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
68 
70  m_clid = 0;
71  m_className = "UNKNOWN_CLASS:" + m_className;
72  }
73 }
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:86
T call_once(T... args)
virtual StatusCode getIDOfTypeName(const std::string &typeName, CLID &id) const =0
get id associated with type name (if any)
static std::once_flag m_ip
Definition: DataObjID.h:87
CLID m_clid
Definition: DataObjID.h:80
T ref(T... args)
bool isFailure() const
Definition: StatusCode.h:141
std::string m_className
Definition: DataObjID.h:84

◆ updateKey()

void DataObjID::updateKey ( const std::string key)
inline

Definition at line 103 of file DataObjID.h.

103  {
104  m_key = key;
105  hashGen();
106 }
std::string m_key
Definition: DataObjID.h:83
const std::string & key() const
Definition: DataObjID.h:58
void hashGen()
Definition: DataObjID.cpp:83

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 69 of file DataObjID.h.

69 { return !( lhs == rhs ); }

◆ operator<

bool operator< ( const DataObjID lhs,
const DataObjID rhs 
)
friend

Definition at line 67 of file DataObjID.h.

67 { return lhs.m_hash < rhs.m_hash; }
std::size_t m_hash
Definition: DataObjID.h:81

◆ operator<<

std::ostream& operator<< ( std::ostream os,
const DataObjID d 
)
friend

Definition at line 73 of file DataObjID.h.

73 { return toStream( d, os ); }
friend std::ostream & toStream(const DataObjID &v, std::ostream &o)
Definition: DataObjID.cpp:92

◆ operator==

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

Definition at line 68 of file DataObjID.h.

68 { return lhs.m_hash == rhs.m_hash; }
std::size_t m_hash
Definition: DataObjID.h:81

◆ parse

StatusCode parse ( DataObjID dest,
const std::string src 
)
friend

Definition at line 56 of file DataObjID.cpp.

56 { return Gaudi::Parsers::parse_( dest, quote( src ) ); }
StatusCode parse_(ResultT &result, const std::string &input)
Definition: Factory.h:39

◆ toStream

std::ostream& toStream ( const DataObjID v,
std::ostream o 
)
friend

Definition at line 92 of file DataObjID.cpp.

92  {
94  return ( d.m_clid != 0 || !d.m_className.empty() ) ? toStream( std::tie( d.m_className, d.m_key ), os )
95  : toStream( d.m_key, os );
96 }
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:291
T tie(T... args)

Member Data Documentation

◆ DataObjID_Hasher

friend DataObjID::DataObjID_Hasher

Definition at line 49 of file DataObjID.h.

◆ m_className

std::string DataObjID::m_className
private

Definition at line 84 of file DataObjID.h.

◆ m_clid

CLID DataObjID::m_clid {0}
private

Definition at line 80 of file DataObjID.h.

◆ m_hash

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

Definition at line 81 of file DataObjID.h.

◆ m_ip

std::once_flag DataObjID::m_ip
staticprivate

Definition at line 87 of file DataObjID.h.

◆ m_key

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

Definition at line 83 of file DataObjID.h.

◆ p_clidSvc

IClassIDSvc * DataObjID::p_clidSvc
staticprivate

Definition at line 86 of file DataObjID.h.


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