45 #if defined (ONIXS_ILINK3_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;
void clear()
Removes all combined messages.
const_iterator end() const
std::vector< NetworkMessage > NetMessages
Contains the SimpleOpenFramingHeader, the SBE message, and the data buffer.
const_iterator begin() const
static bool fitSize(MessageBatchCombiner &msgs, size_t size=defaultMaxPacketSize()) noexcept
static size_t fitSize(MessageBatch< SbeMessageType, MaxMessageSize, MessageInitializer > &msgs, size_t size=defaultMaxPacketSize()) noexcept
static size_t calculateBatchSize(MessageBatchCombiner &msgs) noexcept
MessageBatch(std::initializer_list< MsgHolder > list)
Creates a message batch from the initializer list.
#define ONIXS_ILINK3_EXPORTED_CLASS
MessageBatch & operator=(const MessageBatch &)=delete
static size_t calculateBatchSize(MessageBatch< SbeMessageType, MaxMessageSize, MessageInitializer > &msgs) noexcept
void add(MessageBatch< MessageTypeT, MaxMessageSize, MessageInitializer > &batch)
Adds the message batch to the array of combined messages.
const MsgHolder & operator[](size_t index) const
void add(const MsgHolder &msg)
Appends a message to the end of the batch.
typename MsgHolders::iterator iterator
constexpr UInt8 DefaultMaxGroupItems
Default maximum number of repeating group items.
std::vector< MsgHolder > MsgHolders
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_END
#define ONIXS_ILINK3_EXPORTED
MessageBatch()=default
Creates an empty message batch.
MsgHolder & operator[](size_t index)
typename MsgHolders::const_iterator const_iterator
The class can be used to combine messages with different types to the batch for sending.
The policy to create messages with null-initialized optional fields.
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_BEGIN
The message batch wrapper.
MessageBatch(size_t size)
Creates a message batch with the given number of default constructed messages.
void add(MessageHolder< MessageTypeT, MaxMessageSize, MessageInitializer > &holder)
Adds the message to the array of combined messages.
void updateHeaders()
Updates headers of SBE messages to be ready for sending.
#define ONIXS_ILINK3_NOTHROW
NetworkMessage toNetworkMessage() noexcept