Blame view

src/Parameters/Process.hh 2.87 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Process.hh
 *
 *  Created on: Oct 31, 2012
 *      Author: f.casimir
 */

#ifndef PROCESS_HH_
#define PROCESS_HH_

#include <vector>

#include <boost/shared_ptr.hpp>
#include <log4cxx/logger.h>


#include "AMDA_exception.hh"
#include "DataWriter.hh"
#include "DataClient.hh"
#include "Parameter.hh"

namespace AMDA {
namespace Parameters {

/**
 * Exception specific for ParseMainArguments
 */
struct Process_exception: virtual AMDA_exception { };

class Operation;

/**
 * @class Process
 * @brief Interface to implemented a Process, a Process is used to compute a new ParamData with input data.
 * @details an implementation must implemented AMDA::Parameters::DataWriter and AMDA::Parameters::DataClien interface
 */
class Process : public AMDA::Parameters::DataWriter, public AMDA::Parameters::DataClient {
public:
	typedef std::vector<std::string > AttributeList;
	/**
	 *
	 * Default constructor.
	 */
	Process(Parameter &parameter);
	/**
	 *
	 * Default constructor.
	 */
	Process(const Process &process, Parameter &parameter);

	/**
	 * Default destructor.
	 */
	virtual ~Process();

	// Get methods
	const std::string& getExpression() const { return _expression; }
	const std::string& getDescription() const { return _description; }
	Operation* getOperation() {	return _operation; }
	ParameterSPtr getReferenceParameter() { return _refParameterSPtr; }
	AttributeList& getAttributList() { return _attributList; }

	// Set methods
	void setExpression(const std::string& expression) {	_expression = expression; }
	void setDescription(const std::string& description) { _description = description; }
	void setOperation(Operation* pOperation) {	_operation = pOperation; }
	void setReferenceParameter( ParameterSPtr refParameterSPtr) { _refParameterSPtr = refParameterSPtr;}
aa8a8e5f   Benjamin Renard   Auto compute gap ...
68
	void setGapThreshold(double gapThreshold) {	_gapThreshold = gapThreshold; }
fbe3c2bb   Benjamin Renard   First commit
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

	// Others methods

	virtual bool isEmptyExpression() { return _expression.empty(); }

	void setAttributList(AttributeList pAttributList) { _attributList = pAttributList; }

protected:
	static log4cxx::LoggerPtr _logger;


	 /**
	  * to store attribut of process write in _expression
	  */
    AttributeList _attributList;
	std::string _expression;
	std::string _description;
	Operation *_operation;
	ParameterSPtr _refParameterSPtr;
aa8a8e5f   Benjamin Renard   Auto compute gap ...
88
	double _gapThreshold;
fbe3c2bb   Benjamin Renard   First commit
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
};

typedef boost::shared_ptr<Process> ProcessSPtr;

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

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

    virtual DataWriter *clone(Parameter &parameter) const {
        return new Derived(static_cast<Derived const&>(*this),parameter);
    }
};

} /* namespace Parameters */

} /* namespace AMDA */
#endif /* PROCESS_HH_ */