lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::JsonIterator Class Reference

Walks a JSON value depth-first (object members in sorted order) and calls process() for each leaf, keeping the dotted name path; a parallel types value describes the leaves. More...

#include <Json2Xtc.hh>

Public Member Functions

 JsonIterator (rapidjson::Value &root, rapidjson::Value &types)
 Keep references to the value root to walk and to the matching types description.
 
void iterate ()
 Walk the root value, calling process() for every scalar and every array that contains no objects or arrays.
 
std::string curname ()
 Return the current path: names joined with dots, and array indices appended with underscores.
 
virtual void process (rapidjson::Value &val)
 Hook called for each leaf; the default does nothing.
 

Static Public Attributes

static std::map< std::string, enum XtcData::Name::DataType > typeMap
 Map from type name strings (UINT8, ..., DOUBLE, CHARSTR, ENUMVAL, ENUMDICT) to XtcData::Name data types.
 

Protected Member Functions

void iterate (rapidjson::Value &val)
 
rapidjson::Value * findJsonType ()
 

Detailed Description

Walks a JSON value depth-first (object members in sorted order) and calls process() for each leaf, keeping the dotted name path; a parallel types value describes the leaves.

Constructor & Destructor Documentation

◆ JsonIterator()

Pds::JsonIterator::JsonIterator ( rapidjson::Value &  root,
rapidjson::Value &  types 
)
inline

Keep references to the value root to walk and to the matching types description.

Member Function Documentation

◆ curname()

std::string Pds::JsonIterator::curname ( )

Return the current path: names joined with dots, and array indices appended with underscores.

◆ findJsonType()

rapidjson::Value * Pds::JsonIterator::findJsonType ( )
protected

◆ iterate() [1/2]

void Pds::JsonIterator::iterate ( )
inline

Walk the root value, calling process() for every scalar and every array that contains no objects or arrays.

◆ iterate() [2/2]

void Pds::JsonIterator::iterate ( rapidjson::Value &  val)
protected

◆ process()

virtual void Pds::JsonIterator::process ( rapidjson::Value &  val)
inlinevirtual

Hook called for each leaf; the default does nothing.

Member Data Documentation

◆ typeMap

std::map<std::string, enum XtcData::Name::DataType> Pds::JsonIterator::typeMap
static

Map from type name strings (UINT8, ..., DOUBLE, CHARSTR, ENUMVAL, ENUMDICT) to XtcData::Name data types.


The documentation for this class was generated from the following file: