CMS 3D CMS Logo

Guid.h
Go to the documentation of this file.
1 #ifndef FWCOre_Utilities_Guid_h
2 #define FWCOre_Utilities_Guid_h
3 
4 #include <string>
5 
6 /*
7  * copied from pool
8  */
9 namespace edm {
10 
23  class Guid { // size is 16
24  public:
25  unsigned int Data1;
26  unsigned short Data2;
27  unsigned short Data3;
28  unsigned char Data4[8];
29 
31  Guid() { init(); }
33  explicit Guid(bool) { init(); }
35  explicit Guid(char const* s) { fromString(s); }
37  explicit Guid(std::string const& s) { fromString(s); }
39  Guid(Guid const& c) { *this = c; }
41  Guid& operator=(Guid const& g) {
42  if (this != &g) {
43  Data1 = g.Data1;
44  Data2 = g.Data2;
45  Data3 = g.Data3;
46  unsigned int* p = reinterpret_cast<unsigned int*>(&Data4[0]);
47  unsigned int const* q = reinterpret_cast<unsigned int const*>(&g.Data4[0]);
48  *(p + 1) = *(q + 1);
49  *p = *q;
50  }
51  return *this;
52  }
54  bool operator<(Guid const& g) const;
56  bool operator==(Guid const& g) const {
57  if (this != &g) {
58  if (Data1 != g.Data1)
59  return false;
60  if (Data2 != g.Data2)
61  return false;
62  if (Data3 != g.Data3)
63  return false;
64  unsigned int const* p = reinterpret_cast<unsigned int const*>(&Data4[0]);
65  unsigned int const* q = reinterpret_cast<unsigned int const*>(&g.Data4[0]);
66  return *p == *q && *(p + 1) == *(q + 1);
67  }
68  return true;
69  }
71  bool operator!=(Guid const& g) const { return !(this->operator==(g)); }
73  std::string const toString() const;
75  Guid const& fromString(std::string const& s);
77  private:
78  void init();
79  };
80 } // namespace edm
81 #endif
Guid(char const *s)
Constructor for Guid from char*.
Definition: Guid.h:35
unsigned short Data2
Definition: Guid.h:26
void init()
initialize a new Guid
Definition: Guid.cc:26
Guid(std::string const &s)
Constructor for Guid from string.
Definition: Guid.h:37
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
unsigned int Data1
Definition: Guid.h:25
std::string const toString() const
Automatic conversion from string reprentation.
Definition: Guid.cc:40
Definition: Guid.h:23
unsigned short Data3
Definition: Guid.h:27
Guid(Guid const &c)
Copy constructor.
Definition: Guid.h:39
Guid(bool)
Standard constructor (With initialization)
Definition: Guid.h:33
bool operator==(Guid const &g) const
Equality operator.
Definition: Guid.h:56
unsigned char Data4[8]
Definition: Guid.h:28
bool operator!=(Guid const &g) const
Non-equality operator.
Definition: Guid.h:71
HLT enums.
Guid()
Standard constructor (With initializaton)
Definition: Guid.h:31
Guid & operator=(Guid const &g)
Assignment operator.
Definition: Guid.h:41
bool operator<(Guid const &g) const
Smaller operator.
Definition: Guid.cc:96
Guid const & fromString(std::string const &s)
Automatic conversion to string representation.
Definition: Guid.cc:60