Process.hh
3.73 KB
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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
* 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 ¶meter);
/**
*
* Default constructor.
*/
Process(const Process &process, Parameter ¶meter);
/**
* 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; }
bool isUserProcess() {
return _isUserProcess;
}
// 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;}
void setGapThreshold(double gapThreshold) { _gapThreshold = gapThreshold; }
/**
* Set flag to know if it's a process built especially for a user
*/
void setIsUserProcess(bool isUserProcess) {
_isUserProcess = isUserProcess;
}
// Others methods
virtual bool isEmptyExpression() { return _expression.empty(); }
void setAttributList(AttributeList pAttributList) { _attributList = pAttributList; }
virtual std::list<std::string> getUsedClbInfo(){
std::list<std::string> clbInfoList;
return clbInfoList;
}
AMDA::Parameters::SemiVariableTable getSemiVariableTable(){
return _semiVariableTable;
}
void setSemiVariableTable(SemiVariableTable semiVariableTable){
_semiVariableTable = semiVariableTable;
}
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;
double _gapThreshold;
bool _isUserProcess;
AMDA::Parameters::SemiVariableTable _semiVariableTable;
};
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 ¶meter) : Process(parameter) {}
/**
* constructeur by copy
*/
Process_CRTP(const Process &pProcess, Parameter ¶meter) : Process(pProcess, parameter) {}
virtual DataWriter *clone(Parameter ¶meter) const {
return new Derived(static_cast<Derived const&>(*this),parameter);
}
};
} /* namespace Parameters */
} /* namespace AMDA */
#endif /* PROCESS_HH_ */