Class which represents one node from a metadata tree.
More...
#include <iolink/metadata/MetadataNode.h>
Class which represents one node from a metadata tree.
Each node contains a key and also an associated value (optional). It also contains a list of nodes which represents its children in the tree. Children can be parsed using '(Const)MetadataNodeIterator' objects provided by '(c)begin' and '(c)end' methods, or directly can be retrieved thanks to 'child' accessor method.
◆ MetadataNode()
iolink::MetadataNode::MetadataNode |
( |
const std::string & |
key, |
|
|
std::shared_ptr< VariantDataValue > |
value |
|
) |
| |
Constructor which takes a mandatory key, and an optional value.
- Parameters
-
key | string which identifies the node |
value | VariantDataValue object associated to the key (or null) |
◆ addChild()
void iolink::MetadataNode::addChild |
( |
std::shared_ptr< MetadataNode > |
child | ) |
|
Add a node as child.
If the given child key already exists in the current node, existing child is replaced by new one
- Parameters
-
child | node to add as child to the current node |
◆ child() [1/2]
std::shared_ptr< MetadataNode > iolink::MetadataNode::child |
( |
const std::string & |
key | ) |
|
Return the child node with the given key.
- Parameters
-
key | the key corresponding to one of the children of current node |
- Returns
- the child corresponding to given key
- Exceptions
-
Error | If the key is not found in the children of the current node |
◆ child() [2/2]
std::shared_ptr< const MetadataNode > iolink::MetadataNode::child |
( |
const std::string & |
key | ) |
const |
Return the child node with the given key.
- Parameters
-
key | the key corresponding to one of the children of current node |
- Returns
- the child corresponding to given key
- Exceptions
-
Error | If the key is not found in the children of the current node |
◆ clone()
std::shared_ptr< MetadataNode > iolink::MetadataNode::clone |
( |
| ) |
const |
Method to clone the current node.
- Returns
- the new node
◆ hasChild()
bool iolink::MetadataNode::hasChild |
( |
const std::string & |
key | ) |
const |
Indicate if a child identified by its key is present or not.
- Parameters
-
key | the key corresponding to a child or not of current node |
- Returns
- If the node has a child with given key
◆ key()
const std::string & iolink::MetadataNode::key |
( |
| ) |
const |
Accessor to the key of the current node.
- Returns
- the current node key
◆ removeChild()
void iolink::MetadataNode::removeChild |
( |
const std::string & |
key | ) |
|
Remove child identified by its key.
- Parameters
-
key | Key whose node must be removed |
◆ value()
Accessor to the value of the current node.
- Returns
- the current node value
The documentation for this class was generated from the following file: