Utilities
Utilities header only library
utils::SerializableJson Struct Referenceabstract

Abstration of a class that supports serialization to json strings. More...

Inheritance diagram for utils::SerializableJson:
[legend]

Public Member Functions

std::string Serialize () const
 Stores object to json string.
 
bool Deserialize (const std::string &json_string)
 Loads object from json string.
 
virtual void AddToJsonNode (nlohmann::json &node) const =0
 Fill data of this to json node.
 
virtual bool ReadFromJsonNode (const nlohmann::json &node)=0
 Read json node and initialize this. More...
 

Detailed Description

Abstration of a class that supports serialization to json strings.

When inheriting this class, be sure to overload methods AddToJsonNode and ReadFromJsonNode, that should contain implementation of your json serialization.

Member Function Documentation

◆ ReadFromJsonNode()

virtual bool utils::SerializableJson::ReadFromJsonNode ( const nlohmann::json &  node)
pure virtual

Read json node and initialize this.

Exceptions
nlohmann::json::exceptionwhen required keys are missing.

Implemented in utils::IntrinsicParams, and utils::ScannerParams.