Blame view

src/Parameters/Process.hh 3.56 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
/*
 * 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;

e06e49a1   Hacene SI HADJ MOHAND   in progress
32

c38985ab   Hacene SI HADJ MOHAND   semi variable tra...
33

fbe3c2bb   Benjamin Renard   First commit
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
/**
 * @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; }

854a7fcf   Benjamin Renard   First implementat...
65
66
67
68
	bool isUserProcess() {
		return _isUserProcess;
	}

fbe3c2bb   Benjamin Renard   First commit
69
70
71
72
73
	// 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 ...
74
	void setGapThreshold(double gapThreshold) {	_gapThreshold = gapThreshold; }
fbe3c2bb   Benjamin Renard   First commit
75

854a7fcf   Benjamin Renard   First implementat...
76
77
78
79
80
81
82
	/**
	 * Set flag to know if it's a process built especially for a user
	 */
	void setIsUserProcess(bool isUserProcess) {
		_isUserProcess = isUserProcess;
	}

fbe3c2bb   Benjamin Renard   First commit
83
84
85
86
87
	// Others methods

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

	void setAttributList(AttributeList pAttributList) { _attributList = pAttributList; }
dc01b853   Hacene SI HADJ MOHAND   il reste get cali...
88
                    
b31e7a52   Hacene SI HADJ MOHAND   working with mav_st
89
90
91
92
93
94
95
                   
                  AMDA::Parameters::SemiVariableTable getSemiVariableTable(){
                       return _semiVariableTable;
                   }
                   void setSemiVariableTable(SemiVariableTable semiVariableTable){
                       _semiVariableTable = semiVariableTable;
                   }
4ee4dc28   Hacene SI HADJ MOHAND   ok witout table
96
                   
fbe3c2bb   Benjamin Renard   First commit
97
98
99
100
101
102
103
protected:
	static log4cxx::LoggerPtr _logger;


	 /**
	  * to store attribut of process write in _expression
	  */
e06e49a1   Hacene SI HADJ MOHAND   in progress
104
                    AttributeList _attributList;
fbe3c2bb   Benjamin Renard   First commit
105
106
107
108
	std::string _expression;
	std::string _description;
	Operation *_operation;
	ParameterSPtr _refParameterSPtr;
aa8a8e5f   Benjamin Renard   Auto compute gap ...
109
	double _gapThreshold;
854a7fcf   Benjamin Renard   First implementat...
110
	bool _isUserProcess;
4ee4dc28   Hacene SI HADJ MOHAND   ok witout table
111
                    AMDA::Parameters::SemiVariableTable _semiVariableTable;
fbe3c2bb   Benjamin Renard   First commit
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
};

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_ */