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 | Private Attributes
jsoncollector::DataPointDefinition Class Reference

#include <DataPointDefinition.h>

Inheritance diagram for jsoncollector::DataPointDefinition:
jsoncollector::JsonSerializable

Public Member Functions

 DataPointDefinition ()
 
 DataPointDefinition (const std::vector< LegendItem > &legend)
 
virtual void deserialize (Json::Value &root)
 
std::vector< LegendItemgetLegend () const
 
LegendItem getLegendFor (unsigned int index) const
 
bool isPopulated () const
 
virtual void serialize (Json::Value &root) const
 
virtual ~DataPointDefinition ()
 
- Public Member Functions inherited from jsoncollector::JsonSerializable
virtual ~JsonSerializable ()
 

Static Public Attributes

static const std::string LEGEND = "legend"
 
static const std::string OPERATION = "operation"
 
static const std::string PARAM_NAME = "name"
 

Private Attributes

std::vector< LegendItemlegend_
 

Detailed Description

Definition at line 17 of file DataPointDefinition.h.

Constructor & Destructor Documentation

DataPointDefinition::DataPointDefinition ( )

Definition at line 18 of file DataPointDefinition.cc.

18  {
19 
20 }
DataPointDefinition::DataPointDefinition ( const std::vector< LegendItem > &  legend)

Definition at line 22 of file DataPointDefinition.cc.

22  :
23  legend_(legend) {
24 }
std::vector< LegendItem > legend_
DataPointDefinition::~DataPointDefinition ( )
virtual

Definition at line 26 of file DataPointDefinition.cc.

26  {
27 }

Member Function Documentation

void DataPointDefinition::deserialize ( Json::Value root)
virtual

JSON deserialization procedure for this class

Implements jsoncollector::JsonSerializable.

Definition at line 38 of file DataPointDefinition.cc.

References Json::Value::asString(), Json::Value::get(), i, Json::Value::isArray(), LEGEND, legend_, OPERATION, PARAM_NAME, Json::Value::size(), and findQualityFiles::size.

38  {
39  if (root.get(LEGEND, "").isArray()) {
40  unsigned int size = root.get(LEGEND, "").size();
41  for (unsigned int i = 0; i < size; i++) {
42  LegendItem currentLegendItem(
43  root.get(LEGEND, "")[i].get(PARAM_NAME, "").asString(),
44  root.get(LEGEND, "")[i].get(OPERATION, "").asString());
45  legend_.push_back(currentLegendItem);
46  }
47  }
48 }
Value get(UInt index, const Value &defaultValue) const
int i
Definition: DBlmapReader.cc:9
UInt size() const
Number of values in array or object.
static const std::string OPERATION
bool isArray() const
std::vector< LegendItem > legend_
static const std::string PARAM_NAME
std::string asString() const
tuple size
Write out results.
std::vector<LegendItem> jsoncollector::DataPointDefinition::getLegend ( ) const
inline
LegendItem DataPointDefinition::getLegendFor ( unsigned int  index) const

Returns a LegendItem object at the specified index

Definition at line 50 of file DataPointDefinition.cc.

References getHLTprescales::index, and legend_.

Referenced by jsoncollector::ObjectMerger::csvToJson(), jsoncollector::ObjectMerger::merge(), and serialize().

50  {
51  return legend_[index];
52 }
std::vector< LegendItem > legend_
bool DataPointDefinition::isPopulated ( ) const

Returns true if the legend_ has elements

Definition at line 54 of file DataPointDefinition.cc.

References getLegend(), and findQualityFiles::size.

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

54  {
55  if (getLegend().size() > 0)
56  return true;
57  return false;
58 }
tuple size
Write out results.
std::vector< LegendItem > getLegend() const
void DataPointDefinition::serialize ( Json::Value root) const
virtual

JSON serialization procedure for this class

Implements jsoncollector::JsonSerializable.

Definition at line 29 of file DataPointDefinition.cc.

References Json::Value::append(), getLegend(), getLegendFor(), jsoncollector::LegendItem::getName(), jsoncollector::LegendItem::getOperation(), i, LEGEND, OPERATION, and PARAM_NAME.

29  {
30  for (unsigned int i = 0; i < getLegend().size(); i++) {
31  Json::Value currentDef;
32  currentDef[PARAM_NAME] = getLegendFor(i).getName();
33  currentDef[OPERATION] = getLegendFor(i).getOperation();
34  root[LEGEND].append(currentDef);
35  }
36 }
int i
Definition: DBlmapReader.cc:9
std::string getName() const
Definition: LegendItem.h:20
Value & append(const Value &value)
Append value to array at the end.
Represents a JSON value.
Definition: value.h:111
static const std::string OPERATION
std::string getOperation() const
Definition: LegendItem.h:23
static const std::string PARAM_NAME
LegendItem getLegendFor(unsigned int index) const
std::vector< LegendItem > getLegend() const

Member Data Documentation

const string DataPointDefinition::LEGEND = "legend"
static

Definition at line 45 of file DataPointDefinition.h.

Referenced by deserialize(), and serialize().

std::vector<LegendItem> jsoncollector::DataPointDefinition::legend_
private

Definition at line 50 of file DataPointDefinition.h.

Referenced by deserialize(), getLegend(), and getLegendFor().

const string DataPointDefinition::OPERATION = "operation"
static

Definition at line 47 of file DataPointDefinition.h.

Referenced by deserialize(), and serialize().

const string DataPointDefinition::PARAM_NAME = "name"
static

Definition at line 46 of file DataPointDefinition.h.

Referenced by deserialize(), and serialize().