| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
DataObjID Class Reference

`#include <GaudiKernel/DataObjID.h>`

Collaboration diagram for DataObjID:
[legend]

## Public Member Functions
| DataObjID ()
| DataObjID (const std::string &key)
| DataObjID (const CLID &clid, const std::string &key)
| DataObjID (const std::string &className, const std::string &key)
| DataObjID (const DataObjID &)=default
const std::string & | key () const
std::string | fullKey () const
CLID | clid () const
void | updateKey (const std::string &key)
bool | operator< (const DataObjID &other) const
bool | operator== (const DataObjID &other) const
bool | operator!= (const DataObjID &other) const

## Public Attributes
friend | DataObjID_Hasher

## Private Member Functions
void | hashGen ()
void | parse (const std::string &key)
void | setClid ()
void | setClassName ()

## Static Private Member Functions
static void | getClidSvc ()

## Private Attributes
CLID | m_clid {0}
std::size_t | m_hash {0}
std::string | m_className {""}
std::string | m_key {"INVALID"}

## Static Private Attributes
static IClassIDSvc * | p_clidSvc
static std::once_flag | m_ip

## Friends
std::ostream & | operator<< (std::ostream &str, const DataObjID &d)

## Detailed Description

Definition at line 38 of file DataObjID.h.

## Constructor & Destructor Documentation

DataObjID::DataObjID | ( |  | ) |
| inline

Definition at line 42 of file DataObjID.h.

42 {};

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

Definition at line 91 of file DataObjID.h.

91 :
92 m_key(key) {
93 hashGen();
94
95 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:83
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:11

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

Definition at line 97 of file DataObjID.h.

97 :
98 m_clid(clid), m_key(key) {
99 setClassName();
100 hashGen();
101 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:83
DataObjID::clid
CLID clid() const
Definition: DataObjID.h:54
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:79
DataObjID::setClassName
void setClassName()
Definition: DataObjID.cpp:42
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:11

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

Definition at line 103 of file DataObjID.h.

103 :
104 m_className(className), m_key(key) {
105 setClid();
106 hashGen();
107 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:83
DataObjID::setClid
void setClid()
Definition: DataObjID.cpp:29
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:82
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:11

DataObjID::DataObjID | ( | const DataObjID & |  | ) |
| default

## Member Function Documentation

CLID DataObjID::clid | ( |  | ) | const
| inline

Definition at line 54 of file DataObjID.h.

54 { return m_clid; }
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:79

std::string DataObjID::fullKey | ( |  | ) | const

Definition at line 64 of file DataObjID.cpp.

64 {
65 if (m_clid == 0 && m_className == "") {
66 return m_key;
67 } else {
68 return ( m_className + "/" + m_key );
69 }
70 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:83
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:79
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:82

void DataObjID::getClidSvc | ( |  | ) |
| static private

Definition at line 23 of file DataObjID.cpp.

23 {
24 p_clidSvc = Gaudi::svcLocator()->service<IClassIDSvc>("ClassIDSvc").get();
25 }
DataObjID::p_clidSvc
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:86
IClassIDSvc
interface to the CLID database
Definition: IClassIDSvc.h:23
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
Gaudi::svcLocator
GAUDI_API ISvcLocator * svcLocator()

void DataObjID::hashGen | ( |  | ) |
| private

Definition at line 11 of file DataObjID.cpp.

11 {
12
13 if (m_clid == 0) {
14 m_hash = (std::hash<std::string>()(m_key));
15 } else {
16 // this is a bit redundant since hash<int> is a pass-through
17 m_hash = (std::hash<std::string>()(m_key)) ^ (std::hash<CLID>()(m_clid) << 1);
18 }
19
20 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:83
std::hash
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:79
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:80

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

Definition at line 49 of file DataObjID.h.

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

bool DataObjID::operator!= | ( | const DataObjID & | other | ) | const
| inline

Definition at line 68 of file DataObjID.h.

68 {
69 return (m_hash != other.m_hash);
70 }
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:80

bool DataObjID::operator< | ( | const DataObjID & | other | ) | const
| inline

Definition at line 60 of file DataObjID.h.

60 {
61 return (m_hash < other.m_hash);
62 }
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:80

bool DataObjID::operator== | ( | const DataObjID & | other | ) | const
| inline

Definition at line 64 of file DataObjID.h.

64 {
65 return (m_hash == other.m_hash);
66 }
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:80

void DataObjID::parse | ( | const std::string & | key | ) |
| private

void DataObjID::setClassName | ( |  | ) |
| private

Definition at line 42 of file DataObjID.cpp.

42 {
43
44 std::call_once( m_ip, &DataObjID::getClidSvc );
45
46 if (p_clidSvc == nullptr || p_clidSvc->getTypeNameOfID(m_clid, m_className).isFailure()) {
47 m_className = "UNKNOW_CLID:" + std::to_string(m_clid);
48 }
49
50 }
std::to_string
T to_string(T...args)
DataObjID::p_clidSvc
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:86
std::call_once
T call_once(T...args)
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
DataObjID::m_ip
static std::once_flag m_ip
Definition: DataObjID.h:87
IClassIDSvc::getTypeNameOfID
virtual StatusCode getTypeNameOfID(const CLID &id, std::string &typeName) const =0
get user assigned type name associated with clID
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:79
DataObjID::getClidSvc
static void getClidSvc()
Definition: DataObjID.cpp:23
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:82

void DataObjID::setClid | ( |  | ) |
| private

Definition at line 29 of file DataObjID.cpp.

29 {
30
31 std::call_once( m_ip, &DataObjID::getClidSvc );
32
33 if (p_clidSvc == nullptr || p_clidSvc->getIDOfTypeName(m_className, m_clid).isFailure()) {
34 m_clid = 0;
35 m_className = "UNKNOWN_CLASS:" + m_className;
36 }
37
38 }
DataObjID::p_clidSvc
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:86
std::call_once
T call_once(T...args)
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
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:87
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:79
DataObjID::getClidSvc
static void getClidSvc()
Definition: DataObjID.cpp:23
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:82

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

Definition at line 109 of file DataObjID.h.

109 {
110 m_key = key;
111 hashGen();
112 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:83
DataObjID::key
const std::string & key() const
Definition: DataObjID.h:49
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:11

## Friends And Related Function Documentation

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

Definition at line 54 of file DataObjID.cpp.

54 {
55 if (d.m_clid == 0 && d.m_className == "") {
56 str << "('" << d.m_key << "')";
57 } else {
58 str << "('" << d.m_className << "','" << d.m_key << "')";
59 }
60 return str;
61 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:83
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:79
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:82

## Member Data Documentation

friend DataObjID::DataObjID_Hasher

Definition at line 40 of file DataObjID.h.

std::string DataObjID::m_className {""}
| private

Definition at line 82 of file DataObjID.h.

CLID DataObjID::m_clid {0}
| private

Definition at line 79 of file DataObjID.h.

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

Definition at line 80 of file DataObjID.h.

std::once_flag DataObjID::m_ip
| static private

Definition at line 87 of file DataObjID.h.

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

Definition at line 83 of file DataObjID.h.

IClassIDSvc * DataObjID::p_clidSvc
| static private

Definition at line 86 of file DataObjID.h.

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

- GaudiKernel/GaudiKernel/DataObjID.h
- GaudiKernel/src/Lib/DataObjID.cpp