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  private:
67  void init(bool usetime = false);
68  uuid_t data_;
69  };
70 } // namespace edm
71 #endif
edm::Guid::Guid
Guid(std::string const &s, bool binary=false)
Constructor for Guid from string.
Definition: Guid.h:35
edm::Guid::fromBinary
Guid const & fromBinary(std::string const &s)
conversion from binary string representation
Definition: Guid.cc:32
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::Guid::Guid
Guid(char const *s, bool binary=false)
Constructor for Guid from char*.
Definition: Guid.h:33
edm::Guid::toString
const std::string toString() const
conversion to formatted string reprentation
Definition: Guid.cc:38
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::Guid::operator==
bool operator==(Guid const &g) const
Equality operator.
Definition: Guid.h:48
edm::Guid::fromString
Guid const & fromString(std::string const &s)
conversion from formatted string representation
Definition: Guid.cc:45
edm::Guid::init
void init(bool usetime=false)
initialize a new Guid
Definition: Guid.cc:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Guid::Guid
Guid(Guid const &c)
Copy constructor.
Definition: Guid.h:37
edm::Guid::toBinary
const std::string toBinary() const
conversion to binary string reprentation
Definition: Guid.cc:30
edm::Guid::operator!=
bool operator!=(Guid const &g) const
Non-equality operator.
Definition: Guid.h:55
edm::Guid
Definition: Guid.h:26
edm::Guid::operator=
Guid & operator=(Guid const &g)
Assignment operator.
Definition: Guid.h:39
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
edm::Guid::operator<
bool operator<(Guid const &g) const
Smaller operator.
Definition: Guid.cc:51
edm::Guid::Guid
Guid()
Standard constructor (With initializaton)
Definition: Guid.h:29
g
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
edm::Guid::data_
uuid_t data_
Definition: Guid.h:68
edm::Guid::Guid
Guid(bool usetime)
Standard constructor (With initialization)
Definition: Guid.h:31