Diag-Client-Lib
|
Wrapper class to hold boost io context required for io object( sockets) More...
#include <io_context.h>
Public Types | |
using | Context = boost::asio::io_context |
Type alias for boost context. More... | |
Public Member Functions | |
IoContext () noexcept | |
Default constructs an instance of IoContext. More... | |
IoContext (std::string_view context_name) noexcept | |
Constructs an instance of IoContext. More... | |
IoContext (const IoContext &other) noexcept=delete | |
Deleted copy assignment and copy constructor. More... | |
IoContext & | operator= (const IoContext &other) noexcept=delete |
IoContext (IoContext &&other) noexcept=delete | |
Deleted move assignment and move constructor. More... | |
IoContext & | operator= (IoContext &&other) noexcept=delete |
~IoContext () noexcept | |
Destruct an instance of IoContext. More... | |
void | Initialize () noexcept |
Initialize the context. More... | |
void | DeInitialize () noexcept |
De-initialize the context. More... | |
Context & | GetContext () noexcept |
Function to get the io context reference. More... | |
Private Attributes | |
Context | io_context_ |
boost io context More... | |
std::atomic_bool | exit_request_ |
Flag to terminate the thread. More... | |
std::atomic_bool | running_ |
Flag to start the thread. More... | |
std::condition_variable | cond_var_ |
Conditional variable to block the thread. More... | |
std::string | context_name_ |
The name of context. More... | |
utility::thread::Thread | thread_ |
The thread itself. More... | |
std::mutex | mutex_ |
mutex to lock critical section More... | |
Wrapper class to hold boost io context required for io object( sockets)
Definition at line 22 of file io_context.h.
using boost_support::socket::IoContext::Context = boost::asio::io_context |
Type alias for boost context.
Definition at line 27 of file io_context.h.
|
noexcept |
Default constructs an instance of IoContext.
Definition at line 14 of file io_context.cpp.
|
noexcept |
Constructs an instance of IoContext.
Definition at line 21 of file io_context.cpp.
|
deletenoexcept |
Deleted copy assignment and copy constructor.
|
deletenoexcept |
Deleted move assignment and move constructor.
|
noexcept |
Destruct an instance of IoContext.
Definition at line 48 of file io_context.cpp.
References cond_var_, exit_request_, utility::thread::Thread::Join(), running_, and thread_.
|
noexcept |
De-initialize the context.
Definition at line 61 of file io_context.cpp.
References cond_var_, io_context_, mutex_, and running_.
Referenced by boost_support::client::udp::UdpClient::UdpClientImpl::DeInitialize().
|
noexcept |
Function to get the io context reference.
Definition at line 68 of file io_context.cpp.
References io_context_.
|
noexcept |
Initialize the context.
Definition at line 55 of file io_context.cpp.
References cond_var_, mutex_, and running_.
Referenced by boost_support::client::udp::UdpClient::UdpClientImpl::Initialize().
|
private |
Conditional variable to block the thread.
Definition at line 92 of file io_context.h.
Referenced by DeInitialize(), Initialize(), and ~IoContext().
|
private |
The name of context.
Definition at line 97 of file io_context.h.
|
private |
Flag to terminate the thread.
Definition at line 82 of file io_context.h.
Referenced by ~IoContext().
|
private |
boost io context
Definition at line 77 of file io_context.h.
Referenced by DeInitialize(), and GetContext().
|
private |
mutex to lock critical section
Definition at line 107 of file io_context.h.
Referenced by DeInitialize(), and Initialize().
|
private |
Flag to start the thread.
Definition at line 87 of file io_context.h.
Referenced by DeInitialize(), Initialize(), and ~IoContext().
|
private |