Open Lighting Architecture
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
StringMessageBuilder.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
*
16
* StringMessageBuilder.h
17
* Builds a Message object from a list of strings & a Descriptor.
18
* Copyright (C) 2011 Simon Newton
19
*/
20
29
#ifndef INCLUDE_OLA_RDM_STRINGMESSAGEBUILDER_H_
30
#define INCLUDE_OLA_RDM_STRINGMESSAGEBUILDER_H_
31
32
#include <ola/messaging/DescriptorVisitor.h>
33
#include <stack>
34
#include <string>
35
#include <vector>
36
37
namespace
ola {
38
39
namespace
messaging {
40
class
Descriptor;
41
class
MessageFieldInterface;
42
class
Message;
43
}
44
45
namespace
rdm {
46
47
using
std::string;
48
using
std::vector;
49
54
class
StringMessageBuilder
:
public
ola::messaging::FieldDescriptorVisitor
{
55
public
:
56
StringMessageBuilder
();
57
~StringMessageBuilder
();
58
59
// we handle decending into groups ourself
60
bool
Descend()
const
{
return
false
; }
61
const
ola::messaging::Message
*
GetMessage
(
62
const
vector<string> &inputs,
63
const
class
ola::messaging::Descriptor
*);
64
const
string
GetError()
const
{
return
m_error_string; }
65
66
void
Visit
(
const
ola::messaging::BoolFieldDescriptor
*);
67
void
Visit
(
const
ola::messaging::IPV4FieldDescriptor
*);
68
void
Visit
(
const
ola::messaging::UIDFieldDescriptor
*);
69
void
Visit
(
const
ola::messaging::StringFieldDescriptor
*);
70
void
Visit
(
const
ola::messaging::UInt8FieldDescriptor
*);
71
void
Visit
(
const
ola::messaging::UInt16FieldDescriptor
*);
72
void
Visit
(
const
ola::messaging::UInt32FieldDescriptor
*);
73
void
Visit
(
const
ola::messaging::Int8FieldDescriptor
*);
74
void
Visit
(
const
ola::messaging::Int16FieldDescriptor
*);
75
void
Visit
(
const
ola::messaging::Int32FieldDescriptor
*);
76
void
Visit
(
const
ola::messaging::FieldDescriptorGroup
*);
77
void
PostVisit
(
const
ola::messaging::FieldDescriptorGroup
*);
78
79
private
:
80
vector<string> m_inputs;
81
std::stack<vector<const ola::messaging::MessageFieldInterface*> > m_groups;
82
unsigned
int
m_offset, m_input_size, m_group_instance_count;
83
bool
m_error;
84
string
m_error_string;
85
86
bool
StopParsing()
const
;
87
void
SetError(
const
string
&error);
88
89
template
<
typename
type>
90
void
VisitInt(
const
ola::messaging::IntegerFieldDescriptor<type>
*);
91
92
void
InitVars(
const
vector<string> &inputs);
93
void
CleanUpVector();
94
};
95
}
// namespace rdm
96
}
// namespace ola
97
#endif // INCLUDE_OLA_RDM_STRINGMESSAGEBUILDER_H_
Generated on Fri Apr 4 2014 11:54:22 for Open Lighting Architecture by
1.8.1.2