CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DataPointMonitor.cc
Go to the documentation of this file.
1 /*
2  * DataPointMonitor.cc
3  *
4  * Created on: Oct 29, 2012
5  * Author: aspataru
6  */
7 
8 #include "../interface/DataPointMonitor.h"
9 #include "../interface/ObjectMerger.h"
10 
11 using namespace jsoncollector;
12 
14  const vector<JsonMonitorable*>& monitorableVariables, string defPath) :
15  monitorableVars_(monitorableVariables) {
16  defPath_ = defPath;
18  if (dpd_.isPopulated()) {
19  for (unsigned int i = 0; i < dpd_.getLegend().size(); i++) {
20  string toBeMonitored = dpd_.getLegend()[i].getName();
21  monitoredVars_.push_back(getVarForName(toBeMonitored));
22  }
23  }
24 }
25 
27 }
28 
29 void DataPointMonitor::snap(DataPoint& outputDataPoint) {
30  outputDataPoint.resetData();
31  for (unsigned int i = 0; i < monitoredVars_.size(); i++)
32  outputDataPoint.addToData(monitoredVars_[i]->toString());
33  outputDataPoint.setSource("");
34  outputDataPoint.setDefinition(defPath_);
35 }
36 
38  for (unsigned int i = 0; i < toBeMonitored_.size(); i++)
39  if (key.compare(toBeMonitored_[i]) == 0)
40  return true;
41  return false;
42 }
43 
45  for (unsigned int i = 0; i < monitorableVars_.size(); i++)
46  if (name.compare(monitorableVars_[i]->getName()) == 0)
47  return monitorableVars_[i];
48  return 0;
49 }
50 
int i
Definition: DBlmapReader.cc:9
DataPointMonitor(const std::vector< JsonMonitorable * > &monitorableVariables, string defPath)
JsonMonitorable * getVarForName(string name) const
void addToData(std::string data)
Definition: DataPoint.h:50
vector< JsonMonitorable * > monitorableVars_
void setDefinition(std::string definition)
Definition: DataPoint.h:47
void setSource(std::string source)
Definition: DataPoint.h:44
bool isStringMonitorable(string key) const
static bool getDataPointDefinitionFor(std::string defFilePath, DataPointDefinition &def)
list key
Definition: combine.py:13
vector< JsonMonitorable * > monitoredVars_
void snap(DataPoint &outputDataPoint)
std::vector< LegendItem > getLegend() const