10 #include "../../include/mm_messages/headers.hpp" 39 buffer.resize(PacketHeader::size);
46 unsigned int signature;
48 unsigned int window_size =
sizeof(
unsigned int);
50 signature = from_byte_array(stencil);
55 ByteArray sub_packet_header_buffer(SubPacketHeader::size);
56 unsigned int window_size =
sizeof(
unsigned int);
58 ByteStencil stencil(sub_packet_header_buffer, sub_packet_header_buffer.begin(), buffer.end());
59 stencil.
resettle(0, window_size); to_byte_array(stencil, header.
id);
60 stencil.resettle(window_size, window_size); to_byte_array(stencil, header.
length);
61 buffer.insert(buffer.end(), sub_packet_header_buffer.begin(), sub_packet_header_buffer.end());
66 unsigned int signature;
68 unsigned int window_size =
sizeof(
unsigned int);
71 stencil.
resettle(0, window_size);
id = from_byte_array(stencil);
72 stencil.
resettle(window_size, window_size); length = from_byte_array(stencil);
static void encode(const T &msg, ByteArray &buffer)
void resettle(const unsigned int &start_index, const unsigned int &n) ecl_assert_throw_decl(StandardException)
void resettle(const unsigned int &start_index, const unsigned int &n) ecl_assert_throw_decl(StandardException)
std::vector< unsigned char > ByteArray
static T decode(const unsigned char *buffer, const unsigned int &size)