sends and receives flatbuffer data via AZMQ implementation of ZeroMQ plus manages the relevant buffers More...
#include <AzmqFlatbuffer.hpp>
Public Types | |
typedef std::shared_ptr< boost::container::static_vector< uint8_t, 256 > > | receive_buffer_type |
Public Member Functions | |
void | async_send_flatbuffer (std::shared_ptr< flatbuffers::FlatBufferBuilder > fbbP) |
AzmqFlatbuffer (azmq::socket socket) | |
void | cancel () |
template<typename OutputIterator > | |
void | get_all_receive_buffers_with_data (OutputIterator it) |
Get all buffers from the pool at once and put them in an OutputIterator. This reduces locking/unlocking substantially. More... | |
receive_buffer_type | get_back_receive_buffer_with_data () |
get the last, aka most chronologically recent, incoming buffer from the pool More... | |
receive_buffer_type | get_front_receive_buffer_with_data () |
get the first, aka the chronologically oldest, incoming buffer from the pool More... | |
std::shared_ptr< flatbuffers::FlatBufferBuilder > | GetUnusedBufferBuilder () |
get a google FlatBufferBuilder object from the pool of unused objects More... | |
template<typename T > | |
void | insert_unused_receive_buffers (T &range) |
void | push_back_unused_receive_buffer (receive_buffer_type rb) |
Put an unused buffer, or one that is no longer needed, back into the pool. More... | |
std::size_t | receive_buffers_capacity () |
bool | receive_buffers_empty () |
std::size_t | receive_buffers_size () |
void | shutdown (azmq::socket::shutdown_type sd, boost::system::error_code &ec) |
void | start_async_receive_buffers () |
void | stop_async_receive_buffers () |
Stop receiving buffers. More... | |
~AzmqFlatbuffer () | |
Static Public Attributes | |
static const int | default_circular_buffer_size = 10 |
sends and receives flatbuffer data via AZMQ implementation of ZeroMQ plus manages the relevant buffers
Sending: This class provides a mechanism to asynchronously send google flatbuffers. It also stores a pool of these buffers so that they don't need to be reallocated.
Rationale: FlatBufferBuilders are much faster if they are reused so we create a small pool of them that you can get from this object after you send a flat buffer, the builder is put into the pool
Definition at line 35 of file AzmqFlatbuffer.hpp.
typedef std::shared_ptr<boost::container::static_vector<uint8_t,256> > AzmqFlatbuffer::receive_buffer_type |
Definition at line 41 of file AzmqFlatbuffer.hpp.
|
inlineexplicit |
Initialize AzmqFlatbuffer with a socket. The socket should be fully configured and ready to use when it is passed to this object. We also recommend the user utilizes AzmqFlatbuffer(std::move(socket)) when calling this constructor.
Definition at line 51 of file AzmqFlatbuffer.hpp.
|
inline |
destructor
Definition at line 114 of file AzmqFlatbuffer.hpp.
|
inline |
Send a FlatbufferBuilder to the destination specified in the socket.
Definition at line 71 of file AzmqFlatbuffer.hpp.
|
inline |
Definition at line 108 of file AzmqFlatbuffer.hpp.
|
inline |
Get all buffers from the pool at once and put them in an OutputIterator. This reduces locking/unlocking substantially.
Definition at line 257 of file AzmqFlatbuffer.hpp.
|
inline |
get the last, aka most chronologically recent, incoming buffer from the pool
Definition at line 232 of file AzmqFlatbuffer.hpp.
|
inline |
get the first, aka the chronologically oldest, incoming buffer from the pool
Definition at line 244 of file AzmqFlatbuffer.hpp.
|
inline |
get a google FlatBufferBuilder object from the pool of unused objects
Definition at line 124 of file AzmqFlatbuffer.hpp.
|
inline |
Inserts a range of values into the available receive buffers
Definition at line 220 of file AzmqFlatbuffer.hpp.
|
inline |
Put an unused buffer, or one that is no longer needed, back into the pool.
Definition at line 226 of file AzmqFlatbuffer.hpp.
|
inline |
Definition at line 209 of file AzmqFlatbuffer.hpp.
|
inline |
Definition at line 197 of file AzmqFlatbuffer.hpp.
|
inline |
Definition at line 203 of file AzmqFlatbuffer.hpp.
|
inline |
Definition at line 104 of file AzmqFlatbuffer.hpp.
|
inline |
Initializes the process of receiving buffers from the source specified by the azmq::socket taht was provided. This initializes a loop that will continuously read data and fill out the internal ring buffer for users to extract. This allows this class to run asynchronously while interacting with synchronous users.
Definition at line 146 of file AzmqFlatbuffer.hpp.
|
inline |
Stop receiving buffers.
Definition at line 191 of file AzmqFlatbuffer.hpp.
|
static |
Definition at line 39 of file AzmqFlatbuffer.hpp.