SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
smtk::common::UUID Class Reference

Public Types

enum  { SIZE = 16 }
 
typedef ::boost::uint8_t value_type
 
typedef ::boost::uint8_t * iterator
 
typedef ::boost::uint8_t const * const_iterator
 
typedef std::size_t size_type
 

Public Member Functions

 UUID ()
 Default constructor creates a nil UUID (IsNull() == true).
 
 UUID (const UUID &other)
 Copy constructor.
 
 UUID (const_iterator begin, const_iterator end)
 Construct a UUID from raw bytes (more than twice as efficient as string conversion).
 
 UUID (const std::string &txt)
 Construct a UUID from a text string (36 characters long, including hyphens). More...
 
 UUID (const boost::uuids::uuid &data)
 Construct a UUID from a boost UUID object.
 
bool isNull () const
 Test whether a UUID is nil (i.e., all zeros) or not. The nil UUID usually indicates an invalid UUID.
 
iterator begin ()
 Return an iterator to the start of a UUID's raw data. More...
 
const_iterator begin () const
 
iterator end ()
 Return an iterator to the end of a UUID's raw data. More...
 
const_iterator end () const
 
std::string toString () const
 Convert the UUID to a string.
 
bool operator!= (UUID const &other) const
 Compare two UUIDs for inequality.
 
bool operator== (UUID const &other) const
 Compare two UUIDs for equality.
 
bool operator< (UUID const &other) const
 Compare two UUIDs for ordering.
 
UUIDoperator= (UUID const &other)
 Assignment operator.
 
 operator bool () const
 Cast-to-boolean operator.
 
std::size_t hash () const
 Return a hash of a UUID.
 

Static Public Member Functions

static UUID random ()
 Generate a random UUID (RFC4122, version 4) More...
 
static UUID null ()
 Generate a nil UUID.
 
static size_type size ()
 

Static Public Attributes

static constexpr const char *const type_name = "uuid"
 

Protected Attributes

boost::uuids::uuid m_data
 

Constructor & Destructor Documentation

◆ UUID()

smtk::common::UUID::UUID ( const std::string &  txt)

Construct a UUID from a text string (36 characters long, including hyphens).

The UUID stays in its default state of nil if the input string is empty.

Member Function Documentation

◆ begin()

UUID::const_iterator smtk::common::UUID::begin ( )

Return an iterator to the start of a UUID's raw data.

Return a constant iterator to the start of a UUID's raw data.

◆ end()

UUID::const_iterator smtk::common::UUID::end ( )

Return an iterator to the end of a UUID's raw data.

Return a constant iterator to the end of a UUID's raw data.

◆ random()

UUID smtk::common::UUID::random ( )
static

Generate a random UUID (RFC4122, version 4)

This uses a thread-local UUIDGenerator instance to avoid reinitializing a random-number generator each call.


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