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 "uuid/uuid.h"
5 #include <string>
6 
7 /*
8  * copied from pool
9  */
10 namespace edm {
11 
26  class Guid { // size is 16
27  public:
29  Guid() { init(); }
31  explicit Guid(bool usetime) { init(usetime); }
33  explicit Guid(char const* s, bool binary = false) { binary ? fromBinary(s) : fromString(s); }
35  explicit Guid(std::string const& s, bool binary = false) { binary ? fromBinary(s) : fromString(s); }
37  Guid(Guid const& c) { *this = c; }
39  Guid& operator=(Guid const& g) {
40  if (this != &g) {
41  ::uuid_copy(data_, g.data_);
42  }
43  return *this;
44  }
46  bool operator<(Guid const& g) const;
48  bool operator==(Guid const& g) const {
49  if (this != &g) {
50  return ::uuid_compare(data_, g.data_) == 0;
51  }
52  return true;
53  }
55  bool operator!=(Guid const& g) const { return !(this->operator==(g)); }
57  std::string const toBinary() const;
59  Guid const& fromBinary(std::string const& s);
61  std::string const toString() const;
63  Guid const& fromString(std::string const& s);
64 
65  static bool isValidString(std::string const& s);
66 
67  private:
69  void init(bool usetime = false);
70  uuid_t data_;
71  };
72 } // namespace edm
73 #endif
uuid_t data_
Definition: Guid.h:70
Guid const & fromBinary(std::string const &s)
conversion from binary string representation
Definition: Guid.cc:32
Guid const & fromString(std::string const &s)
conversion from formatted string representation
Definition: Guid.cc:45
Guid(char const *s, bool binary=false)
Constructor for Guid from char*.
Definition: Guid.h:33
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
Definition: Guid.h:26
std::string const toBinary() const
conversion to binary string reprentation
Definition: Guid.cc:30
Guid(Guid const &c)
Copy constructor.
Definition: Guid.h:37
bool operator==(Guid const &g) const
Equality operator.
Definition: Guid.h:48
void init(bool usetime=false)
initialize a new Guid
Definition: Guid.cc:18
bool operator!=(Guid const &g) const
Non-equality operator.
Definition: Guid.h:55
std::string const toString() const
conversion to formatted string reprentation
Definition: Guid.cc:38
HLT enums.
Guid()
Standard constructor (With initializaton)
Definition: Guid.h:29
static bool isValidString(std::string const &s)
Definition: Guid.cc:51
Guid & operator=(Guid const &g)
Assignment operator.
Definition: Guid.h:39
Guid(bool usetime)
Standard constructor (With initialization)
Definition: Guid.h:31
bool operator<(Guid const &g) const
Smaller operator.
Definition: Guid.cc:57
Guid(std::string const &s, bool binary=false)
Constructor for Guid from string.
Definition: Guid.h:35