CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Protected Attributes
jsoncollector::DataPoint Class Reference

#include <DataPoint.h>

Inheritance diagram for jsoncollector::DataPoint:
jsoncollector::JsonSerializable

Public Member Functions

void addToData (std::string data)
 
 DataPoint ()
 
 DataPoint (std::string source, std::string definition, const std::vector< std::string > &data)
 
virtual void deserialize (Json::Value &root)
 
std::vector< std::string > getData () const
 
std::string getDefinition () const
 
std::string getSource () const
 
void resetData ()
 
virtual void serialize (Json::Value &root) const
 
void setDefinition (std::string definition)
 
void setSource (std::string source)
 
virtual ~DataPoint ()
 
- Public Member Functions inherited from jsoncollector::JsonSerializable
virtual ~JsonSerializable ()
 

Static Public Attributes

static const std::string DATA = "data"
 
static const std::string DEFINITION = "definition"
 
static const std::string SOURCE = "source"
 

Protected Attributes

std::vector< std::string > data_
 
std::string definition_
 
std::string source_
 

Detailed Description

Definition at line 17 of file DataPoint.h.

Constructor & Destructor Documentation

DataPoint::DataPoint ( )

Definition at line 18 of file DataPoint.cc.

18  :
19  source_(""), definition_("") {
20 }
std::string definition_
Definition: DataPoint.h:63
jsoncollector::DataPoint::DataPoint ( std::string  source,
std::string  definition,
const std::vector< std::string > &  data 
)
DataPoint::~DataPoint ( )
virtual

Definition at line 26 of file DataPoint.cc.

26  {
27 }

Member Function Documentation

void jsoncollector::DataPoint::addToData ( std::string  data)
inline

Definition at line 50 of file DataPoint.h.

References data_.

Referenced by jsoncollector::ObjectMerger::csvToJson(), and jsoncollector::DataPointMonitor::snap().

50  {
51  data_.push_back(data);
52  }
std::vector< std::string > data_
Definition: DataPoint.h:64
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void DataPoint::deserialize ( Json::Value root)
virtual

JSON deserialization procedure for this class

Implements jsoncollector::JsonSerializable.

Definition at line 36 of file DataPoint.cc.

References Json::Value::asString(), DATA, data_, DEFINITION, definition_, Json::Value::get(), i, Json::Value::isArray(), Json::Value::size(), findQualityFiles::size, SOURCE, and source_.

Referenced by FedRawDataInputSource::grabNextJsonFile().

36  {
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 }
Value get(UInt index, const Value &defaultValue) const
int i
Definition: DBlmapReader.cc:9
static const std::string DEFINITION
Definition: DataPoint.h:59
static const std::string DATA
Definition: DataPoint.h:60
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 asString() const
tuple size
Write out results.
static const std::string SOURCE
Definition: DataPoint.h:58
std::vector<std::string> jsoncollector::DataPoint::getData ( void  ) const
inline

Definition at line 40 of file DataPoint.h.

References data_.

Referenced by FedRawDataInputSource::grabNextJsonFile(), and serialize().

40  {
41  return data_;
42  }
std::vector< std::string > data_
Definition: DataPoint.h:64
std::string jsoncollector::DataPoint::getDefinition ( ) const
inline

Definition at line 37 of file DataPoint.h.

References definition_.

Referenced by serialize().

37  {
38  return definition_;
39  }
std::string definition_
Definition: DataPoint.h:63
std::string jsoncollector::DataPoint::getSource ( ) const
inline

Definition at line 34 of file DataPoint.h.

References source_.

Referenced by serialize().

34  {
35  return source_;
36  }
void jsoncollector::DataPoint::resetData ( )
inline

Definition at line 53 of file DataPoint.h.

References data_.

Referenced by jsoncollector::ObjectMerger::csvToJson(), and jsoncollector::DataPointMonitor::snap().

53  {
54  data_.clear();
55  }
std::vector< std::string > data_
Definition: DataPoint.h:64
void DataPoint::serialize ( Json::Value root) const
virtual

JSON serialization procedure for this class

Implements jsoncollector::JsonSerializable.

Definition at line 29 of file DataPoint.cc.

References python.multivaluedict::append(), DATA, DEFINITION, getData(), getDefinition(), getSource(), i, and SOURCE.

29  {
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 }
int i
Definition: DBlmapReader.cc:9
static const std::string DEFINITION
Definition: DataPoint.h:59
static const std::string DATA
Definition: DataPoint.h:60
std::string getDefinition() const
Definition: DataPoint.h:37
std::vector< std::string > getData() const
Definition: DataPoint.h:40
std::string getSource() const
Definition: DataPoint.h:34
static const std::string SOURCE
Definition: DataPoint.h:58
void jsoncollector::DataPoint::setDefinition ( std::string  definition)
inline

Definition at line 47 of file DataPoint.h.

References definition_.

Referenced by jsoncollector::ObjectMerger::csvToJson(), and jsoncollector::DataPointMonitor::snap().

47  {
48  definition_ = definition;
49  }
std::string definition_
Definition: DataPoint.h:63
void jsoncollector::DataPoint::setSource ( std::string  source)
inline

Definition at line 44 of file DataPoint.h.

References source, and source_.

Referenced by jsoncollector::FastMonitor::outputFullHistoDataPoint(), and jsoncollector::DataPointMonitor::snap().

44  {
45  source_ = source;
46  }
static std::string const source
Definition: EdmProvDump.cc:43

Member Data Documentation

const string DataPoint::DATA = "data"
static

Definition at line 60 of file DataPoint.h.

Referenced by deserialize(), and serialize().

std::vector<std::string> jsoncollector::DataPoint::data_
protected

Definition at line 64 of file DataPoint.h.

Referenced by addToData(), deserialize(), getData(), and resetData().

const string DataPoint::DEFINITION = "definition"
static

Definition at line 59 of file DataPoint.h.

Referenced by deserialize(), and serialize().

std::string jsoncollector::DataPoint::definition_
protected

Definition at line 63 of file DataPoint.h.

Referenced by deserialize(), getDefinition(), and setDefinition().

const string DataPoint::SOURCE = "source"
static

Definition at line 58 of file DataPoint.h.

Referenced by deserialize(), and serialize().

std::string jsoncollector::DataPoint::source_
protected