The Gaudi Framework  master (37c0b60a)
DataObjID Class Reference

#include </builds/gaudi/Gaudi/GaudiKernel/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)
 
DataObjIDoperator= (const DataObjID &)=default
 
const std::stringkey () const
 only return the last part of the key More...
 
const std::stringclassName () const
 return the ClassName (if available) More...
 
std::string fullKey () const
 combination of the key and the ClassName, mostly for debugging More...
 
CLID clid () const
 
std::size_t hash () 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, std::string_view 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 96 of file DataObjID.h.

96 : m_key( std::move( key ) ) { hashGen(); }

◆ DataObjID() [4/5]

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

Definition at line 98 of file DataObjID.h.

98  : m_clid( clid ), m_key( std::move( key ) ) {
99  setClassName();
100  hashGen();
101 }

◆ DataObjID() [5/5]

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

Definition at line 103 of file DataObjID.h.

105  setClid();
106  hashGen();
107 }

Member Function Documentation

◆ className()

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

return the ClassName (if available)

Definition at line 63 of file DataObjID.h.

63 { return m_className; }

◆ clid()

CLID DataObjID::clid ( ) const
inline

Definition at line 68 of file DataObjID.h.

68 { return m_clid; }

◆ fullKey()

std::string DataObjID::fullKey ( ) const

combination of the key and the ClassName, mostly for debugging

Definition at line 99 of file DataObjID.cpp.

99  {
100  return ( m_clid == 0 && m_className.empty() ) ? m_key : ( m_className + '/' + m_key );
101 }

◆ hash()

std::size_t DataObjID::hash ( ) const
inline

Definition at line 69 of file DataObjID.h.

69 { return m_hash; }

◆ 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 }

◆ key()

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

only return the last part of the key

Definition at line 60 of file DataObjID.h.

60 { return m_key; }

◆ operator=()

DataObjID& DataObjID::operator= ( const DataObjID )
default

◆ 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 }

◆ 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 }

◆ updateKey()

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

Definition at line 109 of file DataObjID.h.

109  {
110  m_key = std::move( key );
111  hashGen();
112 }

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 75 of file DataObjID.h.

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

◆ operator<

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

Definition at line 73 of file DataObjID.h.

73 { return lhs.m_hash < rhs.m_hash; }

◆ operator<<

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

Definition at line 79 of file DataObjID.h.

79 { return toStream( d, os ); }

◆ operator==

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

Definition at line 74 of file DataObjID.h.

74 { return lhs.m_hash == rhs.m_hash; }

◆ parse

StatusCode parse ( DataObjID dest,
std::string_view  src 
)
friend

Definition at line 57 of file DataObjID.cpp.

57 { return Gaudi::Parsers::parse_( dest, quote( src ) ); }

◆ 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 }

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 90 of file DataObjID.h.

◆ m_clid

CLID DataObjID::m_clid { 0 }
private

Definition at line 86 of file DataObjID.h.

◆ m_hash

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

Definition at line 87 of file DataObjID.h.

◆ m_ip

std::once_flag DataObjID::m_ip
staticprivate

Definition at line 93 of file DataObjID.h.

◆ m_key

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

Definition at line 89 of file DataObjID.h.

◆ p_clidSvc

IClassIDSvc * DataObjID::p_clidSvc
staticprivate

Definition at line 92 of file DataObjID.h.


The documentation for this class was generated from the following files:
std::call_once
T call_once(T... args)
IClassIDSvc::getIDOfTypeName
virtual StatusCode getIDOfTypeName(const std::string &typeName, CLID &id) const =0
get id associated with type name (if any)
DataObjID::m_ip
static std::once_flag m_ip
Definition: DataObjID.h:93
DataObjID::setClassName
void setClassName()
Definition: DataObjID.cpp:76
std::move
T move(T... args)
Gaudi::Parsers::parse_
StatusCode parse_(ResultT &result, std::string_view input)
Definition: Factory.h:39
DataObjID::clid
CLID clid() const
Definition: DataObjID.h:68
std::tie
T tie(T... args)
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:90
std::to_string
T to_string(T... args)
DataObjID::className
const std::string & className() const
return the ClassName (if available)
Definition: DataObjID.h:63
gaudirun.dest
dest
Definition: gaudirun.py:224
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:86
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:84
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:87
Gaudi::Utils::toStream
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:299
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:89
DataObjID::p_clidSvc
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:92
std::string::empty
T empty(T... args)
DataObjID::setClid
void setClid()
Definition: DataObjID.cpp:67
DataObjID::key
const std::string & key() const
only return the last part of the key
Definition: DataObjID.h:60
IClassIDSvc::getTypeNameOfID
virtual StatusCode getTypeNameOfID(const CLID &id, std::string &typeName) const =0
get user assigned type name associated with clID
DataObjID::toStream
friend std::ostream & toStream(const DataObjID &v, std::ostream &o)
Definition: DataObjID.cpp:93
std::ref
T ref(T... args)
std::hash