Codec¶
Codec class is part of YDK path API, which operates on generic path-based YANG data nodes.
-
class
ydk::path::
Codec
¶ -
virtual std::string
encode
(const std::unique_ptr<DataNode> datanode, EncodingFormat format, bool pretty)¶ Encode the given DataNode Tree.
Parameters: Returns: The encoded string.
Raises: YInvalidArgumentError
, if errors appear during encoding.
-
virtual std::string
encode
(std::vector<DataNode *> data_nodes, EncodingFormat format, bool pretty)¶ Encode multiple DataNodes.
Parameters: Returns: The encoded string.
Raises: YInvalidArgumentError
, errors appear during encoding.
-
std::shared_ptr<DataNode>
decode
(const RootSchemaNode &root_schema, const std::string &payload, Format format)¶ Decode the buffer to return a DataNode.
Parameters: Returns: The
DataNode
instance ornullptr
in case of error.Raises: YInvalidArgumentError
, if errors appear during decoding.
-
std::shared_ptr<DataNode>
decode_rpc_output
(RootSchemaNode &root_schema, const std::string &payload, const std::string &rpc_path, EncodingFormat format)¶ Decode the rpc output to return a DataNode.
Parameters: Returns: The
DataNode
instance ornullptr
in case of error.Raises: YInvalidArgumentError
, if errors appear during decoding.
-
virtual std::string