zookeeper-cpp
ZooKeeper Client for C++
|
Represents the ID of a server in the ensemble. More...
#include <zk/server/configuration.hpp>
Public Member Functions | |
server_id (std::size_t value) | |
Create an instance from the given value. More... | |
void | ensure_valid () const |
Check that this ID is a valid one. More... | |
Public Member Functions inherited from zk::strong_id< server_id, std::size_t > | |
strong_id () noexcept=default | |
Default construct the ID. More... | |
constexpr | strong_id (value_type value) noexcept |
Construct this instance with the given value. More... | |
constexpr value_type | get () const noexcept |
Get the value of this ID. More... | |
constexpr | operator value_type () noexcept |
Get the value of this ID. More... | |
server_id & | operator++ () |
server_id | operator++ (int) |
server_id & | operator-- () |
server_id | operator-- (int) |
Friends | |
std::ostream & | operator<< (std::ostream &, const server_id &) |
Debug print for this instance. More... | |
Additional Inherited Members | |
Public Types inherited from zk::strong_id< server_id, std::size_t > | |
using | value_type = std::size_t |
The representation type of this ID. More... | |
Public Attributes inherited from zk::strong_id< server_id, std::size_t > | |
value_type | value |
Underlying value of this ID. More... | |
Represents the ID of a server in the ensemble.
std::size_t
, when a std::uint8_t
would cover all valid values of the ID. However, printing unsigned char
types is somewhat odd, as the character value is usually printed. Beyond that, using a std::uint8_t
requires explicit casting when converting from a std::size_t
when -Wconversion
is enabled. Definition at line 29 of file configuration.hpp.
|
inline |
Create an instance from the given value.
std::out_of_range | if value is not in 1-255. |
Definition at line 35 of file configuration.hpp.
void zk::server::server_id::ensure_valid | ( | ) | const |
Check that this ID is a valid one.
std::out_of_range | if value is not in 1-255. |
Definition at line 15 of file configuration.cpp.
|
friend |
Debug print for this instance.
Definition at line 25 of file configuration.cpp.