openPMD-api
|
Extend nlohmann::json with tracing of which keys have been accessed by operator[](). More...
#include <JSON.hpp>
Public Member Functions | |
TracingJSON (nlohmann::json) | |
nlohmann::json & | json () |
Access the underlying JSON value. More... | |
template<typename Key > | |
TracingJSON | operator[] (Key &&key) |
const nlohmann::json & | getShadow () |
Get the "shadow", i.e. More... | |
nlohmann::json | invertShadow () |
Invert the "shadow", i.e. More... | |
void | declareFullyRead () |
Declare all keys of the current object read. | |
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.
const nlohmann::json & openPMD::auxiliary::TracingJSON::getShadow | ( | ) |
Get the "shadow", i.e.
a copy of the original JSON value containing all accessed object keys.
nlohmann::json openPMD::auxiliary::TracingJSON::invertShadow | ( | ) |
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.