tue_config
node.h
Go to the documentation of this file.
1 #ifndef TUE_CONFIG_NODE_H_
2 #define TUE_CONFIG_NODE_H_
3 
4 #include "tue/config/node_type.h"
5 #include "tue/config/types.h"
6 #include "tue/config/variant.h"
7 #include "tue/config/label.h"
8 
9 #include <map>
10 
11 #include <boost/weak_ptr.hpp>
12 
13 namespace tue
14 {
15 
16 namespace config
17 {
18 
19 class Node
20 {
21 
22 public:
23 
25 
26  virtual ~Node() {}
27 
28  // READ-ONLY
29 
30  // --- MAP
31 
32  virtual bool readGroup(const Label& /*label*/, NodeIdx& /*idx*/) const { return false; }
33 
34  virtual bool value(const Label& /*label*/, Variant& /*value*/) const { return false; }
35 
36  virtual bool empty() const = 0;
37 
38 
39  // WRITE
40 
41  // --- MAP
42 
43  virtual bool addGroup(const Label& /*label*/, const NodeIdx& /*n*/, NodeIdx& /*idx*/) { return false; }
44 
45  virtual bool setValue(const Label& /*label*/, const Variant& /*value*/) { return false; }
46 
47  // --- ARRAY
48 
49  virtual bool add(const NodeIdx& /*n*/, NodeIdx& /*previous*/) { return false; }
50 
51  virtual bool firstChild(NodeIdx& /*child*/) { return false; }
52 
53 
54  inline const Label& name() const { return name_; }
55 
56  inline const NodeType& type() const { return type_; }
57 
58  void setName(const std::string& name) { name_ = name; }
59 
60 
61  // --- COPY
62 
63  virtual NodePtr deepCopy(const Data& source, NodeIdx target_idx, Data& target) const = 0;
64 
65 private:
66 
68 
70 
71 };
72 
73 }
74 
75 } // end namespace tue
76 
77 #endif
tue::config::Node::add
virtual bool add(const NodeIdx &, NodeIdx &)
Definition: node.h:49
std::string
tue::config::Node::value
virtual bool value(const Label &, Variant &) const
Definition: node.h:34
types.h
tue::config::NodeIdx
unsigned int NodeIdx
Definition: data_pointer.h:12
tue::config::Node::deepCopy
virtual NodePtr deepCopy(const Data &source, NodeIdx target_idx, Data &target) const =0
tue::config::Node::setValue
virtual bool setValue(const Label &, const Variant &)
Definition: node.h:45
tue::config::Node::type
const NodeType & type() const
Definition: node.h:56
tue::config::Node::readGroup
virtual bool readGroup(const Label &, NodeIdx &) const
Definition: node.h:32
tue::config::Node
Definition: node.h:19
map
variant.h
label.h
tue::config::Data
Definition: data.h:17
tue::config::Node::setName
void setName(const std::string &name)
Definition: node.h:58
tue::config::Node::name_
Label name_
Definition: node.h:67
tue::config::Node::addGroup
virtual bool addGroup(const Label &, const NodeIdx &, NodeIdx &)
Definition: node.h:43
tue::config::Node::type_
NodeType type_
Definition: node.h:69
tue::config::NodePtr
boost::shared_ptr< Node > NodePtr
Definition: types.h:21
tue::config::NodeType
NodeType
Definition: node_type.h:10
node_type.h
tue::config::Node::name
const Label & name() const
Definition: node.h:54
tue::config::Node::~Node
virtual ~Node()
Definition: node.h:26
tue::config::Node::Node
Node(const Label &name, NodeType type)
Definition: node.h:24
tue::config::Node::firstChild
virtual bool firstChild(NodeIdx &)
Definition: node.h:51
tue::config::Node::empty
virtual bool empty() const =0
tue
tue::config::Variant
Definition: variant.h:111
config
tue::config::ReaderWriter config
Definition: sdf_gtest.cpp:9