Main Page
Namespaces
Classes
Files
File List
File Members
include
mm_messages
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
36
struct
SubPacketHeader
{
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
<>
48
struct
Message
<
PacketHeader
> {
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
<>
55
struct
Message
<
SubPacketHeader
> {
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_ */
mm_messages::SubPacketHeader
Definition:
headers.hpp:36
mm_messages::Message
Template parent and default pass-through encoding/decoding.
Definition:
message.hpp:46
mm_messages
Definition:
exceptions.hpp:23
mm_messages::PacketHeader
Definition:
headers.hpp:30
mm_messages::PacketHeader::size
static const unsigned int size
Definition:
headers.hpp:31
mm_messages::PacketHeader::signature
unsigned int signature
Definition:
headers.hpp:33
mm_messages::SubPacketHeader::id
int id
Definition:
headers.hpp:39
message.hpp
mm_messages::SubPacketHeader::size
static const unsigned int size
Definition:
headers.hpp:37
mm_messages::SubPacketHeader::length
unsigned int length
Definition:
headers.hpp:40
mm_messages::ByteArray
std::vector< unsigned char > ByteArray
Definition:
message.hpp:29
mm_messages::PacketHeader::PacketHeader
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