lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Json2Xtc.hh File Reference

Translation of configuration JSON (with :types: and :enum: descriptions) into XTC Names and data. More...

#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
#include "rapidjson/filereadstream.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/writer.h"
#include "xtcdata/xtc/DescData.hh"
#include "xtcdata/xtc/NamesLookup.hh"
#include "xtcdata/xtc/ShapesData.hh"
#include <python3.9/Python.h>
#include <string>
#include <vector>

Classes

class  Pds::JsonIterator
 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...
 

Namespaces

namespace  Pds
 Outer namespace of the HSD digitizer helpers.
 

Functions

int Pds::translateJson2Xtc (char *in, char *out, const void *bufEnd, XtcData::NamesId namesID, const char *detname=0, unsigned segment=0)
 Parse the JSON text in, create a Parent Xtc at out (bounded by bufEnd) and add the Names and data for it with namesID, detname (if non-null) and segment.
 
int Pds::translateJson2Xtc (PyObject *item, XtcData::Xtc &xtc, const void *bufEnd, XtcData::NamesId namesID)
 Translate the JSON string object item into Names and data appended to xtc, taking the detector name and segment from the detName:RO entry (name_N).
 
int Pds::translateJson2Xtc (PyObject *item, XtcData::Xtc &xtc, const void *bufEnd, XtcData::NamesId namesID, unsigned segment, std::string serNo=std::string(""))
 Like translateJson2Xtc(item, xtc, bufEnd, namesID), but uses serNo as detector ID when it is non-empty.
 
int Pds::translateJson2XtcNames (rapidjson::Document *d, XtcData::Xtc *xtc, const void *bufEnd, XtcData::NamesLookup &nl, XtcData::NamesId namesID, rapidjson::Value &json, const char *detname, unsigned segment, std::string const &serNo=std::string(""))
 Check that the document has alg:RO, detName:RO, detType:RO, detId:RO and doc:RO, add Names (detector name, algorithm, type, serNo or detId:RO, namesID, segment) with one entry per leaf typed from :types: (plus ENUMDICT entries for :enum:) to xtc, register them in nl, and move :types: into json.
 
int Pds::translateJson2XtcData (rapidjson::Document *d, XtcData::Xtc *xtc, const void *bufEnd, XtcData::NamesLookup &nl, XtcData::NamesId namesID, rapidjson::Value &json)
 Write the values of the remaining document members (and the :enum: dictionary values first) into xtc as data for namesID, typed from json; returns 0.
 

Detailed Description

Translation of configuration JSON (with :types: and :enum: descriptions) into XTC Names and data.