headers.hpp
Go to the documentation of this file.
1 
6 /*****************************************************************************
7 ** Ifdefs
8 *****************************************************************************/
9 
10 #ifndef mm_messages_HEADERS_HPP_
11 #define mm_messages_HEADERS_HPP_
12 
13 /*****************************************************************************
14 ** Includes
15 *****************************************************************************/
16 
17 #include <string>
18 #include "message.hpp"
19 
20 /*****************************************************************************
21 ** Namespaces
22 *****************************************************************************/
23 
24 namespace mm_messages {
25 
26 /*****************************************************************************
27 ** Definitions
28 *****************************************************************************/
29 
30 struct PacketHeader {
31  static const unsigned int size;
32  PacketHeader(const unsigned int& signature=0xaa55aa55) : signature(signature) {}
33  unsigned int signature;
34 };
35 
37  static const unsigned int size;
38  SubPacketHeader(const int& id=-1, const unsigned int& length = 0);
39  int id;
40  unsigned int length;
41 };
42 
43 /*****************************************************************************
44 ** Serialisations
45 *****************************************************************************/
46 
47 template<>
50  static void encode(const PacketHeader& header, ByteArray& buffer);
51  static PacketHeader decode(const unsigned char* buffer, const unsigned int& size);
52 };
53 
54 template<>
57  static void encode(const SubPacketHeader& header, ByteArray& buffer);
58  static SubPacketHeader decode(const unsigned char* buffer, const unsigned int& size);
59 };
60 
61 } // namespace mm_messages
62 
63 #endif /* mm_messages_HEADERS_HPP_ */
Template parent and default pass-through encoding/decoding.
Definition: message.hpp:46
static const unsigned int size
Definition: headers.hpp:31
unsigned int signature
Definition: headers.hpp:33
static const unsigned int size
Definition: headers.hpp:37
std::vector< unsigned char > ByteArray
Definition: message.hpp:29
PacketHeader(const unsigned int &signature=0xaa55aa55)
Definition: headers.hpp:32


mm_messages
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:52:10