CMS 3D CMS Logo

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 
9 
10 #include <cassert>
11 
12 using namespace jsoncollector;
13 
15  assert(pObj != nullptr);
16 
17  Json::Value serializeRoot;
18  pObj->serialize(serializeRoot);
19 
21  output = writer.write(serializeRoot);
22 
23  return true;
24 }
25 
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 }
static bool serialize(JsonSerializable *pObj, std::string &output)
reader
Definition: DQM.py:105
Represents a JSON value.
Definition: value.h:99
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:47
virtual void serialize(Json::Value &root) const =0
virtual void deserialize(Json::Value &root)=0
static bool deserialize(JsonSerializable *pObj, std::string &input)
Unserialize a JSON document into a Value.
Definition: reader.h:16
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:63