CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::Guid Class Reference

#include <POOLCore/Guid.h>

Public Member Functions

Guid const & fromBinary (std::string const &s)
 conversion from binary string representation More...
 
Guid const & fromString (std::string const &s)
 conversion from formatted string representation More...
 
 Guid ()
 Standard constructor (With initializaton) More...
 
 Guid (bool usetime)
 Standard constructor (With initialization) More...
 
 Guid (char const *s, bool binary=false)
 Constructor for Guid from char*. More...
 
 Guid (Guid const &c)
 Copy constructor. More...
 
 Guid (std::string const &s, bool binary=false)
 Constructor for Guid from string. More...
 
bool operator!= (Guid const &g) const
 Non-equality operator. More...
 
bool operator< (Guid const &g) const
 Smaller operator. More...
 
Guidoperator= (Guid const &g)
 Assignment operator. More...
 
bool operator== (Guid const &g) const
 Equality operator. More...
 
const std::string toBinary () const
 conversion to binary string reprentation More...
 
const std::string toString () const
 conversion to formatted string reprentation More...
 

Private Member Functions

void init (bool usetime=false)
 initialize a new Guid More...
 

Private Attributes

uuid_t data_
 

Detailed Description

Description:

Encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number). Note: This class may not have a virual destructor

Author
M.Frank Initial version using COM on WIN32
Zhen Xie Include DCE implementation for linux
Version
1.1
Date
03/09/2002

Simplified by Dan Riley for CMS to use standard libuuid functions

Definition at line 26 of file Guid.h.

Constructor & Destructor Documentation

◆ Guid() [1/5]

edm::Guid::Guid ( )
inline

Standard constructor (With initializaton)

Definition at line 29 of file Guid.h.

29 { init(); }

References init().

◆ Guid() [2/5]

edm::Guid::Guid ( bool  usetime)
inlineexplicit

Standard constructor (With initialization)

Definition at line 31 of file Guid.h.

31 { init(usetime); }

References init().

◆ Guid() [3/5]

edm::Guid::Guid ( char const *  s,
bool  binary = false 
)
inlineexplicit

Constructor for Guid from char*.

Definition at line 33 of file Guid.h.

33 { binary ? fromBinary(s) : fromString(s); }

References fromBinary(), fromString(), and alignCSCRings::s.

◆ Guid() [4/5]

edm::Guid::Guid ( std::string const &  s,
bool  binary = false 
)
inlineexplicit

Constructor for Guid from string.

Definition at line 35 of file Guid.h.

35 { binary ? fromBinary(s) : fromString(s); }

References fromBinary(), fromString(), and alignCSCRings::s.

◆ Guid() [5/5]

edm::Guid::Guid ( Guid const &  c)
inline

Copy constructor.

Definition at line 37 of file Guid.h.

37 { *this = c; }

References c.

Member Function Documentation

◆ fromBinary()

Guid const & edm::Guid::fromBinary ( std::string const &  s)

conversion from binary string representation

Definition at line 32 of file Guid.cc.

32  {
33  assert(source.size() == sizeof(data_));
34  std::memcpy(data_, source.data(), sizeof(data_));
35  return *this;
36  }

References cms::cuda::assert(), data_, and edm::source().

Referenced by Guid().

◆ fromString()

Guid const & edm::Guid::fromString ( std::string const &  s)

conversion from formatted string representation

Definition at line 45 of file Guid.cc.

45  {
46  auto err = ::uuid_parse(source.c_str(), data_);
47  assert(err == 0);
48  return *this;
49  }

References cms::cuda::assert(), data_, submitPVResolutionJobs::err, and edm::source().

Referenced by Guid().

◆ init()

void edm::Guid::init ( bool  usetime = false)
private

initialize a new Guid

Initialize a new Guid.

Definition at line 18 of file Guid.cc.

18  {
19  if (usetime) {
20  ::uuid_generate_time(data_);
21  } else {
22  // uuid_generate() defaults to uuid_generate_random() if /dev/urandom
23  // is available; if /dev/urandom is not available, then it is better
24  // to let uuid_generate() choose the best fallback rather than forcing
25  // use of an inferior source of randomness
26  ::uuid_generate(data_);
27  }
28  }

References data_.

Referenced by Guid().

◆ operator!=()

bool edm::Guid::operator!= ( Guid const &  g) const
inline

Non-equality operator.

Definition at line 55 of file Guid.h.

55 { return !(this->operator==(g)); }

References operator==().

◆ operator<()

bool edm::Guid::operator< ( Guid const &  g) const

Smaller operator.

Definition at line 51 of file Guid.cc.

51 { return ::uuid_compare(data_, g.data_) < 0; }

References data_, and g.

◆ operator=()

Guid& edm::Guid::operator= ( Guid const &  g)
inline

Assignment operator.

Definition at line 39 of file Guid.h.

39  {
40  if (this != &g) {
41  ::uuid_copy(data_, g.data_);
42  }
43  return *this;
44  }

References data_, and g.

◆ operator==()

bool edm::Guid::operator== ( Guid const &  g) const
inline

Equality operator.

Definition at line 48 of file Guid.h.

48  {
49  if (this != &g) {
50  return ::uuid_compare(data_, g.data_) == 0;
51  }
52  return true;
53  }

References data_, and g.

Referenced by operator!=().

◆ toBinary()

const std::string edm::Guid::toBinary ( ) const

conversion to binary string reprentation

Definition at line 30 of file Guid.cc.

30 { return std::string(reinterpret_cast<const char*>(data_), sizeof(data_)); }

References data_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::createGlobalIdentifier().

◆ toString()

const std::string edm::Guid::toString ( ) const

conversion to formatted string reprentation

Definition at line 38 of file Guid.cc.

38  {
39  char out[UUID_STR_LEN];
40  ::uuid_unparse(data_, out);
41  return std::string(out);
42  }

References data_, MillePedeFileConverter_cfg::out, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edm::createGlobalIdentifier().

Member Data Documentation

◆ data_

uuid_t edm::Guid::data_
private

Definition at line 68 of file Guid.h.

Referenced by fromBinary(), fromString(), init(), operator<(), operator=(), operator==(), toBinary(), and toString().

edm::source
static const std::string source("source")
edm::Guid::fromBinary
Guid const & fromBinary(std::string const &s)
conversion from binary string representation
Definition: Guid.cc:32
cms::cuda::assert
assert(be >=bs)
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
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
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