40 #include <Hg/unpack_message.h>
41 #include <Pb/dynamic.h>
48 template<
typename T >
52 template<
typename MsgT,
58 template<
class HgMsgT,
72 template<
typename HgT,
81 typedef HgT base_type;
84 base_type::message_type message_type;
87 base_type::format_type format_type;
90 base_type::storage_type storage_type;
93 base_type::const_pointer const_pointer;
95 typedef ByteOrderT byte_order_type;
113 *
static_cast<message_type*
>(
this) = rhs;
147 *
static_cast<message_type*
>(
this) = rhs;
162 return byte_order_type::is_host;
166 template<
typename other_MsgT,
167 typename other_ByteOrderT
187 template<
typename MsgT,
195 typedef MsgT message_type;
198 MsgT::format_type format_type;
199 typedef StorageT storage_type;
201 typedef MsgBuffer<storage_type> buffer_type;
204 message_size_trait<format_type>::type size_trait;
207 storage_type::data_type data_type;
208 typedef data_type* pointer;
209 typedef const data_type* const_pointer;
210 typedef MsgT& reference;
211 typedef const MsgT& const_reference;
213 typedef basic_msg< MsgT, StorageT > this_type;
215 typedef Message<this_type,
218 typedef Message<this_type,
221 typedef Message<this_type,
224 typedef Message<this_type,
228 enum { k_size = SizeOf<format_type>::value };
251 *
static_cast<message_type*
>(
this) = rhs;
277 *
static_cast<message_type*
>(
this) = rhs;
292 return m_msgBuffer.
empty();
315 void assign(const_pointer pBuffer,
size_t n)
320 m_msgBuffer.
assign(pBuffer, n);
328 >(*
this, m_msgBuffer);
332 #if ALCHEMY_HAS_EXCEPTIONS
333 throw std::invalid_argument(
"Hg::basic_msg<>::assign() - pBuffer is invalid or length n is 0");
338 #ifdef ALCHEMY_RVALUE_REF_SUPPORTED
407 return m_msgBuffer.
data();
414 void data(pointer pBuffer,
size_t n)
416 pack_data(pBuffer, n);
422 buffer_type m_msgBuffer;
427 pack_message< message_type,
435 void pack_data(pointer pBuffer,
size_t n)
437 buffer_type msg_buffer;
438 msg_buffer.
assign(pBuffer, n);
440 pack_message< message_type,
447 template <
typename other_MsgT,
448 typename other_StorageT
461 template<
typename T,
466 static size_t calculate(
const T &msg)
470 typename T::storage_type>(msg);
471 return fixed_size + dynamic_size;
480 template<
typename T >
483 static size_t calculate(
const T &msg)
496 #endif // __cplusplus