| IOLink 1.11.0

Loading...
Searching...
No Matches
MetadataNode.h
1#pragma once
2
3#include <memory>
4#include <mutex>
5#include <string>
6
7#include <iolink/VariantDataValue.h>
8#include <iolink/metadata/MetadataNodeIterator.h>
9
10 namespace iolink
11{
12
20 class IOLINK_API MetadataNode
21{
22 public:
28 MetadataNode(const std::string& key, std::shared_ptr<VariantDataValue> value);
29
30 MetadataNode(const MetadataNode& other);
31 MetadataNode& operator=(const MetadataNode& other);
32
33 MetadataNode(MetadataNode&& other) noexcept;
34 MetadataNode& operator=(MetadataNode&& other) noexcept;
35
36 ~MetadataNode();
37
42 std::shared_ptr<MetadataNode> clone() const;
43
48 const std::string& key() const;
49
54 std::shared_ptr<VariantDataValue> value() const;
55
59 size_t childCount() const;
60
67 bool hasChild(const std::string& key) const;
68
76 std::shared_ptr<const MetadataNode> child(const std::string& key) const;
77
85 std::shared_ptr<MetadataNode> child(const std::string& key);
86
92 void addChild(std::shared_ptr<MetadataNode> child);
93
98 void removeChild(const std::string& key);
99
103 MetadataNodeIterator begin();
104
108 MetadataNodeIterator end();
109
113 ConstMetadataNodeIterator begin() const;
114
118 ConstMetadataNodeIterator end() const;
119
123 ConstMetadataNodeIterator cbegin() const;
124
128 ConstMetadataNodeIterator cend() const;
129
133 std::string toString() const;
134
135 private:
136 class Private;
137 Private* m_private;
138};
139
140} // end namespace iolink
iolink::ConstMetadataNodeIterator
Class represents a const iterator on a list of Metadata nodes.
Definition MetadataNodeIterator.h:46
iolink::MetadataNode
Class which represents one node from a metadata tree.
Definition MetadataNode.h:21
iolink::MetadataNode::end
MetadataNodeIterator end()
Return iterator which indicates the end of children list.
iolink::MetadataNode::MetadataNode
MetadataNode(const std::string &key, std::shared_ptr< VariantDataValue > value)
Constructor which takes a mandatory key, and an optional value.
iolink::MetadataNode::toString
std::string toString() const
Return a string representation.
iolink::MetadataNode::childCount
size_t childCount() const
Return the children's count of this node.
iolink::MetadataNode::hasChild
bool hasChild(const std::string &key) const
Indicate if a child identified by its key is present or not.
iolink::MetadataNode::key
const std::string & key() const
Accessor to the key of the current node.
iolink::MetadataNode::cend
ConstMetadataNodeIterator cend() const
Return const iterator which indicates the end of children list.
iolink::MetadataNode::cbegin
ConstMetadataNodeIterator cbegin() const
Return const iterator on first child.
iolink::MetadataNode::child
std::shared_ptr< MetadataNode > child(const std::string &key)
Return the child node with the given key.
iolink::MetadataNode::addChild
void addChild(std::shared_ptr< MetadataNode > child)
Add a node as child.
iolink::MetadataNode::begin
MetadataNodeIterator begin()
Return iterator on first child.
iolink::MetadataNode::clone
std::shared_ptr< MetadataNode > clone() const
Method to clone the current node.
iolink::MetadataNode::child
std::shared_ptr< const MetadataNode > child(const std::string &key) const
Return the child node with the given key.
iolink::MetadataNode::end
ConstMetadataNodeIterator end() const
Return iterator which indicates the end of children list.
iolink::MetadataNode::begin
ConstMetadataNodeIterator begin() const
Return iterator on first child.
iolink::MetadataNode::value
std::shared_ptr< VariantDataValue > value() const
Accessor to the value of the current node.
iolink::MetadataNode::removeChild
void removeChild(const std::string &key)
Remove child identified by its key.
iolink::MetadataNodeIterator
Class represents an iterator on a list of Metadata nodes.
Definition MetadataNodeIterator.h:16
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8