CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DataPoint.cc
Go to the documentation of this file.
1 /*
2  * DataPoint.cc
3  *
4  * Created on: Sep 24, 2012
5  * Author: aspataru
6  */
7 
8 #include "../interface/DataPoint.h"
9 
10 using namespace jsoncollector;
11 using std::string;
12 using std::vector;
13 
14 const string DataPoint::SOURCE = "source";
15 const string DataPoint::DEFINITION = "definition";
16 const string DataPoint::DATA = "data";
17 
19  source_(""), definition_("") {
20 }
21 
22 DataPoint::DataPoint(string source, string definition, const std::vector<string>& data) :
23  source_(source), definition_(definition), data_(data) {
24 }
25 
27 }
28 
30  root[SOURCE] = getSource();
31  root[DEFINITION] = getDefinition();
32  for (unsigned int i = 0; i < getData().size(); i++)
33  root[DATA].append(getData()[i]);
34 }
35 
37  source_ = root.get(SOURCE, "").asString();
38  definition_ = root.get(DEFINITION, "").asString();
39  if (root.get(DATA, "").isArray()) {
40  unsigned int size = root.get(DATA, "").size();
41  for (unsigned int i = 0; i < size; i++) {
42  data_.push_back(root.get(DATA, "")[i].asString());
43  }
44  }
45 }
46 
Value get(UInt index, const Value &defaultValue) const
int i
Definition: DBlmapReader.cc:9
static const std::string DEFINITION
Definition: DataPoint.h:59
virtual void serialize(Json::Value &root) const
Definition: DataPoint.cc:29
static const std::string DATA
Definition: DataPoint.h:60
Represents a JSON value.
Definition: value.h:111
std::string definition_
Definition: DataPoint.h:63
UInt size() const
Number of values in array or object.
bool isArray() const
std::vector< std::string > data_
Definition: DataPoint.h:64
std::string getDefinition() const
Definition: DataPoint.h:37
virtual void deserialize(Json::Value &root)
Definition: DataPoint.cc:36
std::vector< std::string > getData() const
Definition: DataPoint.h:40
std::string asString() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::string getSource() const
Definition: DataPoint.h:34
static std::string const source
Definition: EdmProvDump.cc:43
tuple size
Write out results.
static const std::string SOURCE
Definition: DataPoint.h:58
string root
initialization
Definition: dbtoconf.py:70