109 static constexpr int stringSize = 2 * (
sizeof(uint32_t) +
sizeof(uint32_t) +
110 sizeof(uint64_t) +
sizeof(uint64_t)) + 1;
118 char *
stringficate(
char *buffer,
const size_t & src_size)
const;
150 const uint64_t & _counter,
151 const uint32_t & _port_number);
165 [[deprecated(
"Use Uid(const Aleph::IPv4_Address&, const uint64_t&, const uint32_t&) instead")]]
167 const unsigned int & _counter,
168 const unsigned int & _port_number)
170 static_cast<uint64_t>(_counter),
171 static_cast<uint32_t>(_port_number))
208 char *
getStringUid(
char *str,
const size_t & size)
const;
248 std::cout <<
"Uid:" <<
'\n'
249 <<
" ipAddr = " <<
ipAddr <<
'\n'
251 <<
" counter = " <<
counter <<
'\n'
Core header for the Aleph-w library.
Unique identifier for distributed systems.
static constexpr int stringSize
Required buffer size for string representation.
const Aleph::IPv4_Address & getIpAddr() const noexcept
Get IP address component.
void print() const
Print UID components to standard output.
const uint64_t & get_random_number() const noexcept
Get a random number component.
const uint64_t & get_counter() const noexcept
Get counter component.
char * stringficate(char *buffer, const size_t &src_size) const
Convert UID components to hexadecimal string.
Aleph::IPv4_Address ipAddr
IPv4 address component.
char * getStringUid(char *str, const size_t &size) const
Convert UID to hexadecimal string representation.
uint32_t port_number
Port number component.
Uid(const Aleph::IPv4_Address &_ipAddr, const unsigned int &_counter, const unsigned int &_port_number)
Backward-compatible constructor with legacy parameter types.
uint64_t counter
Counter component.
uint64_t random_number
Random number component.
friend struct Uid_Offsets
const uint32_t & get_port_number() const noexcept
Get port number component.
void destringficate(char *str)
Parse hexadecimal string and populate UID components.
Uid()=default
Default constructor.
bool operator==(const Uid &uid) const noexcept
Compare two UIDs for equality.
uint32_t IPv4_Address
Type alias for IPv4 addresses stored as 32-bit integers.