|
| data::Descriptor | getDescriptor (ReturnTypeConst &input) final |
| |
| | NlohmannJSONWriter ()=default |
| |
| nlohmann::json | writeBool (const bool i, const Path &p=Path()) override |
| |
| nlohmann::json | writeDict (const std::map< std::string, nlohmann::json > &elements, const std::optional< nlohmann::json > &extends=std::nullopt, const Path &p=Path()) override |
| |
| nlohmann::json | writeDict (std::map< std::string, nlohmann::json > &&elements, const std::optional< nlohmann::json > &extends, const Path &p) override |
| | Overload for callers that no longer need elements afterwards - which is the case for all generated write() code, since it builds the element map purely to hand it over.
|
| |
| nlohmann::json | writeDouble (const double i, const Path &p=Path()) override |
| |
| nlohmann::json | writeFloat (const float i, const Path &p=Path()) override |
| |
| void | writeImportance (ReturnType &output, const std::optional< float > &importance) final |
| |
| nlohmann::json | writeInt (const int i, const Path &p=Path()) override |
| |
| nlohmann::json | writeList (const std::vector< nlohmann::json > &elements, const Path &p=Path()) override |
| |
| nlohmann::json | writeList (std::vector< nlohmann::json > &&elements, const Path &p) override |
| | std::map<std::string, json> IS nlohmann's object_t and std::vector<json> IS array_t, so assigning one by const reference deep-copies every descendant – and the converter aggregates bottom-up, so that happens once per level of nesting.
|
| |
| nlohmann::json | writeLong (const long i, const Path &p=Path()) override |
| |
| nlohmann::json | writeNDArray (const std::vector< int > &shape, const std::string &typeAsString, const unsigned char *data, const Path &p=Path()) override |
| |
| nlohmann::json | writeString (const std::string &i, const Path &p=Path()) override |
| |
| virtual data::Descriptor | getDescriptor (ReturnTypeConst &input)=0 |
| |
| virtual ReturnType | writeNull () |
| |
| ReturnType | writePrimitive (const bool i, const Path &p=Path()) |
| |
| ReturnType | writePrimitive (const double i, const Path &p=Path()) |
| |
| ReturnType | writePrimitive (const float i, const Path &p=Path()) |
| |
| ReturnType | writePrimitive (const int i, const Path &p=Path()) |
| |
| ReturnType | writePrimitive (const long i, const Path &p=Path()) |
| |
| ReturnType | writePrimitive (const std::string &i, const Path &p=Path()) |
| |
| virtual | ~WriterInterface ()=default |
| |
| nlohmann::json writeDict |
( |
std::map< std::string, nlohmann::json > && | elements, |
|
|
const std::optional< nlohmann::json > & | extends, |
|
|
const Path & | p ) |
|
overridevirtual |
Overload for callers that no longer need elements afterwards - which is the case for all generated write() code, since it builds the element map purely to hand it over.
The default implementation forwards to the copying overload, so writers that cannot take ownership need not implement anything. Writers that can (see VariantWriter) override this to avoid rebuilding the map element by element.
Reimplemented from WriterInterface< nlohmann::json >.
| nlohmann::json writeList |
( |
std::vector< nlohmann::json > && | elements, |
|
|
const Path & | p ) |
|
overridevirtual |
std::map<std::string, json> IS nlohmann's object_t and std::vector<json> IS array_t, so assigning one by const reference deep-copies every descendant – and the converter aggregates bottom-up, so that happens once per level of nesting.
These take ownership and move instead.
Reimplemented from WriterInterface< nlohmann::json >.