CodecService¶
Codec Service class for supporting encoding and decoding C++ model API objects of type Entity
CodecService
()¶Constructs an instance of CodecService
- std::string
encode
(CodecServiceProvider &provider, Entity &entity, bool pretty = false)¶Perform encoding
Parameters:
- provider – An instance of
CodecServiceProvider
- entity – An instance of
Entity
class defined under a bundle- pretty – Optionally produce formatted output
Returns: Encoded payload in the form of
std::string
Raises YCPPError: If an error has occurred
- std::unique_ptr<ydk::Entity>
decode
(CodecServiceProvider &provider, const std::string &payload)¶Decode the payload to produce an instance of Entity
Parameters:
- provider – An instance of
CodecServiceProvider
- payload – Payload to be decoded
Returns: A pointer to an instance of the decoded
Entity
Raises YCPPError: If an error has occurred