Open Lighting Architecture
0.9.1
Main Page
Modules
Related Pages
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
ola
rdm
MessageSerializer.h
Go to the documentation of this file.
1
/*
2
* This library is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU Lesser General Public
4
* License as published by the Free Software Foundation; either
5
* version 2.1 of the License, or (at your option) any later version.
6
*
7
* This library is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
* Lesser General Public License for more details.
11
*
12
* You should have received a copy of the GNU Lesser General Public
13
* License along with this library; if not, write to the Free Software
14
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
*
16
* MessageSerializer.h
17
* Serialize a message.
18
* Copyright (C) 2011 Simon Newton
19
*/
20
29
#ifndef INCLUDE_OLA_RDM_MESSAGESERIALIZER_H_
30
#define INCLUDE_OLA_RDM_MESSAGESERIALIZER_H_
31
32
#include <ola/messaging/MessageVisitor.h>
33
34
namespace
ola {
35
namespace
rdm {
36
37
41
class
MessageSerializer
:
public
ola::messaging::MessageVisitor
{
42
public
:
43
explicit
MessageSerializer
(
unsigned
int
initial_size = INITIAL_BUFFER_SIZE);
44
~
MessageSerializer
();
45
46
const
uint8_t *
SerializeMessage
(
const
ola::messaging::Message
*message,
47
unsigned
int
*length);
48
49
void
Visit(
const
ola::messaging::BoolMessageField
*);
50
void
Visit(
const
ola::messaging::IPV4MessageField
*);
51
void
Visit(
const
ola::messaging::MACMessageField
*);
52
void
Visit(
const
ola::messaging::UIDMessageField
*);
53
void
Visit(
const
ola::messaging::StringMessageField
*);
54
void
Visit(
const
ola::messaging::BasicMessageField<uint8_t>
*);
55
void
Visit(
const
ola::messaging::BasicMessageField<uint16_t>
*);
56
void
Visit(
const
ola::messaging::BasicMessageField<uint32_t>
*);
57
void
Visit(
const
ola::messaging::BasicMessageField<int8_t>
*);
58
void
Visit(
const
ola::messaging::BasicMessageField<int16_t>
*);
59
void
Visit(
const
ola::messaging::BasicMessageField<int32_t>
*);
60
void
Visit(
const
ola::messaging::GroupMessageField
*);
61
void
PostVisit(
const
ola::messaging::GroupMessageField
*);
62
63
private
:
64
uint8_t *m_data;
65
unsigned
int
m_offset, m_buffer_size, m_initial_buffer_size;
66
67
static
const
unsigned
int
INITIAL_BUFFER_SIZE = 256;
68
69
void
CheckForFreeSpace(
unsigned
int
required_size);
70
71
template
<
typename
int
_type>
72
void
IntVisit(
const
ola::messaging::BasicMessageField<int_type>
*);
73
};
74
}
// namespace rdm
75
}
// namespace ola
76
#endif // INCLUDE_OLA_RDM_MESSAGESERIALIZER_H_
Generated on Tue Jun 24 2014 03:57:51 for Open Lighting Architecture by
1.8.1.2