Open Lighting Architecture  0.9.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DescriptorVisitor.h
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  * DescriptorVisitor.h
17  * The interface for the class which visits Descriptors & FieldDescriptors.
18  * Copyright (C) 2011 Simon Newton
19  */
20 
21 #ifndef INCLUDE_OLA_MESSAGING_DESCRIPTORVISITOR_H_
22 #define INCLUDE_OLA_MESSAGING_DESCRIPTORVISITOR_H_
23 
24 #include <stdint.h>
25 
26 namespace ola {
27 namespace messaging {
28 
29 
30 class BoolFieldDescriptor;
31 class FieldDescriptorGroup;
32 class IPV4FieldDescriptor;
33 class MACFieldDescriptor;
34 class StringFieldDescriptor;
35 class UIDFieldDescriptor;
36 
37 template <typename type>
38 class IntegerFieldDescriptor;
39 
44  public:
45  virtual ~FieldDescriptorVisitor() {}
46 
47  // return true if you want groups to be recursively expanded
48  virtual bool Descend() const = 0;
49 
50  virtual void Visit(const BoolFieldDescriptor*) = 0;
51  virtual void Visit(const IPV4FieldDescriptor*) = 0;
52  virtual void Visit(const MACFieldDescriptor*) = 0;
53  virtual void Visit(const UIDFieldDescriptor*) = 0;
54  virtual void Visit(const StringFieldDescriptor*) = 0;
55  virtual void Visit(const IntegerFieldDescriptor<uint8_t>*) = 0;
56  virtual void Visit(const IntegerFieldDescriptor<uint16_t>*) = 0;
57  virtual void Visit(const IntegerFieldDescriptor<uint32_t>*) = 0;
58  virtual void Visit(const IntegerFieldDescriptor<int8_t>*) = 0;
59  virtual void Visit(const IntegerFieldDescriptor<int16_t>*) = 0;
60  virtual void Visit(const IntegerFieldDescriptor<int32_t>*) = 0;
61  virtual void Visit(const FieldDescriptorGroup*) = 0;
62  virtual void PostVisit(const FieldDescriptorGroup*) = 0;
63 };
64 } // namespace messaging
65 } // namespace ola
66 #endif // INCLUDE_OLA_MESSAGING_DESCRIPTORVISITOR_H_