openPMD-api
|
Extend nlohmann::json with tracing of which keys have been accessed by operator[](). More...
#include <JSON_internal.hpp>
Public Member Functions | |
TracingJSON (nlohmann::json, SupportedLanguages) | |
TracingJSON (ParsedConfig) | |
nlohmann::json & | json () |
Access the underlying JSON value. More... | |
template<typename Key > | |
TracingJSON | operator[] (Key &&key) |
nlohmann::json const & | getShadow () const |
Get the "shadow", i.e. More... | |
nlohmann::json & | getShadow () |
nlohmann::json | invertShadow () const |
Invert the "shadow", i.e. More... | |
void | declareFullyRead () |
Declare all keys of the current object read. More... | |
Public Attributes | |
SupportedLanguages | originallySpecifiedAs {SupportedLanguages::JSON} |
Extend nlohmann::json with tracing of which keys have been accessed by operator[]().
An access is only registered if the current JSON value is a JSON object (not an array) and if the accessed JSON value is a leaf, i.e. anything but an object. This means that objects contained in arrays will not be traced.
If working directly with the underlying JSON value (necessary since this class only redefines operator[]), declareFullyRead() may be used to declare keys read manually.
void openPMD::json::TracingJSON::declareFullyRead | ( | ) |
Declare all keys of the current object read.
Rationale: This class does not (yet) trace array types (or anything contained in an array). Use this call to explicitly declare an array as read.
nlohmann::json const & openPMD::json::TracingJSON::getShadow | ( | ) | const |
Get the "shadow", i.e.
a copy of the original JSON value containing all accessed object keys.
nlohmann::json openPMD::json::TracingJSON::invertShadow | ( | ) | const |
Invert the "shadow", i.e.
a copy of the original JSON value that contains exactly those values that have not been accessed yet.
|
inline |
Access the underlying JSON value.