Open Lighting Architecture
 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 StringFieldDescriptor;
34 class UIDFieldDescriptor;
35 
36 template <typename type>
37 class IntegerFieldDescriptor;
38 
43  public:
44  virtual ~FieldDescriptorVisitor() {}
45 
46  // return true if you want groups to be recursively expanded
47  virtual bool Descend() const = 0;
48 
49  virtual void Visit(const BoolFieldDescriptor*) = 0;
50  virtual void Visit(const IPV4FieldDescriptor*) = 0;
51  virtual void Visit(const UIDFieldDescriptor*) = 0;
52  virtual void Visit(const StringFieldDescriptor*) = 0;
53  virtual void Visit(const IntegerFieldDescriptor<uint8_t>*) = 0;
54  virtual void Visit(const IntegerFieldDescriptor<uint16_t>*) = 0;
55  virtual void Visit(const IntegerFieldDescriptor<uint32_t>*) = 0;
56  virtual void Visit(const IntegerFieldDescriptor<int8_t>*) = 0;
57  virtual void Visit(const IntegerFieldDescriptor<int16_t>*) = 0;
58  virtual void Visit(const IntegerFieldDescriptor<int32_t>*) = 0;
59  virtual void Visit(const FieldDescriptorGroup*) = 0;
60  virtual void PostVisit(const FieldDescriptorGroup*) = 0;
61 };
62 } // namespace messaging
63 } // namespace ola
64 #endif // INCLUDE_OLA_MESSAGING_DESCRIPTORVISITOR_H_