|
ARON offers ways to simply convert any aron object into another representation (e.g. from variant to nlohmann::json
or vice versa). To do so, it makes use of specific readers and writers. In the following we will only describe the readers, writers and converters for ARON data, not for types (but the principle is the same).
An ARON reader is used to get information of an ARON object in a specific representation. Assume you have an nlohmann::json
aron object which contains some information (for example, it is a dict, containing some members, ...). We need this information to create another object in another representation with the same content.
To do so, you only have to implement the armarx::aron::data::ReaderInterface
class. It needs one template parameter for your InputType (e.g. here const nlohmann::json
).
The interface provides the following pure virtual methods:
You have to implement the function so that the non-const arguments of the method will be filled with the values of the input. For example, the implementation of the readString method for the nlohmann::json
reader would be:
Of course, the way to get the member depend on the way how to construct (writer) the nlohmann::json
.