RSC  0.17.1
rsc::misc::UUID Class Reference

Encapsulates the generation and handling of UUIDs. More...

#include <UUID.h>

Collaboration diagram for rsc::misc::UUID:
Collaboration graph

Public Member Functions

 UUID (const bool &random=true)
 Creates a new UUID object that is either random or the nil UUID. More...
 
 UUID (const std::string &uuid)
 Parses a UUID from a string. More...
 
 UUID (const char *uuid)
 Parses a UUID from a string. More...
 
 UUID (boost::uint8_t *data)
 Generates a uuid from the given 16 byte representation. More...
 
 UUID (const UUID &ns, const std::string &name)
 Generates a uuid for name in namespace ns. More...
 
virtual ~UUID ()
 
boost::uuids::uuid getId () const
 Returns the contained UUID on boost format. More...
 
std::string getIdAsString () const
 Returns a string representing the UUID. More...
 
bool operator== (const UUID &other) const
 
bool operator!= (const UUID &other) const
 
bool operator< (const UUID &other) const
 

Private Attributes

boost::uuids::uuid id
 

Static Private Attributes

static boost::uuids::nil_generator nilGen
 
static boost::uuids::basic_random_generator< boost::mt19937 > randomGen
 

Friends

RSC_EXPORT std::ostream & operator<< (std::ostream &stream, const UUID &id)
 

Detailed Description

Encapsulates the generation and handling of UUIDs.

Author
swrede

Definition at line 46 of file UUID.h.

Constructor & Destructor Documentation

rsc::misc::UUID::UUID ( const bool &  random = true)
explicit

Creates a new UUID object that is either random or the nil UUID.

Parameters
randomIf true, a random UUID is created. Otherwise the nil UUID is created.

Definition at line 44 of file UUID.cpp.

References randomGen.

rsc::misc::UUID::UUID ( const std::string &  uuid)
explicit

Parses a UUID from a string.

Various default formats are accepted.

Parameters
uuidA string representation of the desired UUID.
Exceptions
std::runtime_errorgiven string is not acceptable as a UUID

Definition at line 51 of file UUID.cpp.

rsc::misc::UUID::UUID ( const char *  uuid)
explicit

Parses a UUID from a string.

Various default formats are accepted.

Parameters
uuidA string representation of the desired UUID.
Exceptions
std::runtime_errorgiven string is not acceptable as a UUID

Definition at line 58 of file UUID.cpp.

rsc::misc::UUID::UUID ( boost::uint8_t *  data)
explicit

Generates a uuid from the given 16 byte representation.

Parameters
data16 byte representation of a uuid

Definition at line 65 of file UUID.cpp.

rsc::misc::UUID::UUID ( const UUID ns,
const std::string &  name 
)

Generates a uuid for name in namespace ns.

Parameters
nsNamespace in which name should be placed.
nameA unique name within namespace ns.

Definition at line 69 of file UUID.cpp.

rsc::misc::UUID::~UUID ( )
virtual

Definition at line 73 of file UUID.cpp.

Member Function Documentation

boost::uuids::uuid rsc::misc::UUID::getId ( ) const

Returns the contained UUID on boost format.

Returns
uuid in boost format.

Definition at line 76 of file UUID.cpp.

References id.

string rsc::misc::UUID::getIdAsString ( ) const

Returns a string representing the UUID.

Returns
string representation of the UUID

Definition at line 80 of file UUID.cpp.

References id.

bool rsc::misc::UUID::operator!= ( const UUID other) const

Definition at line 90 of file UUID.cpp.

References operator==().

Here is the call graph for this function:

bool rsc::misc::UUID::operator< ( const UUID other) const

Definition at line 94 of file UUID.cpp.

References id.

bool rsc::misc::UUID::operator== ( const UUID other) const

Definition at line 86 of file UUID.cpp.

Referenced by operator!=().

Here is the caller graph for this function:

Friends And Related Function Documentation

RSC_EXPORT std::ostream& operator<< ( std::ostream &  stream,
const UUID id 
)
friend

Definition at line 98 of file UUID.cpp.

Member Data Documentation

boost::uuids::uuid rsc::misc::UUID::id
private

Definition at line 117 of file UUID.h.

Referenced by getId(), getIdAsString(), and operator<().

boost::uuids::nil_generator rsc::misc::UUID::nilGen
staticprivate
Initial value:
=
boost::uuids::nil_generator()

Definition at line 119 of file UUID.h.

boost::uuids::basic_random_generator< boost::mt19937 > rsc::misc::UUID::randomGen
staticprivate
Initial value:
=
boost::uuids::basic_random_generator<boost::mt19937>()

Definition at line 120 of file UUID.h.

Referenced by UUID().


The documentation for this class was generated from the following files: