ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
offline_poolCopy_v5::Guid Class Reference

#include <POOLCore/Guid.h>

Collaboration diagram for offline_poolCopy_v5::Guid:

Public Member Functions

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

Static Public Member Functions

static const Guidnull ()
 NULL-Guid: static class method. More...
 
static void create (Guid &guid)
 Create a new Guid. More...
 

Public Attributes

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

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 33 of file v5_Guid.h.

Constructor & Destructor Documentation

◆ Guid() [1/5]

offline_poolCopy_v5::Guid::Guid ( )
inline

Standard constructor (No initialization of data for performance reasons)

Definition at line 41 of file v5_Guid.h.

41 { }

◆ Guid() [2/5]

offline_poolCopy_v5::Guid::Guid ( bool  assign)
inlineexplicit

Standard constructor (With possible initialization)

Definition at line 43 of file v5_Guid.h.

43 { if ( assign ) create(*this); }

◆ Guid() [3/5]

offline_poolCopy_v5::Guid::Guid ( const char *  s)
inlineexplicit

Constructor for Guid from char*.

Definition at line 45 of file v5_Guid.h.

45 { fromString(s); }

◆ Guid() [4/5]

offline_poolCopy_v5::Guid::Guid ( const std::string &  s)
inlineexplicit

Constructor for Guid from string.

Definition at line 47 of file v5_Guid.h.

47 { fromString(s); }

◆ Guid() [5/5]

offline_poolCopy_v5::Guid::Guid ( const Guid c)
inline

Copy constructor.

Definition at line 49 of file v5_Guid.h.

49 { *this = c; }

Member Function Documentation

◆ create()

void Guid::create ( Guid guid)
static

Create a new Guid.

Definition at line 36 of file v5_Guid.cxx.

36  {
37  uuid_t me_;
38  ::uuid_generate_time(me_);
39  unsigned int *d1=(unsigned int*)me_;
40  unsigned short *d2=(unsigned short*)(me_+4);
41  unsigned short *d3=(unsigned short*)(me_+6);
42  guid.Data1 = *d1;
43  guid.Data2 = *d2;
44  guid.Data3 = *d3;
45  for (int i=0; i<8; i++){
46  guid.Data4[i]=me_[i+8];
47  }
48 }

◆ fromString()

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

Automatic conversion to string representation.

Definition at line 60 of file v5_Guid.cxx.

60  {
61  // Note: This looks funny, but the specs for sscanf formats say
62  // that the space of a pointer in the ellipsis may only be
63  // integer or short. Hence one has to reserve a bit more space
64  // otherwise the stack gets corrupted.
65  unsigned char d[8];
66  long unsigned int xData1;
67  ::sscanf( source.c_str(), fmt_Guid, &xData1, &Data2, &Data3,
68  &Data4[0], &Data4[1], &Data4[2], &Data4[3], &d[0], &d[1], &d[2], &d[3]);
69  Data1 = xData1;
70  //*(int*)&Data4[4] = *(int*)d;
71  ::memcpy(Data4+4, d, 4);
72  return *this;
73 }

◆ null()

const offline_poolCopy_v5::Guid & Guid::null ( )
static

NULL-Guid: static class method.

Definition at line 31 of file v5_Guid.cxx.

31  {
32  return clid_null;
33 }

◆ operator!=()

bool offline_poolCopy_v5::Guid::operator!= ( const Guid g) const
inline

Non-equality operator.

Definition at line 77 of file v5_Guid.h.

77  {
78  return !(this->operator==(g));
79  }

◆ operator<()

bool Guid::operator< ( const Guid g) const

Smaller operator.

Definition at line 75 of file v5_Guid.cxx.

75  {
76  return ::memcmp(&g.Data1, &Data1, 16) < 0;
77 }

◆ operator=()

Guid& offline_poolCopy_v5::Guid::operator= ( const Guid g)
inline

Assignment operator.

Definition at line 51 of file v5_Guid.h.

51  {
52  if ( this != &g ) {
53  Data1 = g.Data1;
54  Data2 = g.Data2;
55  Data3 = g.Data3;
56  for (size_t i = 0; i < 8; i++) {
57  Data4[i] = g.Data4[i];
58  }
59  }
60  return *this;
61  }

◆ operator==()

bool offline_poolCopy_v5::Guid::operator== ( const Guid g) const
inline

Equality operator.

Definition at line 65 of file v5_Guid.h.

65  {
66  if ( this != & g ) {
67  if (Data1 != g.Data1 ) return false;
68  if (Data2 != g.Data2 ) return false;
69  if (Data3 != g.Data3 ) return false;
70  const unsigned int *p = (const unsigned int*)&Data4[0],
71  *q = (const unsigned int*)&g.Data4[0];
72  return *p++ == *q++ && *p == *q;
73  }
74  return true;
75  }

◆ toString()

const std::string Guid::toString ( ) const

Automatic conversion from string reprentation.

Definition at line 50 of file v5_Guid.cxx.

50  {
51  char text[128];
52  ::snprintf(text, 128, fmt_Guid,
53  static_cast<long unsigned int>(Data1),
54  Data2, Data3,
55  Data4[0], Data4[1], Data4[2], Data4[3],
56  Data4[4], Data4[5], Data4[6], Data4[7]);
57  return text;
58 }

Member Data Documentation

◆ Data1

unsigned int offline_poolCopy_v5::Guid::Data1

Definition at line 35 of file v5_Guid.h.

◆ Data2

unsigned short offline_poolCopy_v5::Guid::Data2

Definition at line 36 of file v5_Guid.h.

◆ Data3

unsigned short offline_poolCopy_v5::Guid::Data3

Definition at line 37 of file v5_Guid.h.

◆ Data4

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

Definition at line 38 of file v5_Guid.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
hist_file_dump.d
d
Definition: hist_file_dump.py:137
offline_poolCopy_v5::Guid::Data2
unsigned short Data2
Definition: v5_Guid.h:36
dq_defect_virtual_defect_validation.d1
d1
Definition: dq_defect_virtual_defect_validation.py:79
offline_poolCopy_v5::Guid::create
static void create(Guid &guid)
Create a new Guid.
Definition: v5_Guid.cxx:36
offline_poolCopy_v5::Guid::Data1
unsigned int Data1
Definition: v5_Guid.h:35
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
offline_poolCopy_v5::Guid::Data4
unsigned char Data4[8]
Definition: v5_Guid.h:38
pool_uuid.guid
guid
Definition: pool_uuid.py:112
offline_poolCopy_v5::Guid::fromString
const Guid & fromString(const std::string &s)
Automatic conversion to string representation.
Definition: v5_Guid.cxx:60
dq_defect_virtual_defect_validation.d2
d2
Definition: dq_defect_virtual_defect_validation.py:81
extractSporadic.q
list q
Definition: extractSporadic.py:98
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
copySelective.source
string source
Definition: copySelective.py:32
python.compressB64.c
def c
Definition: compressB64.py:93
offline_poolCopy_v5::Guid::operator==
bool operator==(const Guid &g) const
Equality operator.
Definition: v5_Guid.h:65
offline_poolCopy_v5::Guid::Data3
unsigned short Data3
Definition: v5_Guid.h:37