YANE-Framework 1.1.0
Public Member Functions | Protected Attributes

yane::Utils::Uuid Class Reference

Class for generating and managing universally unique identifiers (UUID) More...

List of all members.

Public Member Functions

bool isNull () const
 Function to check if a UUID is zero.
bool operator!= (const Uuid &input) const
 Inequality comparison operator.
bool operator< (const Uuid &input) const
 Comparison operator checking if UUID is smaller than a given reference.
bool operator<= (const Uuid &input) const
 Comparison operator checking if UUID is smaller than or equal to a given reference.
Uuidoperator= (const Uuid &input)
 Set operator using a UUID.
Uuidoperator= (const unsigned char *&inputdata)
 Set operator using a 128 bit data input.
Uuidoperator= (const std::string &inputstr)
 Set operator using a UUID in string format.
bool operator== (const Uuid &input) const
 Equality comparison operator.
bool operator> (const Uuid &input) const
 Comparison operator checking if UUID is larger than a given reference.
bool operator>= (const Uuid &input) const
 Comparison operator checking if UUID is larger than or equal to a given reference.
void reset ()
 Function to generate a new UUID.
void setNull ()
 Function to set a UUID to zero (i.e. 00000000-0000-0000-0000-000000000000)
void toCharPtr (unsigned char *out) const
 Function to copy the memory array in which the UUID is stored.
std::string toString (bool uppercase=false) const
 Function to return the UUID in string format.
 Uuid (const Uuid &input)
 Copy constructor.
 Uuid (const unsigned char *inputdata)
 Copy constructor using 128 bit data input.
 Uuid ()
 Constructor.
 Uuid (std::string &inputstr)
 Copy constructor using string format.
 ~Uuid ()
 Destructor.

Protected Attributes

uuid_t data
 Pointer of a UUID if operating system is not Windows.

Detailed Description

This class allows to generate and manage identifiers which are unique. The class wraps the functions of libuuid1 (version 1.40.8-20.1) contained in the package 'e2fsprogs' or directly in 'libuuid1'. Upon installation the header package 'libuuid-devel' is required. For further information on the UUID principle see the man pages of 'uuid' or the corresponding homepage.

See also:
http://linux.die.net/man/3/uuid

Constructor & Destructor Documentation

LIB_EXPORT yane::Utils::Uuid::Uuid ( const Uuid input)

This constructor generates an instance using a specified UUID

Parameters:
inputUser specified UUID
LIB_EXPORT yane::Utils::Uuid::Uuid ( std::string &  inputstr)

This constructor generates an instance using a UUID in string format. The string must be in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx where 'x' is a hex number.

Parameters:
inputstrUser specified UUID in string format
Exceptions:
uuidFormatExceptionis thrown if the string format is not correct
LIB_EXPORT yane::Utils::Uuid::Uuid ( const unsigned char *  inputdata)

This constructor generates an instance using a 128 bit data input.

Parameters:
inputdataPointer of a 16 byte array containing the user supplied UUID

Member Function Documentation

LIB_EXPORT bool yane::Utils::Uuid::isNull ( ) const

Function to check if a UUID is zero

Returns:
true if UUID is zero
LIB_EXPORT bool yane::Utils::Uuid::operator!= ( const Uuid input) const

Inquality comparison operator

Parameters:
inputUUID the instance shall be compared with
Returns:
true if UUIDs are not identical
LIB_EXPORT bool yane::Utils::Uuid::operator< ( const Uuid input) const

Comparison operator checking if UUID is smaller than a given reference

Parameters:
inputUUID the instance shall be compared with
Returns:
true if UUIDs is smaller than a given reference
LIB_EXPORT bool yane::Utils::Uuid::operator<= ( const Uuid input) const

Comparison operator checking if UUID is smaller than or equal to a given reference

Parameters:
inputUUID the instance shall be compared with
Returns:
true if UUIDs is smaller than or equal to a given reference
LIB_EXPORT yane::Utils::Uuid & yane::Utils::Uuid::operator= ( const Uuid input)

Set operator using a UUID

Parameters:
inputUser specified UUID
Returns:
Pointer of the set UUID
LIB_EXPORT yane::Utils::Uuid & yane::Utils::Uuid::operator= ( const std::string &  inputstr)

Set operator using a UUID in string format

Parameters:
inputstrUser specified UUID in string format
Exceptions:
uuidFormatExceptionis thrown if the string format is not correct
Returns:
Pointer of the set UUID
See also:
Uuid(std::string & inputstr)
LIB_EXPORT yane::Utils::Uuid & yane::Utils::Uuid::operator= ( const unsigned char *&  inputdata)

Set operator using a 128 bit data input

Parameters:
inputdataPointer of a 16 byte array containing the user supplied UUID
Returns:
Pointer of the set UUID
See also:
Uuid(const unsigned char * inputdata)
LIB_EXPORT bool yane::Utils::Uuid::operator== ( const Uuid input) const

Equality comparison operator

Parameters:
inputUUID the instance shall be compared with
Returns:
true if UUIDs are identical
LIB_EXPORT bool yane::Utils::Uuid::operator> ( const Uuid input) const

Comparison operator checking if UUID is larger than a given reference

Parameters:
inputUUID the instance shall be compared with
Returns:
true if UUIDs is larger than a given reference
LIB_EXPORT bool yane::Utils::Uuid::operator>= ( const Uuid input) const

Comparison operator checking if UUID is larger than or equal to a given reference

Parameters:
inputUUID the instance shall be compared with
Returns:
true if UUIDs is larger than or equal to a given reference
LIB_EXPORT void yane::Utils::Uuid::toCharPtr ( unsigned char *  out) const

Function to copy the memory array in which the UUID is stored

Parameters:
outPointer of the array to which the UUID shall be copied to. The array is required to be 16 byte long.
LIB_EXPORT std::string yane::Utils::Uuid::toString ( bool  uppercase = false) const

Function to return the UUID in string format

Parameters:
uppercaseDecision variable whether hex numbers shall be displayed in large letters
Returns:
UUID in string format
See also:
Uuid(std::string & inputstr)