BDE 4.14.0 Production release
|
#include <bdlb_guid.h>
Public Types | |
enum | { k_GUID_NUM_BYTES = 16 } |
enum | { k_GUID_NUM_32BITS = 4 } |
enum | { k_GUID_NUM_CHARS = 36 } |
Public Member Functions | |
Guid () | |
~Guid ()=default | |
Destroy this object. | |
Guid (const unsigned char(&buffer)[k_GUID_NUM_BYTES]) | |
Guid (unsigned long timeLow, unsigned short timeMid, unsigned short timeHiAndVersion, unsigned char clockSeqHiRes, unsigned char clockSeqLow, bsls::Types::Uint64 node) | |
Guid (const Guid &original)=default | |
Guid & | operator= (const Guid &rhs)=default |
Guid & | operator= (const unsigned char(&buffer)[k_GUID_NUM_BYTES]) |
Guid & | operator= (const bsl::uint32_t(&buffer)[k_GUID_NUM_32BITS]) |
const unsigned char & | operator[] (bsl::size_t offset) const |
const unsigned char * | begin () const |
const unsigned char * | data () const |
const unsigned char * | end () const |
unsigned char | clockSeqHi () const |
unsigned char | clockSeqHiRes () const |
unsigned char | clockSeqLow () const |
bsls::Types::Uint64 | node () const |
unsigned short | timeHi () const |
unsigned short | timeHiAndVersion () const |
unsigned long | timeLow () const |
unsigned short | timeMid () const |
unsigned char | variant () const |
unsigned char | version () const |
void | format (bsl::span< char, k_GUID_NUM_CHARS > buffer) const |
bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
Friends | |
bool | operator== (const Guid &lhs, const Guid &rhs) |
bool | operator!= (const Guid &lhs, const Guid &rhs) |
This class implements a value-semantic Guid
type. Each object represents an unconstrained Guid
object, but its uniqueness is not guaranteed, and this component provides no ability to generate a GUID.
This class provides a constructor and several accessors with names and parameters phrased using RFC 4122 field names. These names are used (by RFC 4122 and this component) as designators for parts of the GUID even when those names do not accurately describe the parts (for example, time low
names bytes 0-3 of the GUID regardless of whether the values of those bytes come from a clock or are generated randomly).
See bdlb_guid
|
inline |
Construct a zero-initialized guid object. Note that a zero- initialized guid object is not a GUID according to RFC 4122.
|
default |
|
inlineexplicit |
Construct a guid object with the internal buffer set equal to the specified buffer
with the first byte representing the most significant byte. Note that this method does guarantee that the created guid object is a GUID.
|
inline |
Construct a guid object with an internal buffer composed from the specified timeLow
, timeMid
, timeHiAndVersion
, clockSeqHiRes
, clockSeqLow
, and node
as specified by RFC 4122. Note that only the least significant 48 bits of node
are used in constructing the guid.
|
default |
Construct a guid object having the same value as the specified 'original' object.
|
inline |
|
inline |
Return the 5-bit value of the clk_seq_hi_res
field of this guid as specified in RFC 4122, excluding the variant bits.
|
inline |
Return the 8-bit clk_seq_hi_res
field of this guid as specified in RFC 4122.
|
inline |
Return the 8-bit clk_seq_low
field of this guid as specified in RFC 4122.
|
inline |
Return a pointer offering unmodifiable access to the most significant byte of this guid object.
|
inline |
Return a pointer one past the end of the least significant byte of this guid object.
void bdlb::Guid::format | ( | bsl::span< char, k_GUID_NUM_CHARS > | buffer | ) | const |
Write the value of this object to the specified output buffer
in a human-readable format. Note that this human-readable format is not fully specified, and can change without notice (as can k_GUID_NUM_CHARS
). No trailing null terminator is written.
|
inline |
Return the 48-bit node
field of this guid as specified in RFC
|
inline |
Assign to the buffer of this guid the byte sequence in the specified buffer
. Note that buffer
is treated as purely a sequence of bytes, and no account is taken of endianness.
Assign to this guid object the value of the specified 'rhs' and return a reference to this modifiable object.
|
inline |
Assign to the buffer of this guid the byte sequence in the specified buffer
.
|
inline |
Return a reference offering unmodifiable access to the byte at the specified offset
from the most significant byte of this guid object. The behavior is undefined unless 0 <= offset < k_GUID_NUM_BYTES
.
bsl::ostream & bdlb::Guid::print | ( | bsl::ostream & | stream, |
int | level = 0 , |
||
int | spacesPerLevel = 4 |
||
) | const |
Write the value of this object to the specified output stream
in a human-readable format, and return a reference to stream
. Optionally specify an initial indentation level
, whose absolute value is incremented recursively for nested objects. If level
is specified, optionally specify spacesPerLevel
, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level
is negative, suppress indentation of the first line. If spacesPerLevel
is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level
). If stream
is not valid on entry, this operation has no effect. Note that this human-readable format is not fully specified, and can change without notice.
|
inline |
Return the 12-bit value of the time_hi_and_version
field of this guid as specified in RFC 4122, excluding the version
bits.
|
inline |
Return the 16-bit time_hi_and_version
field of this guid as specified in RFC 4122.
|
inline |
Return the 32-bit time_low
field of this guid as specified in RFC
|
inline |
Return the 16-bit time_mid
field of this guid as specified in RFC
|
inline |
Return the 3-bit variant
portion of the clk_seq_hi_res
field of this guid as specified in RFC 4122.
|
inline |
Return the four-bit version
portion of the time_hi_and_version
field of this guid as specified in RFC 4122.
Return true
if the specified lhs
and specified rhs
guid objects have different values, and false
otherwise. Two guid objects have different value if any of corresponding byte in their internal buffers differ.
Return true
if the specified lhs
and specified rhs
guid objects have the same value, and false
otherwise. Two guid objects have the same value if each corresponding byte in their internal buffers are equal.