Blame view

src/ParamOutputImpl/Plot/CurveFunction/CurveFunctionWriter.cc 1.21 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * CurveFunctionWriter.cc
 *
 *  Created on: Sep 19, 2014
 *      Author: AKKA
 */

#include "CurveFunctionWriter.hh"
#include "Process.hh"
#include "ServicesServer.hh"

using namespace AMDA::Parameters;

namespace plot {

	CurveFunctionWriter::CurveFunctionWriter() {
	}

	CurveFunctionWriter::~CurveFunctionWriter() {
	}

	void CurveFunctionWriter::call(double resolution, CurveFunctionWriter::CurvePointList &curvePointList) {
		/// Execute function
		CurveFunctionProcess functor = ServicesServer::getInstance()->getService<CurveFunctionProcess>(_functionName);
		if ( ! functor) {
			std::stringstream oss;
			oss << "Curve function: '" << _functionName << "' not exist";
				BOOST_THROW_EXCEPTION(Process_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(oss.str()));
		} else {
			functor(resolution, _attributeList, curvePointList);
		}
	}
	
	void CurveFunctionWriter::setFunctionName(const std::string& name)
	{
		_functionName = name;
	}
	
	std::string CurveFunctionWriter::getFunctionName(void)
	{
		return _functionName;
	}
	
	void CurveFunctionWriter::addAttribute(const std::string& name,double value)
	{
		_attributeList[name] = value;
	}
} /* namespace plot */