XSeriesProperties.hh 2.37 KB
/*
 * XSerieProperties.hh
 *
 *  Created on: 13 déc. 2013
 *      Author: CS
 */

#ifndef XSERIESPROPERTIES_HH_
#define XSERIESPROPERTIES_HH_

#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#include "ParameterIndexesTool.hh"

namespace plot {

/**
 * X Serie properties for XYPlot
 */
class XSeriesProperties {
public:
	XSeriesProperties() :
			_index(-1,-1),
			_computeExpression(""),
			_computeExpressionName(""),
			_min(nan("")),
			_max(nan(""))
	{
	}

	virtual ~XSeriesProperties() {
	}

	AMDA::Common::ParameterIndexComponent getIndex() const {
		return _index;
	}

	void setIndex(AMDA::Common::ParameterIndexComponent index) {
		_index = index;
	}

	std::string getAxisId() const {
		return _xAxisId;
	}

	void setAxisId(std::string axisId) {
		_xAxisId = axisId;
	}

	const std::string& getComputeExpression() const {
		return _computeExpression;
	}

	void setComputeExpression(const std::string& computeExpression) {
		_computeExpression = computeExpression;
	}

	const std::string& getComputeExpressionName() const {
		return _computeExpressionName;
	}

	void setComputeExpressionName(const std::string& computeExpressionName) {
		_computeExpressionName = computeExpressionName;
	}

	/**
	 * Adds a paramId to the paramId vector if not already in.
	 */
	void addParamId(const std::string &relatedYParamId, const std::string &xParamId)
	{
		_paramIds[relatedYParamId] = xParamId;
	}

	std::map<std::string, std::string> &getXParamIds() {
		return _paramIds;
	}

	double getMax() const {
		return _max;
	}

	void setMax(double max) {
		_max = max;
	}

	double getMin() const {
		return _min;
	}

	void setMin(double min) {
		_min = min;
	}

	/*
	 * Dumps properties for test.
	 */
	void dump(std::ostream& out_, std::string& prefix_);

private :

	/**
	 * xAxis id index
	 */
	std::string _xAxisId;

	/**
	 * Component index
	 */
	AMDA::Common::ParameterIndexComponent _index;

	/**
	 * Compute expression used to set expression results as x values
	 * instead of parameter index
	 */
	std::string _computeExpression;

	/**
	 * Name of the compute expression.
	 * Used for legend axis
	 */
	std::string _computeExpressionName;

	/**
	 * Related Param Ids
	 */
	std::map<std::string, std::string> _paramIds;

	/*
	 * Min acceptable value
	 */
	double		_min;

	/*
	 * Max acceptable value
	 */
	double		_max;
};

} /* namespace plot */
#endif /* XSERIESPROPERTIES_HH_ */