libjmmcg
build_2783
A C++ library containing an eclectic mix of useful, advanced components.
|
Read a message from the source socket, process it according to the supplied rules and write the resultant message(s) to the destination socket. More...
#include <msg_processor.hpp>
Public Types | |
using | proc_rules_t = ProcessingRules |
The processing rules for the particular server instance. More... | |
using | socket_t = typename proc_rules_t::socket_t |
using | msg_details_t = typename proc_rules_t::src_msg_details_t |
using | msg_buffer_t = typename msg_details_t::msg_buffer_t |
The buffer into which the incoming messages are received. More... | |
Public Member Functions | |
msg_processor (proc_rules_t const &proc_rules) | |
template<class LatencyTimestamps > | |
std::enable_if< std::is_class< typename LatencyTimestamps::period >::value, bool >::type | read_and_process_a_msg (socket_t &src_skt, LatencyTimestamps &ts) noexcept(false) |
Read a message from the source socket, process it and write the resultant message(s) back to the source socket. More... | |
template<class LatencyTimestamps > | |
std::enable_if< std::is_class< typename LatencyTimestamps::period >::value, bool >::type | read_and_process_a_msg (socket_t &src_skt, socket_t &dest_skt, LatencyTimestamps &ts) noexcept(false) |
Read a message from the source socket, process it and write the resultant message(s) to the destination socket. More... | |
std::string | to_string () const noexcept(false) |
Read a message from the source socket, process it according to the supplied rules and write the resultant message(s) to the destination socket.
Definition at line 61 of file msg_processor.hpp.
using jmmcg::socket::msg_processor< ProcessingRules >::msg_buffer_t = typename msg_details_t::msg_buffer_t |
The buffer into which the incoming messages are received.
This should be per-thread, on the stack of the thread, suitably aligned, possibly to 64-bits. For maximum performance it should be a reference to the internal buffer of the network stack or even the hardware buffer in the card (assuming suitable kernel modules). It is not recommended to use GCC <=v4.9.* due to sub-optimal code-generation in std::memcpy() (see the performance graphs of jmmcg::stack_string.
Definition at line 93 of file msg_processor.hpp.
using jmmcg::socket::msg_processor< ProcessingRules >::msg_details_t = typename proc_rules_t::src_msg_details_t |
Definition at line 86 of file msg_processor.hpp.
using jmmcg::socket::msg_processor< ProcessingRules >::proc_rules_t = ProcessingRules |
The processing rules for the particular server instance.
These rules specify how an input message should be transformed to one, or more, response messages,
Definition at line 84 of file msg_processor.hpp.
using jmmcg::socket::msg_processor< ProcessingRules >::socket_t = typename proc_rules_t::socket_t |
Definition at line 85 of file msg_processor.hpp.
|
inlineexplicit |
Definition at line 57 of file msg_processor_impl.hpp.
|
inlinenoexcept |
Read a message from the source socket, process it and write the resultant message(s) back to the source socket.
Note that this call will block until sufficient data has been read from the source socket to comprise a complete source message.
Throws: an exception if there has been a socket error (the source socket being cleanly closed is not an error).
src_skt | The socket that is source of the messages. |
Definition at line 69 of file msg_processor_impl.hpp.
|
inlinenoexcept |
Read a message from the source socket, process it and write the resultant message(s) to the destination socket.
Note that this call will block until sufficient data has been read from the source socket to comprise a complete source message.
Throws: an exception if there has been a socket error (the source socket being cleanly closed is not an error).
src_skt | The socket that is source of the messages. |
dest_skt | The socket that is destination of the messages, may be the same as src_skt. |
Definition at line 89 of file msg_processor_impl.hpp.
|
inlinenoexcept |
Definition at line 100 of file msg_processor_impl.hpp.