PVData C++
Classes | Functions
JSON print/parse

Classes

struct  epics::pvData::JSONPrintOptions
 Options used during printing. More...

Functions

epicsShareFunc void epics::pvData::printJSON (std::ostream &strm, const PVField::const_shared_pointer &val, const JSONPrintOptions &opts=JSONPrintOptions())
epicsShareFunc
PVStructure::shared_pointer 
epics::pvData::parseJSON (std::istream &strm)
epicsShareFunc void epics::pvData::parseJSON (std::istream &strm, const PVField::shared_pointer &dest, BitSet *assigned=0)
epicsShareFunc bool epics::pvData::yajl_parse_helper (std::istream &src, yajl_handle handle)

Detailed Description

Printing PVField as JSON and parsing JSON into PVField.


Function Documentation

epicsShareFunc PVStructure::shared_pointer epics::pvData::parseJSON ( std::istream &  strm)

Parse JSON text into a PVStructure

Restrictions:

  • Top level must be {} dict/object
  • field values must be number, string, array, or dict/object
  • array values must be number or string
epicsShareFunc void epics::pvData::parseJSON ( std::istream &  strm,
const PVField::shared_pointer &  dest,
BitSet *  assigned = 0 
)

Parse JSON and store into the provided PVStructure.

Restrictions:

  • array of union not supported
  • Only scalar value assigned to union
Parameters:
strmRead JSON text from stream
destStore in fields of this structure
assignedWhich fields of _dest_ were assigned. (Optional)
Exceptions:
std::runtime_erroron failure. dest and assigned may be modified.
epicsShareFunc void epics::pvData::printJSON ( std::ostream &  strm,
const PVField::const_shared_pointer &  val,
const JSONPrintOptions &  opts = JSONPrintOptions() 
)

Print PVStructure as JSON

Restrictions:

  • No support for union or array of union
epicsShareFunc bool epics::pvData::yajl_parse_helper ( std::istream &  src,
yajl_handle  handle 
)

Wrapper around yajl_parse()

Parse entire input stream. Errors if extranious non-whitespace found after the point were parsing completes.

Parameters:
srcThe stream from which input charactors are read
handleA parser handle previously allocated with yajl_alloc(). Not free'd on success or failure.
Returns:
true if parsing completes successfully. false if parsing cancelled by callback. throws other errors
Note:
The form of this call depends on EPICS_YAJL_VERSION
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator