DataPointDefinition

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
/*
 * DataPointDefinition.h
 *
 *  Created on: Sep 24, 2012
 *      Author: aspataru
 */

#ifndef DATAPOINTDEFINITION_H_
#define DATAPOINTDEFINITION_H_

#include "EventFilter/Utilities/interface/JsonMonitorable.h"
#include "EventFilter/Utilities/interface/JsonSerializable.h"
#include <string>
#include <vector>

namespace jsoncollector {

  class JsonMonConfig;

  class DataPointDefinition : public JsonSerializable {
  public:
    DataPointDefinition() {}

    //DataPointDefinition(std::string const& prefix) : namePrefix_(prefix) {}
    //DataPointDefinition(const std::vector<std::string>& names, const std::vector<std::string>& operations);

    ~DataPointDefinition() override {}

    /**
   * JSON serialization procedure for this class
   */
    void serialize(Json::Value& root) const override;
    /**
   * JSON deserialization procedure for this class
   */
    void deserialize(Json::Value& root) override;
    /**
   * Returns true if the legend_ has elements
   */
    bool isPopulated() const;
    /**
   * Returns a LegendItem object ref at the specified index
   */
    std::vector<std::string> const& getNames() const { return varNames_; }
    std::vector<std::string> const& getOperations() const { return opNames_; }

    /**
   * Loads a DataPointDefinition from a specified reference
   */
    static bool getDataPointDefinitionFor(std::string& defFilePath,
                                          DataPointDefinition* dpd,
                                          const std::string* defaultGroup = nullptr);

    void setDefaultGroup(std::string const& group) { defaultGroup_ = group; }

    void addLegendItem(std::string const& name, std::string const& type, std::string const& operation);

    OperationType getOperationFor(unsigned int index) const;

    std::string& getDefFilePath() { return defFilePath_; }
    std::string const& getDefFilePath() const { return defFilePath_; }
    //void populateMonConfig(std::vector<JsonMonConfig>& monConfig);

    //known JSON operation names
    static const std::string SUM;
    static const std::string AVG;
    static const std::string SAME;
    static const std::string HISTO;
    static const std::string CAT;
    static const std::string MERGE;
    static const std::string BINARYOR;
    static const std::string ADLER32;

    // JSON field names
    static const std::string LEGEND;
    static const std::string DATA;
    static const std::string PARAM_NAME;
    static const std::string OPERATION;
    static const std::string TYPE;

  private:
    std::vector<std::string> varNames_;
    std::vector<std::string> typeNames_;
    std::vector<std::string> opNames_;
    std::string defFilePath_;
    std::string defaultGroup_;

    //	std::string namePrefix_;
  };
}  // namespace jsoncollector

#endif /* DATAPOINTDEFINITION_H_ */