CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions
edm::Guid Class Reference

#include <POOLCore/Guid.h>

Public Member Functions

Guid const & fromString (std::string const &s)
 Automatic conversion to string representation. More...
 
 Guid ()
 Standard constructor (With initializaton) More...
 
 Guid (bool)
 Standard constructor (With initialization) More...
 
 Guid (char const *s)
 Constructor for Guid from char*. More...
 
 Guid (std::string const &s)
 Constructor for Guid from string. More...
 
 Guid (Guid const &c)
 Copy constructor. More...
 
bool operator!= (Guid const &g) const
 Non-equality operator. More...
 
bool operator< (Guid const &g) const
 Smaller operator. More...
 
Guidoperator= (Guid const &g)
 Assignment operator. More...
 
bool operator== (Guid const &g) const
 Equality operator. More...
 
std::string const toString () const
 Automatic conversion from string reprentation. More...
 

Public Attributes

unsigned int Data1
 
unsigned short Data2
 
unsigned short Data3
 
unsigned char Data4 [8]
 

Private Member Functions

void init ()
 initialize a new Guid More...
 

Detailed Description

Description:

Encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number). Note: This class may not have a virual destructor

Author
M.Frank Initial version using COM on WIN32
Zhen Xie Include DCE implementation for linux
Version
1.1
Date
03/09/2002

Definition at line 23 of file Guid.h.

Constructor & Destructor Documentation

edm::Guid::Guid ( )
inline

Standard constructor (With initializaton)

Definition at line 31 of file Guid.h.

References init().

31 { init(); }
void init()
initialize a new Guid
Definition: Guid.cc:27
edm::Guid::Guid ( bool  )
inlineexplicit

Standard constructor (With initialization)

Definition at line 33 of file Guid.h.

References init().

33 { init(); }
void init()
initialize a new Guid
Definition: Guid.cc:27
edm::Guid::Guid ( char const *  s)
inlineexplicit

Constructor for Guid from char*.

Definition at line 35 of file Guid.h.

References fromString().

35 { fromString(s); }
Guid const & fromString(std::string const &s)
Automatic conversion to string representation.
Definition: Guid.cc:52
edm::Guid::Guid ( std::string const &  s)
inlineexplicit

Constructor for Guid from string.

Definition at line 37 of file Guid.h.

References fromString().

37 { fromString(s); }
Guid const & fromString(std::string const &s)
Automatic conversion to string representation.
Definition: Guid.cc:52
edm::Guid::Guid ( Guid const &  c)
inline

Copy constructor.

Definition at line 39 of file Guid.h.

References EnergyCorrector::c.

39 { *this = c; }

Member Function Documentation

Guid const & edm::Guid::fromString ( std::string const &  s)

Automatic conversion to string representation.

Definition at line 52 of file Guid.cc.

References assert(), Data1, Data2, Data3, Data4, fireworks::iSize, and hltrates_dqm_sourceclient-live_cfg::offset.

Referenced by Guid().

52  {
53  char const dash = '-';
54  size_t const iSize = 8;
55  size_t const sSize = 4;
56  size_t const cSize = 2;
57  size_t offset = 0;
58  Data1 = strtol(source.substr(offset, iSize).c_str(), 0, 16);
59  offset += iSize;
60  assert(dash == source[offset++]);
61  Data2 = strtol(source.substr(offset, sSize).c_str(), 0, 16);
62  offset += sSize;
63  assert(dash == source[offset++]);
64  Data3 = strtol(source.substr(offset, sSize).c_str(), 0, 16);
65  offset += sSize;
66  assert(dash == source[offset++]);
67  Data4[0] = strtol(source.substr(offset, cSize).c_str(), 0, 16);
68  offset += cSize;
69  Data4[1] = strtol(source.substr(offset, cSize).c_str(), 0, 16);
70  offset += cSize;
71  assert(dash == source[offset++]);
72  Data4[2] = strtol(source.substr(offset, cSize).c_str(), 0, 16);
73  offset += cSize;
74  Data4[3] = strtol(source.substr(offset, cSize).c_str(), 0, 16);
75  offset += cSize;
76  Data4[4] = strtol(source.substr(offset, cSize).c_str(), 0, 16);
77  offset += cSize;
78  Data4[5] = strtol(source.substr(offset, cSize).c_str(), 0, 16);
79  offset += cSize;
80  Data4[6] = strtol(source.substr(offset, cSize).c_str(), 0, 16);
81  offset += cSize;
82  Data4[7] = strtol(source.substr(offset, cSize).c_str(), 0, 16);
83  offset += cSize;
84  assert(source.size() == offset);
85  return *this;
86  }
unsigned short Data2
Definition: Guid.h:26
static std::string const source("source")
assert(m_qm.get())
unsigned int Data1
Definition: Guid.h:25
unsigned short Data3
Definition: Guid.h:27
unsigned char Data4[8]
Definition: Guid.h:28
void edm::Guid::init ( void  )
private

initialize a new Guid

Initialize a new Guid.

Definition at line 27 of file Guid.cc.

References Data1, Data2, Data3, Data4, and i.

Referenced by Guid().

27  {
28  uuid_t me_;
29  ::uuid_generate_time(me_);
30  unsigned int* d1 = reinterpret_cast<unsigned int*>(me_);
31  unsigned short* d2 = reinterpret_cast<unsigned short*>(me_+4);
32  unsigned short* d3 = reinterpret_cast<unsigned short*>(me_+6);
33  Data1 = *d1;
34  Data2 = *d2;
35  Data3 = *d3;
36  for(int i = 0; i < 8; ++i){
37  Data4[i] = me_[i + 8];
38  }
39  }
int i
Definition: DBlmapReader.cc:9
unsigned short Data2
Definition: Guid.h:26
unsigned int Data1
Definition: Guid.h:25
unsigned short Data3
Definition: Guid.h:27
unsigned char Data4[8]
Definition: Guid.h:28
bool edm::Guid::operator!= ( Guid const &  g) const
inline

Non-equality operator.

Definition at line 68 of file Guid.h.

References operator==().

68  {
69  return !(this->operator == (g));
70  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
bool operator==(Guid const &g) const
Equality operator.
Definition: Guid.h:56
bool edm::Guid::operator< ( Guid const &  g) const

Smaller operator.

Definition at line 88 of file Guid.cc.

References Data1.

88  {
89  return ::memcmp(&g.Data1, &Data1, 16) < 0;
90  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
unsigned int Data1
Definition: Guid.h:25
Guid& edm::Guid::operator= ( Guid const &  g)
inline

Assignment operator.

Definition at line 41 of file Guid.h.

References compareJSON::const, Data1, Data2, Data3, Data4, AlCaHLTBitMon_ParallelJobs::p, and lumiQueryAPI::q.

41  {
42  if (this != &g) {
43  Data1 = g.Data1;
44  Data2 = g.Data2;
45  Data3 = g.Data3;
46  unsigned int * p = reinterpret_cast<unsigned int *>(&Data4[0]);
47  unsigned int const* q = reinterpret_cast<unsigned int const*>(&g.Data4[0]);
48  *(p+1) = *(q+1);
49  *p = *q;
50  }
51  return *this;
52  }
unsigned short Data2
Definition: Guid.h:26
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
unsigned int Data1
Definition: Guid.h:25
unsigned short Data3
Definition: Guid.h:27
unsigned char Data4[8]
Definition: Guid.h:28
string const
Definition: compareJSON.py:14
bool edm::Guid::operator== ( Guid const &  g) const
inline

Equality operator.

Definition at line 56 of file Guid.h.

References compareJSON::const, Data1, Data2, Data3, Data4, AlCaHLTBitMon_ParallelJobs::p, and lumiQueryAPI::q.

Referenced by operator!=().

56  {
57  if (this != & g) {
58  if (Data1 != g.Data1) return false;
59  if (Data2 != g.Data2) return false;
60  if (Data3 != g.Data3) return false;
61  unsigned int const* p = reinterpret_cast<unsigned int const*>(&Data4[0]);
62  unsigned int const* q = reinterpret_cast<unsigned int const*>(&g.Data4[0]);
63  return *p == *q && *(p+1) == *(q+1);
64  }
65  return true;
66  }
unsigned short Data2
Definition: Guid.h:26
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
unsigned int Data1
Definition: Guid.h:25
unsigned short Data3
Definition: Guid.h:27
unsigned char Data4[8]
Definition: Guid.h:28
string const
Definition: compareJSON.py:14
std::string const edm::Guid::toString ( ) const

Automatic conversion from string reprentation.

Definition at line 41 of file Guid.cc.

References edm::bufSize, Data1, Data2, Data3, Data4, edm::fmt_Guid, and runonSM::text.

Referenced by edm::createGlobalIdentifier().

41  {
42  char text[bufSize];
43  ::snprintf(text, sizeof(text),
44  fmt_Guid,
45  Data1, Data2, Data3,
46  Data4[0], Data4[1], Data4[2], Data4[3],
47  Data4[4], Data4[5], Data4[6], Data4[7]);
48  return text;
49  }
static char const * fmt_Guid
Definition: Guid.cc:21
unsigned short Data2
Definition: Guid.h:26
static int const bufSize
Definition: Guid.cc:24
unsigned int Data1
Definition: Guid.h:25
unsigned short Data3
Definition: Guid.h:27
tuple text
Definition: runonSM.py:42
unsigned char Data4[8]
Definition: Guid.h:28

Member Data Documentation

unsigned int edm::Guid::Data1

Definition at line 25 of file Guid.h.

Referenced by fromString(), init(), operator<(), operator=(), operator==(), and toString().

unsigned short edm::Guid::Data2

Definition at line 26 of file Guid.h.

Referenced by fromString(), init(), operator=(), operator==(), and toString().

unsigned short edm::Guid::Data3

Definition at line 27 of file Guid.h.

Referenced by fromString(), init(), operator=(), operator==(), and toString().

unsigned char edm::Guid::Data4[8]

Definition at line 28 of file Guid.h.

Referenced by fromString(), init(), operator=(), operator==(), and toString().