zookeeper-cpp
ZooKeeper Client for C++
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Groups
zk::server::server_id Struct Reference

Represents the ID of a server in the ensemble. More...

#include <zk/server/configuration.hpp>

+ Inheritance diagram for zk::server::server_id:

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...
 

Detailed Description

Represents the ID of a server in the ensemble.

Note
The backing type for this ID is a 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.

Constructor & Destructor Documentation

zk::server::server_id::server_id ( std::size_t  value)
inline

Create an instance from the given value.

Exceptions
std::out_of_rangeif value is not in 1-255.

Definition at line 35 of file configuration.hpp.

Member Function Documentation

void zk::server::server_id::ensure_valid ( ) const

Check that this ID is a valid one.

Exceptions
std::out_of_rangeif value is not in 1-255.

Definition at line 15 of file configuration.cpp.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const server_id self 
)
friend

Debug print for this instance.

Definition at line 25 of file configuration.cpp.


The documentation for this struct was generated from the following files: