#include <POOLCore/Guid.h>
Public Member Functions | |
const Guid & | fromString (const std::string &s) |
Automatic conversion to string representation. | |
Guid (const Guid &c) | |
Copy constructor. | |
Guid (const std::string &s) | |
Constructor for Guid from string. | |
Guid (const char *s) | |
Constructor for Guid from char*. | |
Guid (bool assign) | |
Standard constructor (With possible initialization). | |
Guid () | |
Standard constructor (No initialization of data for performance reasons). | |
bool | operator!= (const Guid &g) const |
Non-equality operator. | |
bool | operator< (const Guid &g) const |
Smaller operator. | |
Guid & | operator= (const Guid &g) |
Assignment operator. | |
bool | operator== (const Guid &g) const |
Equality operator. | |
const std::string | toString () const |
Automatic conversion from string reprentation. | |
Static Public Member Functions | |
static void | create (Guid &guid) |
Create a new Guid. | |
static const Guid & | null () |
NULL-Guid: static class method. | |
Public Attributes | |
unsigned int | Data1 |
unsigned short | Data2 |
unsigned short | Data3 |
unsigned char | Data4 [8] |
Encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number). Note: This class may not have a virual destructor
Definition at line 23 of file Guid.h.
edm::Guid::Guid | ( | ) | [inline] |
edm::Guid::Guid | ( | bool | assign | ) | [inline, explicit] |
edm::Guid::Guid | ( | const char * | s | ) | [inline, explicit] |
Constructor for Guid from char*.
Definition at line 35 of file Guid.h.
References fromString().
00035 { fromString(s); }
edm::Guid::Guid | ( | const std::string & | s | ) | [inline, explicit] |
Constructor for Guid from string.
Definition at line 37 of file Guid.h.
References fromString().
00037 { fromString(s); }
edm::Guid::Guid | ( | const Guid & | c | ) | [inline] |
Create a new Guid.
Definition at line 31 of file Guid.cc.
References d1, d2, d3, Data1, Data2, Data3, Data4, and i.
Referenced by edm::createGlobalIdentifier(), and Guid().
00031 { 00032 uuid_t me_; 00033 ::uuid_generate_time(me_); 00034 unsigned int *d1=(unsigned int*)me_; 00035 unsigned short *d2=(unsigned short*)(me_+4); 00036 unsigned short *d3=(unsigned short*)(me_+6); 00037 guid.Data1 = *d1; 00038 guid.Data2 = *d2; 00039 guid.Data3 = *d3; 00040 for (int i=0; i<8; i++){ 00041 guid.Data4[i]=me_[i+8]; 00042 } 00043 }
const Guid & edm::Guid::fromString | ( | const std::string & | s | ) |
Automatic conversion to string representation.
Definition at line 54 of file Guid.cc.
References d, Data1, Data2, Data3, Data4, and edm::fmt_Guid.
Referenced by Guid().
00054 { 00055 // Note: This looks funny, but the specs for sscanf formats say 00056 // that the space of a pointer in the ellipsis may only be 00057 // integer or short. Hence one has to reserve a bit more space 00058 // otherwise the stack gets corrupted. 00059 unsigned char d[8]; 00060 ::sscanf( source.c_str(), fmt_Guid, &Data1, &Data2, &Data3, 00061 &Data4[0], &Data4[1], &Data4[2], &Data4[3], &d[0], &d[1], &d[2], &d[3]); 00062 *(int*)&Data4[4] = *(int*)d; 00063 return *this; 00064 }
const Guid & edm::Guid::null | ( | ) | [static] |
NULL-Guid: static class method.
Definition at line 26 of file Guid.cc.
References edm::clid_null().
00026 { 00027 return clid_null; 00028 }
Non-equality operator.
Definition at line 68 of file Guid.h.
References operator==().
00068 { 00069 return !(this->operator==(g)); 00070 }
Assignment operator.
Definition at line 41 of file Guid.h.
References Data1, Data2, Data3, Data4, and p.
00041 { 00042 if ( this != &g ) { 00043 Data1 = g.Data1; 00044 Data2 = g.Data2; 00045 Data3 = g.Data3; 00046 unsigned int *p = (unsigned int*)&Data4[0]; 00047 const unsigned int *q = (const unsigned int*)&g.Data4[0]; 00048 *(p+1) = *(q+1); 00049 *p = *q; 00050 } 00051 return *this; 00052 }
Equality operator.
Definition at line 56 of file Guid.h.
References Data1, Data2, Data3, Data4, and p.
Referenced by operator!=().
00056 { 00057 if ( this != & g ) { 00058 if (Data1 != g.Data1 ) return false; 00059 if (Data2 != g.Data2 ) return false; 00060 if (Data3 != g.Data3 ) return false; 00061 const unsigned int *p = (const unsigned int*)&Data4[0], 00062 *q = (const unsigned int*)&g.Data4[0]; 00063 return *p++ == *q++ && *p == *q; 00064 } 00065 return true; 00066 }
const std::string edm::Guid::toString | ( | ) | const |
Automatic conversion from string reprentation.
Definition at line 45 of file Guid.cc.
References Data1, Data2, Data3, Data4, and edm::fmt_Guid.
Referenced by edm::createGlobalIdentifier(), FUShmDQMOutputService::FUShmDQMOutputService(), and edm::FUShmOutputModule::FUShmOutputModule().
00045 { 00046 char text[128]; 00047 ::sprintf(text, fmt_Guid, 00048 Data1, Data2, Data3, 00049 Data4[0], Data4[1], Data4[2], Data4[3], 00050 Data4[4], Data4[5], Data4[6], Data4[7]); 00051 return text; 00052 }
unsigned int edm::Guid::Data1 |
Definition at line 25 of file Guid.h.
Referenced by create(), fromString(), operator<(), operator=(), operator==(), and toString().
unsigned short edm::Guid::Data2 |
Definition at line 26 of file Guid.h.
Referenced by create(), fromString(), operator=(), operator==(), and toString().
unsigned short edm::Guid::Data3 |
Definition at line 27 of file Guid.h.
Referenced by create(), fromString(), operator=(), operator==(), and toString().
unsigned char edm::Guid::Data4[8] |
Definition at line 28 of file Guid.h.
Referenced by create(), fromString(), operator=(), operator==(), and toString().