/** * ParamTable.hh * * Created on: 10 oct. 2014 * Author: AKKA */ #ifndef PARAMTABLE_HH_ #define PARAMTABLE_HH_ #include "ParameterManager.hh" #include "log4cxx/logger.h" #define PARAMETER_TABLE "PARAMETER_TABLE_" #define PARAMETER_TABLE_UNITS "PARAMETER_TABLE_UNITS" #define PARAMETER_TABLE_MINVAL "PARAMETER_TABLE_MIN_VALUES" #define PARAMETER_TABLE_MAXVAL "PARAMETER_TABLE_MAX_VALUES" #define VARIABLE_PARAMETER_TABLE "PARAMETER_TABLE_" using namespace log4cxx; namespace AMDA { namespace Info { using namespace AMDA::Parameters; /** * @brief Structure that's define a table bound */ typedef struct { int index; double min; double max; double center; } t_TableBound; /** * @class ParamTable * @brief Abstract class used to define a Parameter table . * @details */ class ParamTable { public: ParamTable(const char *paramId, int dim); virtual ~ParamTable(); virtual int getSize(ParameterManager *parameterManager) = 0; virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager); virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map>*paramsTableData = NULL) = 0; void setParameterLink(ParameterSPtr parameter); std::string getParamId(void); int getDim(void); void setName(std::string name); virtual std::string getName(ParameterManager *parameterManager); void setUnits(std::string name); virtual std::string getUnits(ParameterManager *parameterManager); void setIsVariable(bool isVariable); virtual bool isVariable(ParameterManager *parameterManager); void setIsFullVariable(bool isVariable); virtual bool isFullVariable(ParameterManager *parameterManager); void addTableParam(std::string key, std::string name); virtual std::string getTableParamByKey(ParameterManager *parameterManager, std::string key); virtual std::map& getTableParams(ParameterManager *parameterManager); void addTableInfo(ParameterManager *parameterManager, int dim, std::vector>&infoMap); void addSemiVariableTableInfo(ParameterManager *parameterManager, int dim, std::string paramId, std::string key, std::vector>&infoMap); void addRelatedParams(ParameterManager *parameterManager, std::string paramId, std::listrelatedParams); bool isInvertedOrder(ParameterManager *parameterManager); ParameterSPtr createRelatedParameter(ParameterManager *parameterManager); protected: /** logger of paramTable */ static log4cxx::LoggerPtr _logger; std::string _paramId; int _dim; std::string _tableName; std::string _tableUnits; std::list _printedTables; bool _variable; bool _fullVariable = false; std::map _tableParams; std::vector getTableParamValuesByKey(ParameterManager *parameterManager, std::map>*paramsTableData, std::string key); std::vector getConstantTableParamValuesByKey(ParameterManager *parameterManager, std::string key); std::vector getVariableTableParamValuesByKey(ParameterManager *parameterManager, std::map>*paramsTableData, std::string key); virtual void addVariableTableInfo(ParameterManager *parameterManager, int dim, std::vector>&infoMap); }; /** * @class ParamBoundsTable * @brief Implementation of a ParamTable for a table defined by a list * @details */ class ParamBoundsTable : public ParamTable { public: ParamBoundsTable(const char *paramId, int dim); virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager); virtual int getSize(ParameterManager *parameterManager); virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map>*paramsTableData = NULL); static std::string _boundsParamKey; }; /** * @class ParamCenterTable * @brief Implementation of a ParamTable for a table defined by a list of center value and a size * @details */ class ParamCenterTable : public ParamTable { public: ParamCenterTable(const char *paramId, int dim, double size); virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager); virtual int getSize(ParameterManager *parameterManager); virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map>*paramsTableData = NULL); static std::string _centersParamKey; private: double _size; }; /** * @class ParamCenterWidthTable * @brief Implementation of a ParamTable for a table defined by a list of center value and a list of band width * @details */ class ParamCenterWidthTable : public ParamTable { public: ParamCenterWidthTable(const char *paramId, int dim); virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager); virtual int getSize(ParameterManager *parameterManager); virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map>*paramsTableData = NULL); static std::string _centersParamKey; static std::string _widthsParamKey; }; /** * @class ParamCenterAutoTable * @brief Implementation of a ParamTable for a table defined by a list of center value. Bounds automatically computed to be at the center of two consecutive channels * @details */ class ParamCenterAutoTable : public ParamTable { public: ParamCenterAutoTable(const char *paramId, int dim, bool log); virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager); virtual int getSize(ParameterManager *parameterManager); virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map>*paramsTableData = NULL); static std::string _centersParamKey; private: bool _log; }; class EmbeddedCenterTable : public ParamTable { public: EmbeddedCenterTable(const char *paramId, int dim, std::vector & centersValues, bool logMode = false); virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager); virtual int getSize(ParameterManager *parameterManager); virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map>*paramsTableData = NULL); static std::string _paramKey; std::vector _centersValues; private: bool _log; }; /** * @class ParamMinMaxTable * @brief Implementation of a ParamTable for a table defined by two list: one for min and one for max * @details */ class ParamMinMaxTable : public ParamTable { public: ParamMinMaxTable(const char *paramId, int dim); virtual int getSize(ParameterManager *parameterManager); virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map>*paramsTableData = NULL); static std::string _minParamKey; static std::string _maxParamKey; }; /* * @class LinkTable * @brief Implementation of a ParamTable that is a link to an existing ParamTable * @details */ class LinkTable : public ParamTable { public: LinkTable(const char *paramId, int dim, const char* originParamId); virtual int getSize(ParameterManager *parameterManager); virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map>*paramsTableData = NULL); void setOriginTableDim(int originTableDim) { _originTableDim = originTableDim; } virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager); virtual std::string getName(ParameterManager *parameterManager); virtual std::string getUnits(ParameterManager *parameterManager); virtual bool isVariable(ParameterManager *parameterManager); virtual bool isFullVariable(ParameterManager *parameterManager); virtual std::map& getTableParams(ParameterManager *parameterManager); private: std::string _originParamId; int _originTableDim; std::map _emptyTableParam; ParamTable* getOriginParamTable(ParameterManager *parameterManager); }; } /* namespace Info */ } /* namespace AMDA */ #endif /* PARAMTABLE_HH_ */