16#include <boost/asio/buffer.hpp>
33 template <
size_t MaxNumberOfBuffers>
35 :
public std::enable_shared_from_this<MessageTmpl<MaxNumberOfBuffers>>,
40 return MaxNumberOfBuffers;
47 template <
typename... Buffers>
58 template <
typename... Buffers>
60 :
MessageTmpl(sizeof...(Buffers) + 1u, buf, buffers...) {
61 static_assert(
sizeof...(Buffers) <
max_size(),
"Too many buffers!");
66 auto size() const noexcept {
85 std::array<SharedBufferView, MaxNumberOfBuffers>
_buffers;
87 std::array<boost::asio::const_buffer, MaxNumberOfBuffers + 1u>
_buffer_views;
Inherit (privately) to suppress copy/move construction and assignment.
Serialization of a set of buffers to be sent over a TCP socket as a single message.
MessageTmpl(size_t size, SharedBufferView buffer, Buffers... buffers)
std::array< SharedBufferView, MaxNumberOfBuffers > _buffers
auto size() const noexcept
Size in bytes of the message excluding the header.
static constexpr size_t max_size()
auto GetBufferSequence() const
MessageTmpl(SharedBufferView buf, Buffers... buffers)
message_size_type _number_of_buffers
std::array< boost::asio::const_buffer, MaxNumberOfBuffers+1u > _buffer_views
message_size_type _total_size
bool empty() const noexcept
uint32_t message_size_type
This file contains definitions of common data structures used in traffic manager.
static auto MakeListView(Iterator begin, Iterator end)
std::shared_ptr< BufferView > SharedBufferView