OmniSciDB  dfae7c3b14
omnisci::UUID Class Reference

#include <uuid.h>

Public Member Functions

constexpr UUID () noexcept
 
 UUID (const value_type(&arr)[16]) noexcept
 
 UUID (char(&arr)[16]) noexcept
 
void swap (UUID &other) noexcept
 
constexpr value_typedata () noexcept
 
constexpr const value_typedata () const noexcept
 

Private Types

using value_type = uint8_t
 

Private Attributes

std::array< value_type, 16 > data_
 

Friends

std::ostream & operator<< (std::ostream &s, const UUID &id)
 
bool operator== (const UUID &lhs, const UUID &rhs) noexcept
 
bool operator< (const UUID &lhs, const UUID &rhs) noexcept
 

Detailed Description

Definition at line 35 of file uuid.h.

Member Typedef Documentation

◆ value_type

using omnisci::UUID::value_type = uint8_t
private

Definition at line 36 of file uuid.h.

Constructor & Destructor Documentation

◆ UUID() [1/3]

constexpr omnisci::UUID::UUID ( )
inlinenoexcept

Definition at line 40 of file uuid.h.

40 : data_({}) {}
std::array< value_type, 16 > data_
Definition: uuid.h:93

◆ UUID() [2/3]

omnisci::UUID::UUID ( const value_type(&)  arr[16])
inlineexplicitnoexcept

Definition at line 43 of file uuid.h.

References data_.

43  {
44  std::copy(std::cbegin(arr), std::cend(arr), std::begin(data_));
45  }
std::array< value_type, 16 > data_
Definition: uuid.h:93

◆ UUID() [3/3]

omnisci::UUID::UUID ( char(&)  arr[16])
inlineexplicitnoexcept

Definition at line 48 of file uuid.h.

References data_.

48  {
49  std::transform(
50  std::cbegin(arr), std::cend(arr), std::begin(data_), [](char c) -> value_type {
51  return static_cast<value_type>(c);
52  });
53  }
std::array< value_type, 16 > data_
Definition: uuid.h:93
uint8_t value_type
Definition: uuid.h:36

Member Function Documentation

◆ data() [1/2]

constexpr value_type* omnisci::UUID::data ( )
inlinenoexcept

Definition at line 58 of file uuid.h.

References data_.

58 { return data_.data(); }
std::array< value_type, 16 > data_
Definition: uuid.h:93

◆ data() [2/2]

constexpr const value_type* omnisci::UUID::data ( ) const
inlinenoexcept

Definition at line 59 of file uuid.h.

References data_.

59 { return data_.data(); }
std::array< value_type, 16 > data_
Definition: uuid.h:93

◆ swap()

void omnisci::UUID::swap ( UUID other)
inlinenoexcept

Definition at line 55 of file uuid.h.

References data_.

55 { data_.swap(other.data_); }
std::array< value_type, 16 > data_
Definition: uuid.h:93

Friends And Related Function Documentation

◆ operator<

bool operator< ( const UUID lhs,
const UUID rhs 
)
friend

Definition at line 107 of file uuid.h.

107  {
108  return lhs.data_ < rhs.data_;
109 }

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const UUID id 
)
friend

Definition at line 62 of file uuid.h.

62  {
63  auto fill = s.fill();
64  auto ff = s.flags();
65  s << std::hex << std::setfill('0')
66  << std::setw(2) << +id.data_[0]
67  << std::setw(2) << +id.data_[1]
68  << std::setw(2) << +id.data_[2]
69  << std::setw(2) << +id.data_[3]
70  << '-'
71  << std::setw(2) << +id.data_[4]
72  << std::setw(2) << +id.data_[5]
73  << '-'
74  << std::setw(2) << +id.data_[6]
75  << std::setw(2) << +id.data_[7]
76  << '-'
77  << std::setw(2) << +id.data_[8]
78  << std::setw(2) << +id.data_[9]
79  << '-'
80  << std::setw(2) << +id.data_[10]
81  << std::setw(2) << +id.data_[11]
82  << std::setw(2) << +id.data_[12]
83  << std::setw(2) << +id.data_[13]
84  << std::setw(2) << +id.data_[14]
85  << std::setw(2) << +id.data_[15]
86  << std::setfill(fill);
87  s.flags(ff);
88  return s;
89  }

◆ operator==

bool operator== ( const UUID lhs,
const UUID rhs 
)
friend

Definition at line 99 of file uuid.h.

99  {
100  return lhs.data_ == rhs.data_;
101 }

Member Data Documentation

◆ data_

std::array<value_type, 16> omnisci::UUID::data_
private

Definition at line 93 of file uuid.h.

Referenced by data(), swap(), and UUID().


The documentation for this class was generated from the following file: