ResamplingProperties.hh 1.68 KB
/*
 * ResamplingProperties.hh
 *
 *  Created on: Aug 19, 2014
 *      Author: AKKA
 */

#ifndef RESAMPLINGPROPERTIES_HH_
#define RESAMPLINGPROPERTIES_HH_

#include <iostream>
#include <map>
#include <string>

namespace plot {

/**
 * available resampling type to apply to a serie.
 */
enum class ResamplingType {
	AUTO, XPARAM, YPARAM, MANUAL
};
/**
 * string to enum translation. string values (cf. plot.xsd).
 */
static std::map<const std::string, ResamplingType> stoResamplingType = {
		{"auto", ResamplingType::AUTO},
		{"xparam", ResamplingType::XPARAM},
		{"yparam", ResamplingType::YPARAM},
		{"manual", ResamplingType::MANUAL}
};

/**
 * Resampling properties. Defines type and value (if needed by type)
 */
class ResamplingProperties {
public:
	friend std::ostream& operator<<(std::ostream& out_, const ResamplingProperties& lprop_);
	/*
	 * Dumps properties for test.
	 */
	void dump(std::ostream& out_, std::string& prefix_);


	ResamplingProperties() :
			_type(ResamplingType::AUTO), _value(0) {
	}

	ResamplingProperties(const ResamplingProperties& pResamplingProperties_) :
		_type(pResamplingProperties_._type), _value(pResamplingProperties_._value) {
	}

	ResamplingProperties& operator=(const ResamplingProperties& pResamplingProperties_) {
		_type = pResamplingProperties_._type;
		_value = pResamplingProperties_._value;
		return *this;
	}

	virtual ~ResamplingProperties() {
	}

	ResamplingType getType() const {
		return _type;
	}

	void setType(ResamplingType type) {
		_type = type;
	}
	int getValue() const {
		return _value;
	}

	void setValue(double value) {
		_value = value;
	}

private:
	ResamplingType _type;
	double _value;
};

} /* namespace plot */

#endif /* RESAMPLINGPROPERTIES_HH_ */