CMS 3D CMS Logo

List of all members | Public Member Functions | Static Private Member Functions | Private Attributes
PhysicsTools::AtomicId Class Reference

Cheap generic unique keyword identifier class. More...

#include <AtomicId.h>

Public Member Functions

 AtomicId () throw ()
 
 AtomicId (const AtomicId &orig) throw ()
 
 AtomicId (const char *arg) throw ()
 constructs an AtomicId from a C string More...
 
 AtomicId (const std::string &arg) throw ()
 constructs an AtomicId from a STL string More...
 
 operator bool () const throw ()
 null value check operator More...
 
 operator const char * () const throw ()
 implicit cast to a C string More...
 
 operator std::string () const throw ()
 implicit cast to a STL string More...
 
bool operator!= (const AtomicId &second) const throw ()
 
bool operator< (const AtomicId &second) const throw ()
 
bool operator<= (const AtomicId &second) const throw ()
 
AtomicIdoperator= (const AtomicId &orig) throw ()
 
bool operator== (const AtomicId &second) const throw ()
 
bool operator> (const AtomicId &second) const throw ()
 
bool operator>= (const AtomicId &second) const throw ()
 
 ~AtomicId () throw ()
 

Static Private Member Functions

static AtomicId build (const char *arg) throw ()
 
static const char * lookup (const char *arg) throw ()
 

Private Attributes

const char * string
 

Detailed Description

Cheap generic unique keyword identifier class.

AtomicId is a lightweight class intended to be used for key values e.g. in STL maps. An atomic identifier can be transparently constructed from and converted back to a string, but an instance of AtomicId does not occupy and additional memory and the comparator operators are very cheap. An AtomicId instance requires the size of a pointer and is therefore suited for direct inlining.

Definition at line 31 of file AtomicId.h.

Constructor & Destructor Documentation

PhysicsTools::AtomicId::AtomicId ( )
throw (
)
inline

Definition at line 33 of file AtomicId.h.

33 : string(nullptr) {}
const char * string
Definition: AtomicId.h:68
PhysicsTools::AtomicId::AtomicId ( const AtomicId orig)
throw (
)
inline

Definition at line 34 of file AtomicId.h.

34 : string(orig.string) {}
const char * string
Definition: AtomicId.h:68
PhysicsTools::AtomicId::AtomicId ( const char *  arg)
throw (
)
inline

constructs an AtomicId from a C string

Definition at line 36 of file AtomicId.h.

36 : string(lookup(arg)) {}
const char * string
Definition: AtomicId.h:68
static const char * lookup(const char *arg)
Definition: AtomicId.cc:65
A arg
Definition: Factorize.h:37
PhysicsTools::AtomicId::AtomicId ( const std::string &  arg)
throw (
)
inline

constructs an AtomicId from a STL string

Definition at line 38 of file AtomicId.h.

38  :
39  string(lookup(arg.c_str())) {}
const char * string
Definition: AtomicId.h:68
static const char * lookup(const char *arg)
Definition: AtomicId.cc:65
A arg
Definition: Factorize.h:37
PhysicsTools::AtomicId::~AtomicId ( )
throw (
)
inline

Definition at line 40 of file AtomicId.h.

40 {}

Member Function Documentation

static AtomicId PhysicsTools::AtomicId::build ( const char *  arg)
throw (
)
inlinestaticprivate

Definition at line 65 of file AtomicId.h.

References lookup(), lumiQueryAPI::q, and string.

65 { AtomicId q; q.string = arg; return q; }
A arg
Definition: Factorize.h:37
const char * PhysicsTools::AtomicId::lookup ( const char *  arg)
throw (
)
staticprivate

Definition at line 65 of file AtomicId.cc.

References PhysicsTools::getAtomicIdCache().

Referenced by build().

66 {
67  if (string)
68  return getAtomicIdCache().findOrInsert(string);
69 
70  return nullptr;
71 }
static IdCache & getAtomicIdCache()
Definition: AtomicId.cc:59
PhysicsTools::AtomicId::operator bool ( ) const
throw (
)
inline

null value check operator

Definition at line 50 of file AtomicId.h.

51  { return string != nullptr; }
PhysicsTools::AtomicId::operator const char * ( ) const
throw (
)
inline

implicit cast to a C string

Definition at line 46 of file AtomicId.h.

References string.

47  { return string; }
const char * string
Definition: AtomicId.h:68
PhysicsTools::AtomicId::operator std::string ( ) const
throw (
)
inline

implicit cast to a STL string

Definition at line 54 of file AtomicId.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

bool PhysicsTools::AtomicId::operator!= ( const AtomicId second) const
throw (
)
inline

Definition at line 58 of file AtomicId.h.

References edm::second().

58 { return string != second.string; }
U second(std::pair< T, U > const &p)
bool PhysicsTools::AtomicId::operator< ( const AtomicId second) const
throw (
)
inline

Definition at line 59 of file AtomicId.h.

References edm::second().

59 { return string < second.string; }
U second(std::pair< T, U > const &p)
bool PhysicsTools::AtomicId::operator<= ( const AtomicId second) const
throw (
)
inline

Definition at line 60 of file AtomicId.h.

References edm::second().

60 { return string <= second.string; }
U second(std::pair< T, U > const &p)
AtomicId& PhysicsTools::AtomicId::operator= ( const AtomicId orig)
throw (
)
inline

Definition at line 42 of file AtomicId.h.

References string.

43  { string = orig.string; return *this; }
bool PhysicsTools::AtomicId::operator== ( const AtomicId second) const
throw (
)
inline

Definition at line 57 of file AtomicId.h.

References edm::second().

57 { return string == second.string; }
U second(std::pair< T, U > const &p)
bool PhysicsTools::AtomicId::operator> ( const AtomicId second) const
throw (
)
inline

Definition at line 61 of file AtomicId.h.

References edm::second().

61 { return string > second.string; }
U second(std::pair< T, U > const &p)
bool PhysicsTools::AtomicId::operator>= ( const AtomicId second) const
throw (
)
inline

Definition at line 62 of file AtomicId.h.

References edm::second().

62 { return string >= second.string; }
U second(std::pair< T, U > const &p)

Member Data Documentation

const char* PhysicsTools::AtomicId::string
private

Definition at line 68 of file AtomicId.h.

Referenced by build(), operator const char *(), and operator=().