/*
 * Parameter.h
 *
 *  Created on: Aug 5, 2015
 *      Author: jjpalacios
 */

#ifndef SRC_CALIBRATOR_UTILS_PARAMETERDEFINITION_H_
#define SRC_CALIBRATOR_UTILS_PARAMETERDEFINITION_H_

#include "../heading.h"

namespace clbDEB {

//=============================================================================
//
//	Class ParameterDefinition
//
//=============================================================================
/**
 * This class contains the data that defines a parameter to be optimized.
 * It is specially useful for converting from the real values it may take to
 * integer values.
 *
 * @author jjpalacios
 *
 */
class ParameterDefinition {
public:
	std::string name;
	double minValue;
	double maxValue;
	double step;

protected:
	int adaptedMin;
	int adaptedMax;
	double multiplier;

	bool boundsReady;

public:
	/**
	 * Default constructor
	 */
	ParameterDefinition();

	/**
	 * Sets all the information for the parameter
	 *
	 * @param min Minimum value that the parameter can take
	 * @param max Maximum value that the parameter can take
	 * @param step Minimum variation that the value may suffer
	 * @return The maximum value that the parameter can take when using integer
	 * values
	 */
	int setValues(const double min, const double max, const double step);

	/**
	 * Maps the value into the original range of values
	 *
	 * @param x Integer parameter value to convert
	 */
	double getOriginalValue(int x);

	/**
	 * Maps the value into the integer defined interval
	 *
	 * @param x Integer parameter value to convert
	 */
	int getIntegerValue(double x);

	/**
	 * Gets the maximum integer value that the interval may take
	 */
	int getMaxValue();

	/**
	 * Gets the minimum integer value that the interval may take
	 */
	int getMinValue();
};

}
#endif /* SRC_CALIBRATOR_UTILS_PARAMETERDEFINITION_H_ */
