33using namespace Messaging;
50 return static_cast<bool>(msg);
54template<
typename Message>
64 template <
class AnotherType>
68 , container_(rhs.container_)
75 template <
class AnotherType>
79 , container_(std::move(rhs.container_))
124 std::swap(rhs.size_, size_);
125 std::swap(rhs.container_, container_);
126 std::swap(rhs.message_, message_);
170 operator Message() noexcept
176 operator const Message() const noexcept
184 return container_.get();
192 message_ = Message();
198 return message_.toString();
203 template<
typename MessageT>
206 typename std::enable_if<!std::is_base_of<TagBased::Message, MessageT>::value,
MessageTemplateId>::type
209 static_assert(std::is_base_of<SbeMessage, MessageT>::value,
"");
211 return MessageT::TemplateId;
214 template<
typename MessageT>
217 typename std::enable_if<std::is_base_of<TagBased::Message, MessageT>::value,
MessageTemplateId>::type
220 static_assert(std::is_base_of<SbeMessage, typename MessageT::Binary>::value,
"");
222 return MessageT::Binary::TemplateId;
225 template<
typename MessageT>
227 typename std::enable_if<!std::is_base_of<TagBased::Message, MessageT>::value, MessageT>::type
230 static_assert(std::is_base_of<SbeMessage, MessageT>::value,
"");
235 template<
typename MessageT>
237 typename std::enable_if<std::is_base_of<TagBased::Message, MessageT>::value, MessageT>::type
240 static_assert(std::is_base_of<SbeMessage, typename MessageT::Binary>::value,
"");
245 template <
class AnotherType>
248 if(rhs->templateId() != getTemplateId<Message>())
251 message_ = this->typify<Message>(rhs);
266 , container_(std::move(container))
267 , message_(container_.get(), size_)
272template <
typename AnotherType,
typename BaseType>
#define ONIXS_ILINK3_NORETURN
#define ONIXS_ILINK3_EXPORTED
Implements a tag-based interface over an SBE-encoded message.
const Message & message() const noexcept
const Message & operator*() const noexcept
MessagePtr(MessagePtr< AnotherType > &&rhs)
Creates from the given type.
std::string toString() const
const Message * operator->() const noexcept
Message & message() noexcept
MessagePtr(const MessagePtr &)=default
Message * operator->() noexcept
MessagePtr()
Creates an empty message container.
MessagePtr(const MessagePtr< AnotherType > &rhs)
Create from another type.
void swap(MessagePtr &rhs) noexcept
bool valid() const noexcept
MessagePtr(Container &&, MessageSize)
Creates from the given memory block.
MessagePtr & operator=(MessagePtr &&rhs) noexcept
MessagePtr & operator=(const MessagePtr &)=default
Message & operator*() noexcept
std::shared_ptr< UInt8 > Container
MessagePtr(MessagePtr &&rhs) noexcept
void reset()
Resets the message.
Message typify(const SbeMessage &message)
Casts SBE-encoded message to a given type.
UInt16 MessageSize
Message length type.
MessageHeader::TemplateId MessageTemplateId
Message type (template) identification.
bool isMessageValid(const SbeMessage &msg) noexcept
void throwWrongType(UInt16, UInt16)
MessagePtr< AnotherType > cast(const MessagePtr< BaseType > &ptr)
Tries to cast to another type.