Blame view

src/InternLib/SingleParamProcess.hh 2.17 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
/*
 * SingleParamProcess.hh
 *
 *  Created on: Feb 6, 2013
 *      Author: f.casimir
 */

#ifndef SINGLEPARAMPROCESS_HH_
#define SINGLEPARAMPROCESS_HH_

#include "Process.hh"

namespace AMDA {
namespace Parameters {

class SingleParamProcess  : public Process {
public:
	SingleParamProcess(Parameter &parameter);
	SingleParamProcess(const SingleParamProcess &pProcess, Parameter &parameter);
	virtual ~SingleParamProcess();

	// Overload DataClient methods
	/**
	 * @overload DataClient::establishConnection()
	 */
	virtual void establishConnection();

	/**
	 * @overload Process::write()
	 */
8819b2bc   Benjamin Renard   Add plugin Tsygan...
31
	virtual unsigned int write();
fbe3c2bb   Benjamin Renard   First commit
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

	/*
	 * @brief @ to know the resampling strategy to use. If it's true, the nearest value will be use
	 */
	virtual bool useNearestValue();

	/*
	 * @overload DataWriter::getMinSampling
	 */
	virtual double getMinSampling();

	/**
	 * @overload DataWriter::updateInfo - update parameter info in relation to the process
	 */
	virtual void updateInfo(Parameter & parameter);

protected:
	/**
	 * @brief If the expression is not a Single parameter,
	 * it must ask the creation of a parameter responsible of the formula calculation.
	 */
	virtual void parse();

	/**
	 * @brief It the server of the data to shift.
	 */
	ParameterSPtr _parameterInput;

	/**
	 * @brief It is the channel of data to shift.
	 */
	ParamData *   _paramInput;

	/**
	 * @brief tag last data treatment
	 */
	bool _treatTerminated = false;

	/**
	 * @brief
	 */
	bool _expressionParsed;
};

/**
 *  @brief This CRTP class implements clone() for Derived
 */
template <typename Derived>
class SingleParamProcess_CRTP : public SingleParamProcess {
public:
	/**
	 * Default constructor
	 */
	SingleParamProcess_CRTP(Parameter &parameter) : SingleParamProcess(parameter) {}

	/**
	 * constructeur by copy
	 */
	SingleParamProcess_CRTP(const SingleParamProcess &pProcess, Parameter &parameter) :
		SingleParamProcess(pProcess, parameter) {}

	/**
	 * clone an implementation of MultiParamProcess
	 */
    virtual DataWriter *clone(Parameter &parameter) const {
        return new Derived(static_cast<Derived const&>(*this),parameter);
    }
};
} /* namespace Parameters */
} /* namespace AMDA */
#endif /* SINGLEPARAMPROCESS_HH_ */