Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Public Attributes | List of all members
vl::UUID Class Reference

Simple implementation of a 16 bytes Universally Unique ID based on http://www.ietf.org/rfc/rfc4122.txt. More...

#include <UUID.hpp>

Public Member Functions

 UUID ()
 Constructor, by default it is set to all zeros. More...
 
void generateVersion4 (const Random &random)
 Generates a Version 4 UUID as defined by RFC4122 using the specified random number generator. More...
 
bool fromString (const char *guid_str)
 Init the UUID from the specified string which must be at least 38 characters long and must be of the form {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. More...
 
void fillString (char *guid_str, bool zero_terminate=true) const
 Fills a buffer with an ascii representation of the UUID of type {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. More...
 
void toStdString (std::string &guid_str) const
 Fills the given std::string with an ASCII representation of the UUID of type {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. More...
 
std::string toStdString () const
 Returns an std::string jwith an ASCII representation of the UUID of type {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. More...
 
bool operator== (const UUID &other) const
 
bool operator!= (const UUID &other) const
 
bool operator< (const UUID &other) const
 

Public Attributes

unsigned int mTimeLow
 
unsigned short mTimeMid
 
unsigned short mTimeHiAndVersion
 
unsigned char mClockSeqHiAndReserved
 
unsigned char mClockSeqLow
 
unsigned char mNode [6]
 

Detailed Description

Simple implementation of a 16 bytes Universally Unique ID based on http://www.ietf.org/rfc/rfc4122.txt.

Definition at line 44 of file UUID.hpp.

Constructor & Destructor Documentation

◆ UUID()

UUID::UUID ( )

Constructor, by default it is set to all zeros.

Definition at line 40 of file UUID.cpp.

Member Function Documentation

◆ fillString()

void UUID::fillString ( char *  guid_str,
bool  zero_terminate = true 
) const

Fills a buffer with an ascii representation of the UUID of type {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.

Parameters
guid_strmust point to a buffer of at least 38 byes; if zero_terminate is true (default) then it must be at least 39 bytes large.
zero_terminateif true the function inserts a trailing 0 at the end of the string, in this case guid_str must point to a buffer 39 bytes large at least.

Definition at line 68 of file UUID.cpp.

References mClockSeqHiAndReserved, mClockSeqLow, mNode, mTimeHiAndVersion, mTimeLow, mTimeMid, and VL_CHECK.

Referenced by toStdString().

◆ fromString()

bool UUID::fromString ( const char *  guid_str)

Init the UUID from the specified string which must be at least 38 characters long and must be of the form {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.

Definition at line 137 of file UUID.cpp.

References mClockSeqHiAndReserved, mClockSeqLow, mNode, mTimeHiAndVersion, mTimeLow, and mTimeMid.

◆ generateVersion4()

void UUID::generateVersion4 ( const Random random)

Generates a Version 4 UUID as defined by RFC4122 using the specified random number generator.

Definition at line 45 of file UUID.cpp.

References vl::Random::fillRandom(), mClockSeqHiAndReserved, and mTimeHiAndVersion.

◆ operator!=()

bool vl::UUID::operator!= ( const UUID other) const
inline

Definition at line 72 of file UUID.hpp.

◆ operator<()

bool vl::UUID::operator< ( const UUID other) const
inline

Definition at line 77 of file UUID.hpp.

◆ operator==()

bool vl::UUID::operator== ( const UUID other) const
inline

Definition at line 67 of file UUID.hpp.

◆ toStdString() [1/2]

void UUID::toStdString ( std::string &  guid_str) const

Fills the given std::string with an ASCII representation of the UUID of type {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.

Definition at line 58 of file UUID.cpp.

References fillString().

◆ toStdString() [2/2]

std::string UUID::toStdString ( ) const

Returns an std::string jwith an ASCII representation of the UUID of type {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.

Definition at line 130 of file UUID.cpp.

Member Data Documentation

◆ mClockSeqHiAndReserved

unsigned char vl::UUID::mClockSeqHiAndReserved

Definition at line 86 of file UUID.hpp.

Referenced by fillString(), fromString(), and generateVersion4().

◆ mClockSeqLow

unsigned char vl::UUID::mClockSeqLow

Definition at line 87 of file UUID.hpp.

Referenced by fillString(), and fromString().

◆ mNode

unsigned char vl::UUID::mNode[6]

Definition at line 88 of file UUID.hpp.

Referenced by fillString(), and fromString().

◆ mTimeHiAndVersion

unsigned short vl::UUID::mTimeHiAndVersion

Definition at line 85 of file UUID.hpp.

Referenced by fillString(), fromString(), and generateVersion4().

◆ mTimeLow

unsigned int vl::UUID::mTimeLow

Definition at line 83 of file UUID.hpp.

Referenced by fillString(), and fromString().

◆ mTimeMid

unsigned short vl::UUID::mTimeMid

Definition at line 84 of file UUID.hpp.

Referenced by fillString(), and fromString().


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