25 #if defined(ONIXS_ILINK3_HAS_GATEWAY_EMULATOR) 36 using namespace Messaging;
53 return static_cast<bool>(msg);
57 template<
typename Message>
67 template <
class AnotherType>
71 , container_(rhs.container_)
78 template <
class AnotherType>
82 , container_(
std::move(rhs.container_))
127 std::swap(rhs.size_, size_);
128 std::swap(rhs.container_, container_);
129 std::swap(rhs.message_, message_);
173 operator Message() noexcept
179 operator const Message() const noexcept
187 return container_.get();
195 message_ = Message();
201 return message_.toString();
206 template<
typename MessageT>
209 typename std::enable_if<!std::is_base_of<TagBased::Message, MessageT>::value,
MessageTemplateId>::type
212 static_assert(std::is_base_of<SbeMessage, MessageT>::value,
"");
214 return MessageT::TemplateId;
217 template<
typename MessageT>
220 typename std::enable_if<std::is_base_of<TagBased::Message, MessageT>::value,
MessageTemplateId>::type
223 static_assert(std::is_base_of<SbeMessage, typename MessageT::Binary>::value,
"");
225 return MessageT::Binary::TemplateId;
228 template<
typename MessageT>
230 typename std::enable_if<!std::is_base_of<TagBased::Message, MessageT>::value, MessageT>::type
233 static_assert(std::is_base_of<SbeMessage, MessageT>::value,
"");
235 return Messaging::typify<MessageT>(message);
238 template<
typename MessageT>
240 typename std::enable_if<std::is_base_of<TagBased::Message, MessageT>::value, MessageT>::type
243 static_assert(std::is_base_of<SbeMessage, typename MessageT::Binary>::value,
"");
245 return MessageT(Messaging::typify<typename Message::Binary>(message));
248 template <
class AnotherType>
251 if(rhs->templateId() != getTemplateId<Message>())
254 message_ = this->typify<Message>(rhs);
269 , container_(
std::move(container))
270 , message_(container_.get(), size_)
275 template <
typename AnotherType,
typename BaseType>
MessageHeader::TemplateId MessageTemplateId
Message type (template) identification.
MessagePtr(MessagePtr< AnotherType > &&rhs)
Creates from the given type.
void throwWrongType(UInt16, UInt16)
MessagePtr(const MessagePtr< AnotherType > &rhs)
Create from another type.
Message typify(const SbeMessage &message)
Casts SBE-encoded message to a given type.
#define ONIXS_ILINK3_NORETURN
MessagePtr & operator=(MessagePtr &&rhs) noexcept
Message & message() noexcept
const Message & message() const noexcept
const Message & operator*() const noexcept
const Message * operator->() const noexcept
std::string toString() const
MessagePtr()
Creates an empty message container.
std::shared_ptr< UInt8 > Container
bool valid() const noexcept
void reset()
Resets the message.
MessagePtr(MessagePtr &&rhs) noexcept
Message * operator->() noexcept
#define ONIXS_ILINK3_EXPORTED
UInt16 MessageSize
Message length type.
bool isMessageValid(const SbeMessage &msg) noexcept
Message & operator*() noexcept
Implements a tag-based interface over an SBE-encoded message.
void swap(MessagePtr &rhs) noexcept
MessagePtr< AnotherType > cast(const MessagePtr< BaseType > &ptr)
Tries to cast to another type.