RootSchemaNode¶
Instances of this class represent the Root of the SchemaTree.
-
class
ydk::path::
RootSchemaNode
: public SchemaNode¶ Instances of this class represent the Root of the
SchemaNode
Tree. ARootSchemaNode
can be used to instantiate aDataNode
tree or anRpc
object. The children of theRootSchemaNode
represent the top levelSchemaNode
in the YANG module submodules.-
virtual
~RootSchemaNode
()¶ Destructor for the
RootSchemaNode
-
std::string
get_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: YPathError
if the path expression in invalid, See error code for details.Raises: YInvalidArgumentError
if the argument is invalid.
-
virtual SchemaNode *
get_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 *>
get_children
() const¶ Get the children of this
SchemaNode
in the NodeTree.Returns: The children of this node.
-
virtual const SchemaNode &
get_root
() const noexcept¶ Get the root of NodeTree this node is part of.
Returns: Reference to the root.
-
virtual DataNode &
create_datanode
(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: Reference to
DataNode
created.Raises: YInvalidArgumentError
In case the argument is invalid.Raises: YPathError
In case the path is invalid.
-
virtual DataNode &
create_datanode
(const std::string &path) const¶ Create a
DataNode
corresponding to the path.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: Reference to DataNode
created.Raises: YInvalidArgumentError
In case the argument is invalid.Raises: YPathError
In case the path is invalid.
-
virtual Statement
get_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 std::vector<Statement>
get_keys
() const¶ Returns vector of YANG statement corresponding the the keys.
Returns: Vector of Statement
that represent keys.
-
virtual std::shared_ptr<Rpc>
create_rpc
(const std::string &path) const¶ Create rpc and return pointer to this rpc.
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: YInvalidArgumentError
if the argument is invalid.Raises: YPathError
if the path is invalid.
-
virtual