Open Lighting Architecture
0.9.6
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
MessageDeserializer.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
* MessageDeserializer.h
17
* Inflate a message from raw data.
18
* Copyright (C) 2011 Simon Newton
19
*/
20
30
#ifndef INCLUDE_OLA_RDM_MESSAGEDESERIALIZER_H_
31
#define INCLUDE_OLA_RDM_MESSAGEDESERIALIZER_H_
32
33
#include <ola/messaging/DescriptorVisitor.h>
34
#include <ola/messaging/Message.h>
35
#include <stack>
36
#include <vector>
37
38
namespace
ola {
39
namespace
rdm {
40
41
45
class
MessageDeserializer
:
public
ola::messaging::FieldDescriptorVisitor
{
46
public
:
47
MessageDeserializer
();
48
~
MessageDeserializer
();
49
50
const
ola::messaging::Message
*
InflateMessage
(
51
const
class
ola::messaging::Descriptor
*descriptor,
52
const
uint8_t *data,
53
unsigned
int
length);
54
55
// we handle decending into groups ourself
56
bool
Descend()
const
{
return
false
; }
57
58
void
Visit(
const
ola::messaging::BoolFieldDescriptor
*);
59
void
Visit(
const
ola::messaging::IPV4FieldDescriptor
*);
60
void
Visit(
const
ola::messaging::MACFieldDescriptor
*);
61
void
Visit(
const
ola::messaging::UIDFieldDescriptor
*);
62
void
Visit(
const
ola::messaging::StringFieldDescriptor
*);
63
void
Visit(
const
ola::messaging::IntegerFieldDescriptor<uint8_t>
*);
64
void
Visit(
const
ola::messaging::IntegerFieldDescriptor<uint16_t>
*);
65
void
Visit(
const
ola::messaging::IntegerFieldDescriptor<uint32_t>
*);
66
void
Visit(
const
ola::messaging::IntegerFieldDescriptor<int8_t>
*);
67
void
Visit(
const
ola::messaging::IntegerFieldDescriptor<int16_t>
*);
68
void
Visit(
const
ola::messaging::IntegerFieldDescriptor<int32_t>
*);
69
void
Visit(
const
ola::messaging::FieldDescriptorGroup
*);
70
void
PostVisit(
const
ola::messaging::FieldDescriptorGroup
*) {}
71
72
private
:
73
const
uint8_t *m_data;
74
unsigned
int
m_length;
75
unsigned
int
m_offset;
76
unsigned
int
m_variable_field_size;
77
bool
m_insufficient_data;
78
79
typedef
std::vector<const ola::messaging::MessageFieldInterface*>
80
message_vector;
81
std::stack<message_vector> m_message_stack;
82
83
bool
CheckForData(
unsigned
int
required_size);
84
void
CleanUpVector();
85
86
template
<
typename
int
_type>
87
void
IntVisit(
const
ola::messaging::IntegerFieldDescriptor<int_type>
*);
88
};
89
}
// namespace rdm
90
}
// namespace ola
91
#endif // INCLUDE_OLA_RDM_MESSAGEDESERIALIZER_H_
Generated on Fri Jul 3 2015 15:58:45 for Open Lighting Architecture by
1.8.1.2