The Gaudi Framework  v33r1 (b1225454)
DataObjID Class Reference

#include <GaudiKernel/DataObjID.h>

Collaboration diagram for DataObjID:

Public Member Functions

 DataObjID ()=default
 
 DataObjID (const DataObjID &)=default
 
 DataObjID (std::string key)
 
 DataObjID (const CLID &clid, std::string key)
 
 DataObjID (std::string className, std::string key)
 
const std::stringkey () const
 
std::string fullKey () const
 
CLID clid () const
 
void updateKey (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 ( std::string  key)
inline

Definition at line 90 of file DataObjID.h.

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

◆ DataObjID() [4/5]

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

Definition at line 92 of file DataObjID.h.

92  : m_clid( clid ), m_key( std::move( 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
T move(T... args)
const std::string & key() const
Definition: DataObjID.h:58
void setClassName()
Definition: DataObjID.cpp:76
void hashGen()
Definition: DataObjID.cpp:84

◆ DataObjID() [5/5]

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

Definition at line 97 of file DataObjID.h.

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

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 99 of file DataObjID.cpp.

99  {
100  return ( m_clid == 0 && m_className.empty() ) ? m_key : ( m_className + '/' + m_key );
101 }
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 84 of file DataObjID.cpp.

84  {
86  if ( m_clid != 0 ) {
87  // this is a bit redundant since hash<int> is a pass-through
88  m_hash ^= ( std::hash<CLID>()( m_clid ) << 1 );
89  }
90 }
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 76 of file DataObjID.cpp.

76  {
77  std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
78 
80  m_className = "UNKNOW_CLID:" + std::to_string( m_clid );
81  }
82 }
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:145
std::string m_className
Definition: DataObjID.h:84

◆ setClid()

void DataObjID::setClid ( )
private

Definition at line 67 of file DataObjID.cpp.

67  {
68  std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
69 
71  m_clid = 0;
72  m_className = "UNKNOWN_CLASS:" + m_className;
73  }
74 }
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:145
std::string m_className
Definition: DataObjID.h:84

◆ updateKey()

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

Definition at line 103 of file DataObjID.h.

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

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:93

◆ 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 57 of file DataObjID.cpp.

57 { 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 93 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:93
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: