ATLAS Offline Software
v5_Guid.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 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 #include <cstring>
16 
17 /*
18  * POOL namespace (changed for DAQ use)
19  */
21 
34  class Guid { // size is 16
35  public:
36  unsigned int Data1;
37  unsigned short Data2;
38  unsigned short Data3;
39  unsigned char Data4[8];
40 
42  Guid() { }
44  explicit Guid(bool assign) { if ( assign ) create(*this); }
46  explicit Guid(const char* s) { fromString(s); }
48  explicit Guid(const std::string& s) { fromString(s); }
50  Guid(const Guid& c) { *this = c; }
52  Guid& operator=(const Guid& g) {
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  }
64  bool operator<(const Guid& g) const;
66  bool operator==(const Guid& g) const {
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  }
76  bool operator!=(const Guid& g) const {
77  return !(this->operator==(g));
78  }
80  const std::string toString() const;
82  const Guid& fromString(const std::string& s);
84  static const Guid& null();
86  static void create(Guid& guid);
87  };
88 }
89 #endif // OFFLINE_V5_POOL_GUID_H
offline_poolCopy_v5::Guid::operator!=
bool operator!=(const Guid &g) const
Non-equality operator.
Definition: v5_Guid.h:76
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:52
offline_poolCopy_v5::Guid::Data2
unsigned short Data2
Definition: v5_Guid.h:37
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:34
offline_poolCopy_v5
Definition: v5_Guid.h:20
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:36
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:39
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:42
offline_poolCopy_v5::Guid::Guid
Guid(const char *s)
Constructor for Guid from char*.
Definition: v5_Guid.h:46
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:44
offline_poolCopy_v5::Guid::Guid
Guid(const std::string &s)
Constructor for Guid from string.
Definition: v5_Guid.h:48
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
offline_poolCopy_v5::Guid::Guid
Guid(const Guid &c)
Copy constructor.
Definition: v5_Guid.h:50
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:66
offline_poolCopy_v5::Guid::Data3
unsigned short Data3
Definition: v5_Guid.h:38