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
SchemaNodeTree. ARootSchemaNodecan be used to instantiate aDataNodetree or anRpcobject. The children of theRootSchemaNoderepresent the top levelSchemaNodein 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::stringrepresenting 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
SchemaNodetree that satisfy the given path expression. See how to path.Parameters: path – The path expression. Returns: Vector of SchemaNodethat satisfies the criterion.Raises: YPathErrorif the path expression in invalid, See error code for details.Raises: YInvalidArgumentErrorif the argument is invalid.
-
virtual SchemaNode *
get_parent() const noexcept¶ Get the parent node of this
SchemaNodein the tree.Returns: Pointer to the parent node or nullptrin case this is the root.
-
virtual std::vector<SchemaNode *>
get_children() const¶ Get the children of this
SchemaNodein 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
DataNodecorresponding to the path and set its value.This methods creates a
DataNodetree based on the path passed in. The path expression must identify a single node. If the last node created is of schema typelist,leaf-listoranyxmlthat value is also set in the node.The returned
DataNodeis 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
DataNodecreated.Raises: YInvalidArgumentErrorIn case the argument is invalid.Raises: YPathErrorIn case the path is invalid.
-
virtual DataNode &
create_datanode(const std::string &path) const¶ Create a
DataNodecorresponding 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-listoranyxmlthat value is also set in the node.The returned
DataNodeis 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 DataNodecreated.Raises: YInvalidArgumentErrorIn case the argument is invalid.Raises: YPathErrorIn case the path is invalid.
-
virtual Statement
get_statement() const¶ Return the
Statementrepresenting thisSchemaNode.Note the
RootSchemaNodehas 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 Statementthat 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
SchemaNodethat represents theRpc.Parameters: path – The path to the rpc schema node Returns: Pointer to Rpcornullptr.Raises: YInvalidArgumentErrorif the argument is invalid.Raises: YPathErrorif the path is invalid.
-
virtual