8#ifndef INCLUDED_BDLB_GUID
9#define INCLUDED_BDLB_GUID
13#include <bdlscm_version.h>
176#include <bsl_algorithm.h>
177#include <bsl_cstddef.h>
178#include <bsl_cstdint.h>
179#include <bsl_cstring.h>
180#include <bsl_iosfwd.h>
229 unsigned char *modifiableData();
284 const unsigned char&
operator[](bsl::size_t offset)
const;
286 const unsigned char *
begin()
const;
290 const unsigned char *
data()
const;
294 const unsigned char *
end()
const;
316 unsigned short timeHi()
const;
328 unsigned short timeMid()
const;
359 bsl::ostream&
print(bsl::ostream& stream,
361 int spacesPerLevel = 4)
const;
414template <
class HASH_ALGORITHM>
442 unsigned short timeMid,
443 unsigned short timeHiAndVersion,
444 unsigned char clockSeqHiRes,
445 unsigned char clockSeqLow,
448 typedef unsigned char uc;
450 modifiableData()[ 0] = uc(
timeLow >> 24);
451 modifiableData()[ 1] = uc(
timeLow >> 16);
452 modifiableData()[ 2] = uc(
timeLow >> 8);
453 modifiableData()[ 3] = uc(
timeLow);
455 modifiableData()[ 4] = uc(
timeMid >> 8);
456 modifiableData()[ 5] = uc(
timeMid);
465 modifiableData()[10] = uc(
node >> 40);
466 modifiableData()[11] = uc(
node >> 32);
467 modifiableData()[12] = uc(
node >> 24);
468 modifiableData()[13] = uc(
node >> 16);
469 modifiableData()[14] = uc(
node >> 8);
470 modifiableData()[15] = uc(
node);
475unsigned char *Guid::modifiableData()
477 return reinterpret_cast<unsigned char *
>(d_alignedBuffer.buffer());
493 BSLMF_ASSERT(
sizeof(d_alignedBuffer) >=
sizeof(uint32_t) *
505 return data()[offset];
517 return reinterpret_cast<const unsigned char *
>(d_alignedBuffer.buffer());
566 typedef unsigned short us;
567 return us(
data()[6] << 8 |
573 typedef unsigned long ul;
574 return ul(
data()[0]) << 24 |
582 typedef unsigned short us;
583 return us(
data()[4] << 8 |
589 typedef unsigned char uc;
595 typedef unsigned char uc;
605 return guid.
print(stream, 0, -1);
622template <
class HASH_ALGORITHM>
625 hashAlgorithm(guid.data(), Guid::k_GUID_NUM_BYTES);
#define BSLMF_NESTED_TRAIT_DECLARATION(t_TYPE, t_TRAIT)
Definition bslmf_nestedtraitdeclaration.h:231
Definition bdlb_guid.h:201
const unsigned char * data() const
Definition bdlb_guid.h:515
unsigned short timeMid() const
Definition bdlb_guid.h:581
unsigned char clockSeqHiRes() const
Definition bdlb_guid.h:535
@ k_GUID_NUM_BYTES
Definition bdlb_guid.h:205
const unsigned char * begin() const
Definition bdlb_guid.h:509
Guid()
Definition bdlb_guid.h:426
@ k_GUID_NUM_32BITS
Definition bdlb_guid.h:206
void format(bsl::span< char, k_GUID_NUM_CHARS > buffer) const
Guid & operator=(const Guid &rhs)=default
unsigned short timeHiAndVersion() const
Definition bdlb_guid.h:564
friend bool operator!=(const Guid &lhs, const Guid &rhs)
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
unsigned char clockSeqHi() const
Definition bdlb_guid.h:529
friend bool operator==(const Guid &lhs, const Guid &rhs)
unsigned char clockSeqLow() const
Definition bdlb_guid.h:541
unsigned char variant() const
Definition bdlb_guid.h:588
unsigned long timeLow() const
Definition bdlb_guid.h:572
Guid(const Guid &original)=default
unsigned char version() const
Definition bdlb_guid.h:594
const unsigned char & operator[](bsl::size_t offset) const
Definition bdlb_guid.h:502
const unsigned char * end() const
Definition bdlb_guid.h:521
bsls::Types::Uint64 node() const
Definition bdlb_guid.h:547
unsigned short timeHi() const
Definition bdlb_guid.h:558
~Guid()=default
Destroy this object.
@ k_GUID_NUM_CHARS
Definition bdlb_guid.h:207
Definition bslstl_span.h:334
Definition bsls_alignedbuffer.h:261
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlb_algorithmworkaroundutil.h:74
bool operator!=(const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
bsl::ostream & operator<<(bsl::ostream &stream, const BigEndianInt16 &integer)
bool operator>=(const Guid &lhs, const Guid &rhs)
void hashAppend(HASH_ALGORITHM &hashAlgorithm, const BigEndianInt16 &object)
bool operator<=(const Guid &lhs, const Guid &rhs)
bool operator==(const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
Definition bslmf_istriviallycopyable.h:329
Definition bslmf_isbitwiseequalitycomparable.h:499
Definition bsls_alignmentfromtype.h:376
unsigned long long Uint64
Definition bsls_types.h:137