ATLAS Offline Software
Loading...
Searching...
No Matches
offline_poolCopy_v5::Guid Class Reference

Description: More...

#include <POOLCore/Guid.h>

Collaboration diagram for offline_poolCopy_v5::Guid:

Public Member Functions

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

Static Public Member Functions

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

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

42{ }

◆ Guid() [2/5]

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

Standard constructor (With possible initialization)

Definition at line 44 of file v5_Guid.h.

44{ if ( assign ) create(*this); }
static void create(Guid &guid)
Create a new Guid.
Definition v5_Guid.cxx:36

◆ Guid() [3/5]

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

Constructor for Guid from char*.

Definition at line 46 of file v5_Guid.h.

46{ fromString(s); }
const Guid & fromString(const std::string &s)
Automatic conversion to string representation.
Definition v5_Guid.cxx:60

◆ Guid() [4/5]

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

Constructor for Guid from string.

Definition at line 48 of file v5_Guid.h.

48{ fromString(s); }

◆ Guid() [5/5]

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

Copy constructor.

Definition at line 50 of file v5_Guid.h.

50{ *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}
unsigned short Data2
Definition v5_Guid.h:37
unsigned char Data4[8]
Definition v5_Guid.h:39
unsigned short Data3
Definition v5_Guid.h:38
static const char *const fmt_Guid
Definition v5_Guid.cxx:24

◆ 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}
static const offline_poolCopy_v5::Guid clid_null(std::string("00000000-0000-0000-0000-000000000000"))

◆ operator!=()

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

Non-equality operator.

Definition at line 76 of file v5_Guid.h.

76 {
77 return !(this->operator==(g));
78 }
bool operator==(const Guid &g) const
Equality operator.
Definition v5_Guid.h:66

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

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

◆ operator==()

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

Equality operator.

Definition at line 66 of file v5_Guid.h.

66 {
67 if ( this != & g ) {
68 if (Data1 != g.Data1 ) return false;
69 if (Data2 != g.Data2 ) return false;
70 if (Data3 != g.Data3 ) return false;
71 return memcmp (Data4, g.Data4, sizeof(Data4)) == 0;
72 }
73 return true;
74 }

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

◆ Data2

unsigned short offline_poolCopy_v5::Guid::Data2

Definition at line 37 of file v5_Guid.h.

◆ Data3

unsigned short offline_poolCopy_v5::Guid::Data3

Definition at line 38 of file v5_Guid.h.

◆ Data4

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

Definition at line 39 of file v5_Guid.h.


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