| The Gaudi Framework v30r0 (c919700c)

- 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)

## 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)
bool | operator< (const DataObjID &lhs, const DataObjID &rhs)
bool | operator== (const DataObjID &lhs, const DataObjID &rhs)
bool | operator!= (const DataObjID &lhs, const DataObjID &rhs)

## Detailed Description

Definition at line 37 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 83 of file DataObjID.h.

83 : m_key( key ) { hashGen(); }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:76
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:10

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

Definition at line 85 of file DataObjID.h.

85 : m_clid( clid ), m_key( key )
86 {
87 setClassName();
88 hashGen();
89 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:76
DataObjID::clid
CLID clid() const
Definition: DataObjID.h:54
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:72
DataObjID::setClassName
void setClassName()
Definition: DataObjID.cpp:34
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:10

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

Definition at line 91 of file DataObjID.h.

92 : m_className( className ), m_key( key )
93 {
94 setClid();
95 hashGen();
96 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:76
DataObjID::setClid
void setClid()
Definition: DataObjID.cpp:23
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:75
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:10

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

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

Definition at line 54 of file DataObjID.cpp.

55 {
56 if ( m_clid == 0 && m_className == "" ) {
57 return m_key;
58 } else {
59 return ( m_className + "/" + m_key );
60 }
61 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:76
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:72
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:75

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

Definition at line 21 of file DataObjID.cpp.

21 { p_clidSvc = Gaudi::svcLocator()->service<IClassIDSvc>( "ClassIDSvc" ).get(); }
DataObjID::p_clidSvc
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:79
IClassIDSvc
interface to the CLID database
Definition: IClassIDSvc.h:24
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:79
Gaudi::svcLocator
GAUDI_API ISvcLocator * svcLocator()

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

Definition at line 10 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 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:76
std::hash
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:72
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:73

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

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

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

Definition at line 34 of file DataObjID.cpp.

35 {
36
37 std::call_once( m_ip, &DataObjID::getClidSvc );
38
39 if ( p_clidSvc == nullptr || p_clidSvc->getTypeNameOfID( m_clid, m_className ).isFailure() ) {
40 m_className = "UNKNOW_CLID:" + std::to_string( m_clid );
41 }
42 }
IClassIDSvc::getTypeNameOfID
virtual StatusCode getTypeNameOfID(const CLID &id, std::string &typeName) const =0
get user assigned type name associated with clID
std::to_string
T to_string(T...args)
DataObjID::p_clidSvc
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:79
std::call_once
T call_once(T...args)
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
DataObjID::m_ip
static std::once_flag m_ip
Definition: DataObjID.h:80
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:72
DataObjID::getClidSvc
static void getClidSvc()
Definition: DataObjID.cpp:21
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:75

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

Definition at line 23 of file DataObjID.cpp.

24 {
25
26 std::call_once( m_ip, &DataObjID::getClidSvc );
27
28 if ( p_clidSvc == nullptr || p_clidSvc->getIDOfTypeName( m_className, m_clid ).isFailure() ) {
29 m_clid = 0;
30 m_className = "UNKNOWN_CLASS:" + m_className;
31 }
32 }
IClassIDSvc::getIDOfTypeName
virtual StatusCode getIDOfTypeName(const std::string &typeName, CLID &id) const =0
get id associated with type name (if any)
DataObjID::p_clidSvc
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:79
std::call_once
T call_once(T...args)
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
DataObjID::m_ip
static std::once_flag m_ip
Definition: DataObjID.h:80
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:72
DataObjID::getClidSvc
static void getClidSvc()
Definition: DataObjID.cpp:21
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:75

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

Definition at line 98 of file DataObjID.h.

99 {
100 m_key = key;
101 hashGen();
102 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:76
DataObjID::key
const std::string & key() const
Definition: DataObjID.h:49
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:10

## Friends And Related Function Documentation

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

Definition at line 64 of file DataObjID.h.

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

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

Definition at line 60 of file DataObjID.h.

60 { return lhs.m_hash < rhs.m_hash; }
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:73

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

Definition at line 44 of file DataObjID.cpp.

45 {
46 if ( d.m_clid == 0 && d.m_className == "" ) {
47 str << "('" << d.m_key << "')";
48 } else {
49 str << "('" << d.m_className << "','" << d.m_key << "')";
50 }
51 return str;
52 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:76
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:72
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:75

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

Definition at line 62 of file DataObjID.h.

62 { return lhs.m_hash == rhs.m_hash; }
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:73

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

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

Definition at line 73 of file DataObjID.h.

std::once_flag DataObjID::m_ip
| static private

Definition at line 80 of file DataObjID.h.

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

Definition at line 76 of file DataObjID.h.

IClassIDSvc * DataObjID::p_clidSvc
| static private

Definition at line 79 of file DataObjID.h.

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

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