45 #if defined (ONIXS_B3_BOE_CXX11) 50 template <
typename MessageTypeT,
51 size_t MaxMessageSize = GetMaxMessageSize<typename HeldAdapter<MessageTypeT>::SbeType,
DefaultMaxGroupItems>::Size,
60 using iterator =
typename MsgHolders::iterator;
95 batch_.push_back(msg);
107 netMsgs_.resize(batch_.size());
109 for (
size_t counter = 0; counter < batch_.size(); ++counter)
110 netMsgs_[counter] = batch_[counter].toNetworkMessage();
116 size_t size()
const {
return batch_.size(); }
153 template <
typename MessageTypeT,
154 size_t MaxMessageSize = GetMaxMessageSize<typename HeldAdapter<MessageTypeT>::SbeType,
DefaultMaxGroupItems>::Size,
158 for (
auto & holder : batch)
159 netMsgs_.push_back(holder.toNetworkMessage());
162 template <
typename MessageTypeT,
163 size_t MaxMessageSize = GetMaxMessageSize<typename HeldAdapter<MessageTypeT>::SbeType,
DefaultMaxGroupItems>::Size,
171 template <
typename MessageTypeT,
172 size_t MaxMessageSize = GetMaxMessageSize<typename HeldAdapter<MessageTypeT>::SbeType,
DefaultMaxGroupItems>::Size,
179 template <
typename MessageTypeT,
180 size_t MaxMessageSize = GetMaxMessageSize<typename HeldAdapter<MessageTypeT>::SbeType,
DefaultMaxGroupItems>::Size,
207 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
211 return calculateBatchSize(msgs.netMsgs_);
215 template <
typename SbeMessageType,
size_t MaxMessageSize,
typename MessageInitializer>
219 return calculateBatchSize(msgs) <=
size;
225 return calculateBatchSize(msgs.netMsgs_);
231 return calculateBatchSize(msgs) <=
size;
#define ONIXS_B3_BOE_MESSAGING_NAMESPACE_END
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
The policy to create messages with null-initialized optional fields.
const_iterator end() const
typename MsgHolders::const_iterator const_iterator
#define ONIXS_B3_BOE_NOTHROW
The message batch wrapper.
std::vector< MsgHolder > MsgHolders
#define ONIXS_B3_BOE_EXPORTED
constexpr UInt8 DefaultMaxGroupItems
Default maximum number of repeating group items.
const MsgHolder & operator[](size_t index) const
void updateHeaders()
Updates headers of SBE messages to be ready for sending.
static size_t calculateBatchSize(MessageBatch< SbeMessageType, MaxMessageSize, MessageInitializer > &msgs) noexcept
std::vector< NetworkMessage > NetMessages
static bool fitSize(MessageBatchCombiner &msgs, size_t size=defaultMaxPacketSize()) noexcept
void add(MessageHolder< MessageTypeT, MaxMessageSize, MessageInitializer > &holder)
Adds the message to the array of combined messages.
MessageBatch(std::initializer_list< MsgHolder > list)
Creates a message batch from the initializer list.
static size_t fitSize(MessageBatch< SbeMessageType, MaxMessageSize, MessageInitializer > &msgs, size_t size=defaultMaxPacketSize()) noexcept
#define ONIXS_B3_BOE_MESSAGING_NAMESPACE_BEGIN
typename MsgHolders::iterator iterator
const_iterator begin() const
void add(MessageBatch< MessageTypeT, MaxMessageSize, MessageInitializer > &batch)
Adds the message batch to the array of combined messages.
MsgHolder & operator[](size_t index)
#define ONIXS_B3_BOE_EXPORTED_CLASS
static size_t calculateBatchSize(MessageBatchCombiner &msgs) noexcept
void clear()
Removes all combined messages.
MessageBatch & operator=(const MessageBatch &)=delete
NetworkMessage toNetworkMessage() noexcept
MessageBatch()=default
Creates an empty message batch.
void add(const MsgHolder &msg)
Appends a message to the end of the batch.
The class can be used to combine messages with different types to the batch for sending.
MessageBatch(size_t size)
Creates a message batch with the given number of default constructed messages.