CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
jsoncollector::JSONSerializer Class Reference

#include <JSONSerializer.h>

Public Member Functions

 JSONSerializer ()
 
virtual ~JSONSerializer ()
 

Static Public Member Functions

static bool deserialize (JsonSerializable *pObj, std::string &input)
 
static bool serialize (JsonSerializable *pObj, std::string &output)
 

Detailed Description

Definition at line 16 of file JSONSerializer.h.

Constructor & Destructor Documentation

◆ JSONSerializer()

jsoncollector::JSONSerializer::JSONSerializer ( )

◆ ~JSONSerializer()

virtual jsoncollector::JSONSerializer::~JSONSerializer ( )
virtual

Member Function Documentation

◆ deserialize()

bool JSONSerializer::deserialize ( JsonSerializable pObj,
std::string &  input 
)
static

Deserializes input from a string to the JsonSerializable object

Definition at line 26 of file JSONSerializer.cc.

26  {
27  assert(pObj != nullptr);
28 
29  Json::Value deserializeRoot;
31 
32  if (!reader.parse(input, deserializeRoot))
33  return false;
34 
35  pObj->deserialize(deserializeRoot);
36 
37  return true;
38 }

References cms::cuda::assert(), jsoncollector::JsonSerializable::deserialize(), input, and DQM::reader.

Referenced by jsoncollector::DataPointDefinition::getDataPointDefinitionFor().

◆ serialize()

bool JSONSerializer::serialize ( JsonSerializable pObj,
std::string &  output 
)
static

Serializes a JsonSerializable object to output string

Definition at line 14 of file JSONSerializer.cc.

14  {
15  assert(pObj != nullptr);
16 
17  Json::Value serializeRoot;
18  pObj->serialize(serializeRoot);
19 
21  output = writer.write(serializeRoot);
22 
23  return true;
24 }

References cms::cuda::assert(), convertSQLitetoXML_cfg::output, jsoncollector::JsonSerializable::serialize(), and cscNeutronWriter_cfi::writer.

Referenced by evf::EvFOutputJSONWriter::EvFOutputJSONWriter(), evf::GlobalEvFOutputJSONDef::GlobalEvFOutputJSONDef(), and evf::RecoEventOutputModuleForFU< Consumer >::initRun().

input
static const std::string input
Definition: EdmProvDump.cc:48
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
cms::cuda::assert
assert(be >=bs)
cscNeutronWriter_cfi.writer
writer
Definition: cscNeutronWriter_cfi.py:6
Json::Reader
Unserialize a JSON document into a Value.
Definition: reader.h:16
DQM.reader
reader
Definition: DQM.py:105
Json::StyledWriter
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:63
jsoncollector::JsonSerializable::serialize
virtual void serialize(Json::Value &root) const =0
jsoncollector::JsonSerializable::deserialize
virtual void deserialize(Json::Value &root)=0
Json::Value
Represents a JSON value.
Definition: value.h:99