Blame view

src/InternLib/ProcessStandard.hh 2.65 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
/**
 * ProcessStandard.hh
 *
 *  Created on: Dec 11, 2012
 *      Author: AKKA IS
 */

#ifndef PROCESSSTANDARD_HH_
#define PROCESSSTANDARD_HH_

#include <string>
#include <list>
#include <map>

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


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

#include "MultiParamProcess.hh"
#include "Parser.hh"

c34c8a55   Benjamin Renard   Upgrade process s...
28
#define PROCESS_STANDARD_COMPIL_VERSION 6
0614f36d   Benjamin Renard   Check compilation...
29

fbe3c2bb   Benjamin Renard   First commit
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
namespace AMDA {
namespace Parameters {

class ServicesServer;
typedef ServicesServer *ServicesServerPtr;

class ParamData;
typedef ParamData *ParamDataPtr;

class ProcessStandard: public MultiParamProcess_CRTP<ProcessStandard> {
public:

	typedef std::vector<std::string> SoList;
	/**
	 * map: first element: path of plugin, second, list of .so
	 */
	typedef std::map<std::string,  SoList> PluginList;
	/**
	 *
	 * Default constructor.
	 */
	ProcessStandard(Parameter &parameter);
	/**
	 *
	 * Default constructor.
	 */
	ProcessStandard(const ProcessStandard &process, Parameter &parameter);

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

	/**
	 * initialization of get method
	 * create real ParamData
	 */
	virtual TimeStamp init();

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

	virtual void establishConnection();

protected:
	/**
	 * get paramName and fctName of expression
	 */
	virtual void parse();

	/**
	 * @brief return true if generated .so is necessary
	 */
	bool mustGenerated(TimeStamp time) ;
	/**
	 * get paramName and fctName of expression
	 */
	void generateCppfile();

	/**
	 * generate dynamic library
	 */
	TimeStamp  generateSoFile();

	/**
	 * Load dynamic library to process
	 */
	void loadDynamicLib();

	/**
	 * Load dynamic library to process
	 */
	void closeDynamicLib();

	/**
	 * find include
	 */
	bool findInclude(std::string name, std::string &path, std::vector<std::string> &listSo) ;

	std::string _fct;
	std::string _symboleName;
	ServicesServerPtr _servicesServer;
	std::string _fileNameRoot;
	std::string _fileNameC;
	std::string _fileNameSO;
	void *_handle;
	 AMDA::Parameters::ParamData *(*_processInit)(Process *pProcess);
0614f36d   Benjamin Renard   Check compilation...
119
	int (*_compilVersion)();
fbe3c2bb   Benjamin Renard   First commit
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
	 bool _accesDirect;

	 bool _alreadyParsed;

	AMDA::helpers::Properties _propertiesList;
	Parser _parser;
	PluginList _PluginList;
	std::stringstream _streamIncludeFile;
	TimeStamp _timeOfSoFile;

	/**
	 * @brief  temporary working directory to create temporary file
	 * @details give by mkdtemp(_propertiesList["app.process.src"]/XXXXXX);
	 */
	std::string _workingDiretory ;
};

} /* namespace Parameters */
} /* namespace AMDA */
#endif /* PROCESSSTANDARD_HH_ */