ParamTable.hh 3.08 KB
/**
 * ParamTable.hh
 *
 *  Created on: 10 oct. 2014
 *  Author: AKKA
 */

#ifndef PARAMTABLE_HH_
#define PARAMTABLE_HH_

#include "ParameterManager.hh"

#include "log4cxx/logger.h"

namespace AMDA {
namespace Info {

	using namespace AMDA::Parameters;

	/**
	 * @brief Structure that's define a table bound
	 */
	typedef struct {
		int index;
		double min;
		double max;
	} t_TableBound;

	/**
	 * @class ParamTable
	 * @brief Abstract class used to define a Parameter table .
	 * @details
	 */
	class ParamTable
	{
	public:
		ParamTable(const char *paramId);

		virtual ~ParamTable();

		virtual int getSize(ParameterManager *parameterManager) = 0;

		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index) = 0;

		void setParameterLink(ParameterSPtr parameter);

		void setName(std::string name);

		std::string getName(void);

		void setUnits(std::string name);

		std::string getUnits(void);

	protected:
		/** logger of paramTable */
		static log4cxx::LoggerPtr _logger;

		std::string _paramId;

		std::string _tableName;

		std::string _tableUnits;
	};

	/**
	 * @class ParamBoundsTable
	 * @brief Implementation of a ParamTable for a table defined by a list
	 * @details
	 */
	class ParamBoundsTable : public ParamTable {
	public:
		ParamBoundsTable(const char *paramId, const char *boundsName);

		virtual int getSize(ParameterManager *parameterManager);

		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index);

	private:
		std::string _boundsName;
	};

	/**
	 * @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, const char *centerName, double size);

		virtual int getSize(ParameterManager *parameterManager);

		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index);

	private:
		std::string _centerName;
		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, const char *centerName, const char *widthName);

		virtual int getSize(ParameterManager *parameterManager);

		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index);

	private:
		std::string _centerName;
		std::string _widthName;
	};

	/**
	 * @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, const char *minName, const char *maxName);

			virtual int getSize(ParameterManager *parameterManager);

			virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index);

		private:
			std::string _minName;

			std::string _maxName;
	};
} /* namespace Info */
} /* namespace AMDA */

#endif /* PARAMTABLE_HH_ */