UUID generator and parser.
More...
#include <uuid.hpp>
UUID generator and parser.
See RFC 4122 for more details (http://www.ietf.org/rfc/rfc4122.txt)
This class needs anch-crypto and anch-device libraries.
- Since
- 0.1
- Author
- Vincent Lachenal
◆ Version
The UUID versions
- Since
- 0.1
- Author
- Vincent Lachenal
Enumerator |
---|
MAC_ADDRESS | MAC address based algorithm
|
DCE_SECURITY | DCE security (Windows) base algorithm
|
MD5_HASH | MD5 hash based algorithm
|
RANDOM | Random based algorithm
|
SHA1_HASH | SHA1 hash based algorithm
|
◆ UUID() [1/4]
◆ UUID() [2/4]
anch::UUID::UUID |
( |
const UUID & | uuid | ) |
|
UUID copy constructor
- Parameters
-
◆ UUID() [3/4]
anch::UUID::UUID |
( |
const std::string & | uuid | ) |
|
UUID from std::string constructor
- Parameters
-
uuid | the std::string to parse |
- Exceptions
-
std::out_of_range | invalid UUID length |
std::invalid_argument | invalid UUID subpart |
◆ UUID() [4/4]
anch::UUID::UUID |
( |
uint32_t | lowTime, |
|
|
uint16_t | midTime, |
|
|
uint16_t | highTime, |
|
|
uint16_t | clockSeqLow, |
|
|
uint16_t | clockSeqHighRes, |
|
|
uint64_t | node, |
|
|
UUID::Version | version ) |
UUID constructor
- Parameters
-
lowTime | the low time part |
midTime | the mid time part |
highTime | the high time part |
clockSeqLow | the clock sequence low part |
clockSeqHighRes | the clock sequence high resolution part |
node | the node part |
version | the UUID version |
◆ ~UUID()
virtual anch::UUID::~UUID |
( |
| ) |
|
|
virtual |
◆ generateUUID()
Generate a new UUID
- Parameters
-
version | The UUID algorithm version to use (default to MAC based algorithm) |
data | The data to process (used to SHA1 and MD5 algorithms) |
- Returns
- the new UUID
- Exceptions
-
std::runtime_error | no provider for specified UUID version |
◆ getClockSeqHighRes()
uint16_t anch::UUID::getClockSeqHighRes |
( |
| ) |
const |
The clock sequence high value and reserved value getter
- Returns
- The clock sequence high value and reserved value
◆ getClockSeqLow()
uint16_t anch::UUID::getClockSeqLow |
( |
| ) |
const |
The clock sequence low value getter
- Returns
- The clock sequence low value
◆ getDistSeq()
static std::uniform_int_distribution< uint16_t > & anch::UUID::getDistSeq |
( |
| ) |
|
|
static |
Distribution sequence getter
- Returns
- the distribution sequence
◆ getHighTime()
uint16_t anch::UUID::getHighTime |
( |
| ) |
const |
The timestamp high value getter
- Returns
- The timestamp high value
◆ getLowTime()
uint32_t anch::UUID::getLowTime |
( |
| ) |
const |
The timestamp low value getter
- Returns
- The timestamp low value
◆ getMidTime()
uint16_t anch::UUID::getMidTime |
( |
| ) |
const |
The timestamp mid value getter
- Returns
- The timestamp mid value
◆ getNode()
uint64_t anch::UUID::getNode |
( |
| ) |
const |
The node getter
- Returns
- The node
◆ getRandomEngine()
static std::random_device & anch::UUID::getRandomEngine |
( |
| ) |
|
|
static |
Random engine getter
- Returns
- the random engine
◆ getUtcTimestamp()
static uint64_t anch::UUID::getUtcTimestamp |
( |
| ) |
|
|
static |
Get UTC timestamp
- Returns
- The UTC timestamp
◆ getVersion()
◆ operator std::string()
anch::UUID::operator std::string |
( |
| ) |
const |
|
explicit |
◆ random()
static UUID anch::UUID::random |
( |
| ) |
|
|
static |
Generate a new UUID with version 4 (random) algorithm
- Returns
- the new UUID
◆ registerProvider()
static void anch::UUID::registerProvider |
( |
UUID::Version | version, |
|
|
std::function< UUID(const std::string &)> | provider ) |
|
static |
Register UUID provider
- Parameters
-
version | the UUID version which can be handled by provider |
provider | the provider |
◆ toString()
std::string anch::UUID::toString |
( |
| ) |
const |
Convert UUID to std::string
- Returns
- The string representation of UUID
◆ SEQ_HIGH_MASK
const uint32_t anch::UUID::SEQ_HIGH_MASK = 0x3F00 |
|
static |
Sequence high part time mask
◆ SEQ_LOW_MASK
const uint32_t anch::UUID::SEQ_LOW_MASK = 0x00FF |
|
static |
Sequence low part time mask
◆ TIME_HIGH_MASK
const uint64_t anch::UUID::TIME_HIGH_MASK = 0x0000000000000FFF |
|
static |
◆ TIME_LOW_MASK
const uint64_t anch::UUID::TIME_LOW_MASK = 0x00000000FFFFFFFF |
|
static |
◆ TIME_MID_MASK
const uint64_t anch::UUID::TIME_MID_MASK = 0x000000000000FFFF |
|
static |
Time middle part time mask
◆ VERSION_MASK
const uint64_t anch::UUID::VERSION_MASK = 0x000000000000F000 |
|
static |
The documentation for this class was generated from the following file: