| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Public Attributes | 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 ()=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::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 | 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 IClassIDSvc * | p_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::ostream & | toStream (const DataObjID &v, std::ostream &o)
std::ostream & | operator<< (std::ostream &os, const DataObjID &d)

## Detailed Description

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

80 : m_key( key ) { hashGen(); }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:73
DataObjID::key
const std::string & key() const
Definition: DataObjID.h:48
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:73

## ◆ DataObjID() [4/5]

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

Definition at line 82 of file DataObjID.h.

82 : m_clid( clid ), m_key( key ) {
83 setClassName();
84 hashGen();
85 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:73
DataObjID::clid
CLID clid() const
Definition: DataObjID.h:53
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:70
DataObjID::key
const std::string & key() const
Definition: DataObjID.h:48
DataObjID::setClassName
void setClassName()
Definition: DataObjID.cpp:65
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:73

## ◆ DataObjID() [5/5]

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

Definition at line 87 of file DataObjID.h.

88 : m_key( key ), m_className( className ) {
89 setClid();
90 hashGen();
91 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:73
DataObjID::key
const std::string & key() const
Definition: DataObjID.h:48
DataObjID::setClid
void setClid()
Definition: DataObjID.cpp:56
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:74
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:73

## Member Function Documentation

## ◆ clid()

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

Definition at line 53 of file DataObjID.h.

53 { return m_clid; }
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:70

## ◆ fullKey()

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

Definition at line 88 of file DataObjID.cpp.

88 {
89 return ( m_clid == 0 && m_className.empty() ) ? m_key : ( m_className + '/' + m_key );
90 }
std::string::empty
T empty(T... args)
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:73
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:70
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:74

## ◆ hashGen()

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

Definition at line 73 of file DataObjID.cpp.

73 {
74 m_hash = ( std::hash<std::string>()( m_key ) );
75 if ( m_clid != 0 ) {
76 // this is a bit redundant since hash<int> is a pass-through
77 m_hash ^= ( std::hash<CLID>()( m_clid ) << 1 );
78 }
79 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:73
std::hash
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:70
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:71

## ◆ key()

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

Definition at line 48 of file DataObjID.h.

48 { return m_key; }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:73

## ◆ setClassName()

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

Definition at line 65 of file DataObjID.cpp.

65 {
66 std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
67
68 if ( !p_clidSvc || p_clidSvc->getTypeNameOfID( m_clid, m_className ).isFailure() ) {
69 m_className = "UNKNOW_CLID:" + std::to_string( m_clid );
70 }
71 }
std::to_string
T to_string(T... args)
DataObjID::p_clidSvc
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:76
std::call_once
T call_once(T... args)
DataObjID::m_ip
static std::once_flag m_ip
Definition: DataObjID.h:77
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:70
std::ref
T ref(T... args)
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:74

## ◆ setClid()

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

Definition at line 56 of file DataObjID.cpp.

56 {
57 std::call_once( m_ip, getClidSvc, std::ref( p_clidSvc ) );
58
59 if ( !p_clidSvc || p_clidSvc->getIDOfTypeName( m_className, m_clid ).isFailure() ) {
60 m_clid = 0;
61 m_className = "UNKNOWN_CLASS:" + m_className;
62 }
63 }
DataObjID::p_clidSvc
static IClassIDSvc * p_clidSvc
Definition: DataObjID.h:76
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:77
DataObjID::m_clid
CLID m_clid
Definition: DataObjID.h:70
std::ref
T ref(T... args)
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
DataObjID::m_className
std::string m_className
Definition: DataObjID.h:74

## ◆ updateKey()

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

Definition at line 93 of file DataObjID.h.

93 {
94 m_key = key;
95 hashGen();
96 }
DataObjID::m_key
std::string m_key
Definition: DataObjID.h:73
DataObjID::key
const std::string & key() const
Definition: DataObjID.h:48
DataObjID::hashGen
void hashGen()
Definition: DataObjID.cpp:73

## Friends And Related Function Documentation

## ◆ operator!=

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

Definition at line 59 of file DataObjID.h.

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

## ◆ operator<

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

Definition at line 57 of file DataObjID.h.

57 { return lhs.m_hash < rhs.m_hash; }
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:71

## ◆ operator<<

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

Definition at line 63 of file DataObjID.h.

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

## ◆ operator==

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

Definition at line 58 of file DataObjID.h.

58 { return lhs.m_hash == rhs.m_hash; }
DataObjID::m_hash
std::size_t m_hash
Definition: DataObjID.h:71

## ◆ parse

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

Definition at line 46 of file DataObjID.cpp.

46 { return Gaudi::Parsers::parse_( dest, quote( src ) ); }
Gaudi::Parsers::parse_
StatusCode parse_(ResultT &result, const std::string &input)
Definition: Factory.h:29
gaudirun.dest
dest
Definition: gaudirun.py:201

## ◆ toStream

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

Definition at line 82 of file DataObjID.cpp.

82 {
83 using Gaudi::Utils::toStream;
84 return ( d.m_clid != 0 || !d.m_className.empty() ) ? toStream( std::tie( d.m_className, d.m_key ), os )
85 : toStream( d.m_key, os );
86 }
DataObjID::toStream
friend std::ostream & toStream(const DataObjID &v, std::ostream &o)
Definition: DataObjID.cpp:82
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:284
std::tie
T tie(T... args)

## Member Data Documentation

## ◆ DataObjID_Hasher

friend DataObjID::DataObjID_Hasher

Definition at line 39 of file DataObjID.h.

## ◆ m_className

std::string DataObjID::m_className
| private

Definition at line 74 of file DataObjID.h.

## ◆ m_clid

CLID DataObjID::m_clid {0}
| private

Definition at line 70 of file DataObjID.h.

## ◆ m_hash

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

Definition at line 71 of file DataObjID.h.

## ◆ m_ip

std::once_flag DataObjID::m_ip
| static private

Definition at line 77 of file DataObjID.h.

## ◆ m_key

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

Definition at line 73 of file DataObjID.h.

## ◆ p_clidSvc

IClassIDSvc * DataObjID::p_clidSvc
| static private

Definition at line 76 of file DataObjID.h.

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

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