RootSchemaNode¶
Instances of this class represent the Root of the SchemaTree.
A RootSchemaNode
can be used to instantiate a DataNode
tree or an Rpc
object. The children of the RootSchemaNode
represent the top level SchemaNode
in the YANG module submodules.
-
class
RootSchemaNode
: public SchemaNode¶
Instances of this class represent the Root of the SchemaNode
Tree.
- virtual
~RootSchemaNode
()¶Destructor for the
RootSchemaNode
- std::string
path
() const¶Get the path expression representing this Node in in the NodeTree.
Returns: std::string
representing the path to this Node.
- virtual std::vector<SchemaNode *>
find
(const std::string &path) const¶Finds descendant nodes that match the given xpath expression.
This API finds descendant nodes in the
SchemaNode
tree that satisfy the given path expression. See how to path.
Parameters: path – The path expression. Returns: Vector of SchemaNode
that satisfies the criterion.Raises: YCPPPathError
if the path expression in invalid, See error code for details.Raises: YCPPInvalidArgumentError
if the argument is invalid.
- virtual SchemaNode *
parent
() const noexcept¶Get the parent node of this
SchemaNode
in the tree.
Returns: Pointer to the parent node or nullptr
in case this is the root.
- virtual std::vector<SchemaNode *>
children
() const¶Get the children of this
SchemaNode
in the NodeTree.
Returns: The children of this node.
- virtual const SchemaNode *
root
() const noexcept¶Get the root of NodeTree this node is part of.
Returns: The pointer to the root.
- virtual DataNode *
create
(const std::string &path, const std::string &value) const¶Create a
DataNode
corresponding to the path and set its value.This methods creates a
DataNode
tree based on the path passed in. The path expression must identify a single node. If the last node created is of schema typelist
,leaf-list
oranyxml
that value is also set in the node.The returned
DataNode
is the last node created (the terminal part of the path).The user is responsible for managing the memory of this returned tree. Use
root()
to get the root element of the this tree and use that pointer to dispose of the entire tree.Note in the case of List nodes the keys must be present in the path expression in the form of predicates.
Parameters:
- path – The XPath expression identifying the node relative to the root of the schema tree.
- value – The string representation of the value to set.
Returns: Pointer to
DataNode
created.Raises:
YCPPInvalidArgumentError
In case the argument is invalid.Raises:
YCPPPathError
In case the path is invalid.
- virtual DataNode *
create
(const std::string &path, const std::string &value) const¶Create a
DataNode
corresponding to the path and set its value.This methods creates a DataNode tree based on the path passed in. The path expression must identify a single node. If the last node created is of schema type
list
,leaf-list
oranyxml
that value is also set in the node.The returned
DataNode
is the last node created (the terminal part of the path).The user is responsible for managing the memory of this returned tree. Use
root()
to get the root element of the this tree and use that pointer to dispose of the entire tree.Note in the case of List nodes the keys must be present in the path expression in the form of predicates.
Parameters: path – The XPath expression identifying the node. Returns: DataNode
created ornullptr
.Raises: YCPPInvalidArgumentError
In case the argument is invalid.Raises: YCPPPathError
In case the path is invalid.
- virtual Statement
statement
() const¶Return the
Statement
representing thisSchemaNode
.Note the
RootSchemaNode
has no YANG statement representing it.So this method returns an empty statement.
Returns: An empty statement.
- virtual Rpc *
rpc
(const std::string &path) const¶Create an
Rpc
instance.The path expression should point to a
SchemaNode
that represents theRpc
.
Parameters: path – The path to the rpc schema node Returns: Pointer to Rpc
ornullptr
.Raises: YCPPInvalidArgumentError
if the argument is invalid.Raises: YCPPPathError
if the path is invalid.