ATLAS Offline Software
v5_Guid.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // This is a warapper class for uuid.
6 // It is copied from POOL because I am not allowed to have this
7 // dependence in tdaq-common.
8 // We need to have a unique ID represented in strings in the same way as in POOL.
9 // Szymon, January 2007
10 
11 #ifndef OFFLINE_V5_POOL_GUID_H
12 #define OFFLINE_V5_POOL_GUID_H
13 
14 #include <string>
15 
16 /*
17  * POOL namespace (changed for DAQ use)
18  */
20 
33  class Guid { // size is 16
34  public:
35  unsigned int Data1;
36  unsigned short Data2;
37  unsigned short Data3;
38  unsigned char Data4[8];
39 
41  Guid() { }
43  explicit Guid(bool assign) { if ( assign ) create(*this); }
45  explicit Guid(const char* s) { fromString(s); }
47  explicit Guid(const std::string& s) { fromString(s); }
49  Guid(const Guid& c) { *this = c; }
51  Guid& operator=(const Guid& g) {
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  }
63  bool operator<(const Guid& g) const;
65  bool operator==(const Guid& g) const {
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  }
77  bool operator!=(const Guid& g) const {
78  return !(this->operator==(g));
79  }
81  const std::string toString() const;
83  const Guid& fromString(const std::string& s);
85  static const Guid& null();
87  static void create(Guid& guid);
88  };
89 }
90 #endif // OFFLINE_V5_POOL_GUID_H
offline_poolCopy_v5::Guid::operator!=
bool operator!=(const Guid &g) const
Non-equality operator.
Definition: v5_Guid.h:77
offline_poolCopy_v5::Guid::operator<
bool operator<(const Guid &g) const
Smaller operator.
Definition: v5_Guid.cxx:75
offline_poolCopy_v5::Guid::operator=
Guid & operator=(const Guid &g)
Assignment operator.
Definition: v5_Guid.h:51
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
offline_poolCopy_v5::Guid::Data2
unsigned short Data2
Definition: v5_Guid.h:36
offline_poolCopy_v5::Guid::toString
const std::string toString() const
Automatic conversion from string reprentation.
Definition: v5_Guid.cxx:50
offline_poolCopy_v5::Guid
Definition: v5_Guid.h:33
offline_poolCopy_v5
Definition: v5_Guid.h:19
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
lumiFormat.i
int i
Definition: lumiFormat.py:92
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::Guid
Guid()
Standard constructor (No initialization of data for performance reasons)
Definition: v5_Guid.h:41
offline_poolCopy_v5::Guid::Guid
Guid(const char *s)
Constructor for Guid from char*.
Definition: v5_Guid.h:45
offline_poolCopy_v5::Guid::fromString
const Guid & fromString(const std::string &s)
Automatic conversion to string representation.
Definition: v5_Guid.cxx:60
offline_poolCopy_v5::Guid::Guid
Guid(bool assign)
Standard constructor (With possible initialization)
Definition: v5_Guid.h:43
offline_poolCopy_v5::Guid::Guid
Guid(const std::string &s)
Constructor for Guid from string.
Definition: v5_Guid.h:47
extractSporadic.q
list q
Definition: extractSporadic.py:98
offline_poolCopy_v5::Guid::Guid
Guid(const Guid &c)
Copy constructor.
Definition: v5_Guid.h:49
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