MySQL 9.1.0
Source Code Documentation
mysql::gtid::Uuid Struct Reference

Uuid is a trivial and of standard layout The structure contains the following components. More...

#include <uuid.h>

Public Member Functions

void clear ()
 Set to all zeros. More...
 
void copy_from (const unsigned char *data)
 Copies the given 16-byte data to this UUID. More...
 
void copy_to (unsigned char *data) const
 Copies the given UUID object to this UUID. More...
 
bool equals (const Uuid &other) const
 Returns true if this UUID is equal the given UUID. More...
 
bool operator< (const Uuid &other) const
 
int parse (const char *string, size_t len)
 Stores the UUID represented by a string of the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX or {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} in this object. More...
 
size_t to_string (char *buf) const
 Generates a 36+1 character long representation of this UUID object in the given string buffer. More...
 
std::string to_string () const
 
void print () const
 

Static Public Member Functions

static bool is_valid (const char *string, size_t len)
 Returns true if parse() would succeed, but doesn't store the result. More...
 
static int parse (const char *in_string, size_t len, const unsigned char *out_binary_string)
 Parses the UUID passed as argument in in_string and functions and writes the binary representation in out_binary_string. More...
 
static bool read_section (int section_len, const char **section_str, const unsigned char **out_binary_str)
 Helper method used to validate and parse one section of a uuid. More...
 
static size_t to_string (const unsigned char *bytes_arg, char *buf)
 Convert the given binary buffer to a UUID. More...
 

Public Attributes

std::array< unsigned char, BYTE_LENGTHbytes
 The data for this Uuid. More...
 

Static Public Attributes

static constexpr std::size_t BYTE_LENGTH = 16
 The number of bytes in the data of a Uuid. More...
 
static const size_t TEXT_LENGTH = 36
 The number of bytes in the textual representation of a Uuid. More...
 
static const size_t BIT_LENGTH = 128
 The number of bits in the data of a Uuid. More...
 
static const int NUMBER_OF_SECTIONS = 5
 
static constexpr int bytes_per_section [NUMBER_OF_SECTIONS] = {4, 2, 2, 2, 6}
 
static constexpr int hex_to_byte [256]
 

Detailed Description

Uuid is a trivial and of standard layout The structure contains the following components.

Structure gtid_info
Name Format Description
byte unsigned char array This stores the Uuid of the server on which transaction is originated

Member Function Documentation

◆ clear()

void mysql::gtid::Uuid::clear ( )
inline

Set to all zeros.

◆ copy_from()

void mysql::gtid::Uuid::copy_from ( const unsigned char *  data)
inline

Copies the given 16-byte data to this UUID.

◆ copy_to()

void mysql::gtid::Uuid::copy_to ( unsigned char *  data) const
inline

Copies the given UUID object to this UUID.

◆ equals()

bool mysql::gtid::Uuid::equals ( const Uuid other) const
inline

Returns true if this UUID is equal the given UUID.

◆ is_valid()

bool mysql::gtid::Uuid::is_valid ( const char *  string,
size_t  len 
)
static

Returns true if parse() would succeed, but doesn't store the result.

Parameters
stringString that needs to be checked.
lenLength of that string.
Return values
truevalid string.
falseinvalid string.

◆ operator<()

bool mysql::gtid::Uuid::operator< ( const Uuid other) const
inline

◆ parse() [1/2]

int mysql::gtid::Uuid::parse ( const char *  in_string,
size_t  len,
const unsigned char *  out_binary_string 
)
static

Parses the UUID passed as argument in in_string and functions and writes the binary representation in out_binary_string.

Depends on UUID's read_section method and the constants for text length.

Parameters
[in]in_stringString to be parsed.
[in]lenLength of that string.
[out]out_binary_stringString where the binary UUID will be stored
Return values
0success.
>0failure.

◆ parse() [2/2]

int mysql::gtid::Uuid::parse ( const char *  string,
size_t  len 
)

Stores the UUID represented by a string of the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX or {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} in this object.

Parameters
stringString to be parsed and stored.
lenLength of that string.
Return values
0success.
>0failure.

◆ print()

void mysql::gtid::Uuid::print ( ) const
inline

◆ read_section()

bool mysql::gtid::Uuid::read_section ( int  section_len,
const char **  section_str,
const unsigned char **  out_binary_str 
)
static

Helper method used to validate and parse one section of a uuid.

If the last parameter, out_binary_str, is NULL then the function will just validate the section.

Parameters
[in]section_lenLength of the section to be parsed.
[in,out]section_strPointer to a string containing the section. It will be updated during the execution as the string is parsed.
[out]out_binary_strString where the section will be stored in binary format. If null, the function will just validate the input string.
Return values
falsesuccess.
truefailure.

◆ to_string() [1/3]

std::string mysql::gtid::Uuid::to_string ( ) const
inline

◆ to_string() [2/3]

size_t mysql::gtid::Uuid::to_string ( char *  buf) const

Generates a 36+1 character long representation of this UUID object in the given string buffer.

Return values
36- the length of the resulting string.

◆ to_string() [3/3]

size_t mysql::gtid::Uuid::to_string ( const unsigned char *  bytes_arg,
char *  buf 
)
static

Convert the given binary buffer to a UUID.

Member Data Documentation

◆ BIT_LENGTH

const size_t mysql::gtid::Uuid::BIT_LENGTH = 128
static

The number of bits in the data of a Uuid.

◆ BYTE_LENGTH

constexpr std::size_t mysql::gtid::Uuid::BYTE_LENGTH = 16
staticconstexpr

The number of bytes in the data of a Uuid.

◆ bytes

std::array<unsigned char, BYTE_LENGTH> mysql::gtid::Uuid::bytes

The data for this Uuid.

◆ bytes_per_section

constexpr int mysql::gtid::Uuid::bytes_per_section[NUMBER_OF_SECTIONS] = {4, 2, 2, 2, 6}
staticconstexpr

◆ hex_to_byte

constexpr int mysql::gtid::Uuid::hex_to_byte[256]
staticconstexpr
Initial value:
= {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5,
6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1,
}

◆ NUMBER_OF_SECTIONS

const int mysql::gtid::Uuid::NUMBER_OF_SECTIONS = 5
static

◆ TEXT_LENGTH

const size_t mysql::gtid::Uuid::TEXT_LENGTH = 36
static

The number of bytes in the textual representation of a Uuid.


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