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::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: YCPPPathErrorif the path expression in invalid, See error code for details.Raises: YCPPInvalidArgumentErrorif the argument is invalid.
- virtual SchemaNode *
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 *>
children() const¶Get the children of this
SchemaNodein 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
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: Pointer to
DataNodecreated.Raises:
YCPPInvalidArgumentErrorIn case the argument is invalid.Raises:
YCPPPathErrorIn case the path is invalid.
- virtual DataNode *
create(const std::string &path, const std::string &value) const¶Create a
DataNodecorresponding 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-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: DataNodecreated ornullptr.Raises: YCPPInvalidArgumentErrorIn case the argument is invalid.Raises: YCPPPathErrorIn case the path is invalid.
- virtual Statement
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 Rpc *
rpc(const std::string &path) const¶Create an
Rpcinstance.The path expression should point to a
SchemaNodethat represents theRpc.
Parameters: path – The path to the rpc schema node Returns: Pointer to Rpcornullptr.Raises: YCPPInvalidArgumentErrorif the argument is invalid.Raises: YCPPPathErrorif the path is invalid.