EventFilter
Utilities
src
JSONSerializer.cc
Go to the documentation of this file.
1
/*
2
* JSONSerializer.cc
3
*
4
* Created on: Aug 2, 2012
5
* Author: aspataru
6
*/
7
8
#include "
EventFilter/Utilities/interface/JSONSerializer.h
"
9
10
#include <cassert>
11
12
using namespace
jsoncollector
;
13
14
bool
JSONSerializer::serialize
(
JsonSerializable
* pObj,
std::string
&
output
) {
15
assert
(pObj !=
nullptr
);
16
17
Json::Value
serializeRoot;
18
pObj->
serialize
(serializeRoot);
19
20
Json::StyledWriter
writer
;
21
output
=
writer
.write(serializeRoot);
22
23
return
true
;
24
}
25
26
bool
JSONSerializer::deserialize
(
JsonSerializable
* pObj,
std::string
&
input
) {
27
assert
(pObj !=
nullptr
);
28
29
Json::Value
deserializeRoot;
30
Json::Reader
reader
;
31
32
if
(!
reader
.parse(
input
, deserializeRoot))
33
return
false
;
34
35
pObj->
deserialize
(deserializeRoot);
36
37
return
true
;
38
}
input
static const std::string input
Definition:
EdmProvDump.cc:48
convertSQLitetoXML_cfg.output
output
Definition:
convertSQLitetoXML_cfg.py:32
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
jsoncollector::JsonSerializable
Definition:
JsonSerializable.h:14
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
jsoncollector::JsonSerializable::deserialize
virtual void deserialize(Json::Value &root)=0
JSONSerializer.h
jsoncollector
Definition:
DataPoint.h:26
jsoncollector::JSONSerializer::serialize
static bool serialize(JsonSerializable *pObj, std::string &output)
Definition:
JSONSerializer.cc:14
jsoncollector::JSONSerializer::deserialize
static bool deserialize(JsonSerializable *pObj, std::string &input)
Definition:
JSONSerializer.cc:26
Json::Value
Represents a JSON value.
Definition:
value.h:99
Generated for CMSSW Reference Manual by
1.8.16