Commit 854a7fcf2da4c4e60cbbe8ad43bb9892a59d97e4

Authored by Benjamin Renard
1 parent 20fef3b6

First implementation to have a common compilation folder for local params (#6371)

config/xsd/parameter/parameter.xsd
... ... @@ -38,6 +38,7 @@
38 38 <xs:simpleContent>
39 39 <xs:extension base="xs:string">
40 40 <xs:attribute name="description" type="xs:string"/>
  41 + <xs:attribute name="userProcess" type="xs:boolean"/>
41 42 </xs:extension>
42 43 </xs:simpleContent>
43 44 </xs:complexType>
... ...
src/ExternLib/Merge/MergeProcess.cc
... ... @@ -39,7 +39,7 @@ namespace AMDA {
39 39  
40 40 void MergeProcess::parse() {
41 41 ParameterCreatorFromExpression creator(_parameter.getParameterManager());
42   - ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression);
  42 + ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression, isUserProcess());
43 43 _paramNameList[lParameter->getId()].first = lParameter;
44 44 _orderParamNameList.push_back(lParameter->getId());
45 45 /// get other Parameter in attribute list
... ... @@ -47,7 +47,7 @@ namespace AMDA {
47 47 BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("MergeProcess::parse required at least one attribute'")));
48 48 }
49 49 for ( auto param : _attributList) {
50   - lParameter = creator.getOneParameterFromExpression(_parameter,param);
  50 + lParameter = creator.getOneParameterFromExpression(_parameter,param, isUserProcess());
51 51 _paramNameList[lParameter->getId()].first = lParameter;
52 52 _orderParamNameList.push_back(lParameter->getId());
53 53 }
... ...
src/ExternLib/StatisticFunctions/AbstractFunc.hh
... ... @@ -161,7 +161,6 @@ public:
161 161 {
162 162 double crtTime = _paramInput.getTime(_index);
163 163 InputElemType crtVal = _paramInput.get(_index);
164   - bool skip = false;
165 164 if (needToChangeTarget(crtTime)) {
166 165 _paramOutput->pushTime(getTarget());
167 166 _paramOutput->push(compute());
... ...
src/ExternLib/mexvex_els_decode/ProcessMexVexElsDecode.cc
... ... @@ -39,14 +39,14 @@ namespace Parameters {
39 39  
40 40 void ProcessMexVexElsDecode::parse() {
41 41 ParameterCreatorFromExpression creator(_parameter.getParameterManager());
42   - ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression);
  42 + ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression, isUserProcess());
43 43 _paramNameList[lParameter->getId()].first = lParameter;
44 44 _inputParamName = lParameter->getId();
45 45 if (_attributList.size() != 1) {
46 46 BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessMexVexElsDecode::parse require one attribute'")));
47 47 }
48 48 if (_attributList[0] != _expression) {
49   - lParameter = creator.getOneParameterFromExpression(_parameter,_attributList[0]);
  49 + lParameter = creator.getOneParameterFromExpression(_parameter,_attributList[0], isUserProcess());
50 50 _paramNameList[lParameter->getId()].first = lParameter;
51 51 _energyTableName = lParameter->getId();
52 52 }
... ...
src/ExternLib/sum_into_table_range/ProcessSumIntoTableRange.cc
... ... @@ -38,7 +38,7 @@ namespace Parameters {
38 38  
39 39 void ProcessSumIntoTableRange::establishConnection() {
40 40 ParameterCreatorFromExpression creator(_parameter.getParameterManager());
41   - ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression);
  41 + ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression, isUserProcess());
42 42 _mainParamId = lParameter->getId();
43 43 _paramNameList[lParameter->getId()].first = lParameter;
44 44  
... ...
src/InternLib/ParameterCreatorFromExpression.cc
... ... @@ -34,7 +34,7 @@ namespace AMDA {
34 34 ParameterCreatorFromExpression::~ParameterCreatorFromExpression() {
35 35 }
36 36  
37   - ParameterSPtr ParameterCreatorFromExpression::getOneParameterFromExpression(Parameter& pParameter, const std::string& pExpression) {
  37 + ParameterSPtr ParameterCreatorFromExpression::getOneParameterFromExpression(Parameter& pParameter, const std::string& pExpression, bool isUserProcess) {
38 38 ParameterSPtr lParameter;
39 39 _parser.process(pExpression);
40 40  
... ... @@ -61,6 +61,7 @@ namespace AMDA {
61 61 if ( lProcess) {
62 62 lProcess->setExpression(lProcessIt->second.expression);
63 63 lProcess->setAttributList(lProcessIt->second.attribut);
  64 + lProcess->setIsUserProcess(isUserProcess);
64 65 DataWriterSPtr dataWriter(lProcess);
65 66 lParameter->setDataWriter(dataWriter);
66 67 } else {
... ... @@ -78,6 +79,7 @@ namespace AMDA {
78 79 Process *lProcess = ServicesServer::getInstance()->getProcess("standard", *lParameter.get());
79 80 if ( lProcess) {
80 81 lProcess->setExpression(pExpression);
  82 + lProcess->setIsUserProcess(isUserProcess);
81 83 DataWriterSPtr dataWriter(lProcess);
82 84 lParameter->setDataWriter(dataWriter);
83 85 } else {
... ...
src/InternLib/ParameterCreatorFromExpression.hh
... ... @@ -42,7 +42,7 @@ public:
42 42 * - else hash(expression) parameter
43 43 *
44 44 */
45   - ParameterSPtr getOneParameterFromExpression(Parameter& pParameter, const std::string& pExpression);
  45 + ParameterSPtr getOneParameterFromExpression(Parameter& pParameter, const std::string& pExpression, bool isUserProcess);
46 46 private:
47 47 /**
48 48 * @brief reference of parameterManager to create parameter
... ...
src/InternLib/ProcessStandard.cc
... ... @@ -97,7 +97,20 @@ TimeStamp ProcessStandard::init() {
97 97 if(index != string::npos) {
98 98 _fileNameRoot.at(index) = '_';
99 99 }
100   - _fileNameSO = _propertiesList["app.process.lib"] + "/" + _fileNameRoot + ".so";
  100 +
  101 + std::string soDir;
  102 + if (isUserProcess() && !_propertiesList["app.process.userlib"].empty()) {
  103 + soDir = _propertiesList["app.process.userlib"];
  104 + }
  105 + else {
  106 + soDir = _propertiesList["app.process.lib"];
  107 + }
  108 +
  109 + if (soDir.empty() || (AMDA::Helpers::Helper::mkdir(soDir.c_str()) != 0)) {
  110 + BOOST_THROW_EXCEPTION(Process_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessStandard::init - Cannot create detination lib dir")));
  111 + }
  112 +
  113 + _fileNameSO = soDir + "/" + _fileNameRoot + ".so";
101 114  
102 115 TimeStamp time = MultiParamProcess::init();
103 116 if(mustGenerated(time)) {
... ... @@ -163,6 +176,7 @@ void ProcessStandard::parse() {
163 176 if ( lProcess) {
164 177 lProcess->setExpression(lProcessIt->second.expression);
165 178 lProcess->setAttributList(lProcessIt->second.attribut);
  179 + lProcess->setIsUserProcess(isUserProcess());
166 180 boost::shared_ptr<DataWriter> dataWriter = boost::shared_ptr<DataWriter>(static_cast<DataWriter *>(lProcess));
167 181 lParameter->setDataWriter(dataWriter);
168 182 _paramNameList[lProcessIt->first].first = lParameterManager.getParameter(lProcessIt->first);
... ...
src/InternLib/SingleParamProcess.cc
... ... @@ -31,7 +31,7 @@ namespace AMDA {
31 31  
32 32 void SingleParamProcess::parse() {
33 33 ParameterCreatorFromExpression creator(_parameter.getParameterManager());
34   - _parameterInput = creator.getOneParameterFromExpression(_parameter,_expression);
  34 + _parameterInput = creator.getOneParameterFromExpression(_parameter,_expression, isUserProcess());
35 35 }
36 36  
37 37  
... ...
src/ParamOutputImpl/DataMining/ParamOutputDataMining.cc
... ... @@ -82,7 +82,7 @@ namespace AMDA {
82 82 void ParamOutputDataMining::establishConnection() {
83 83 // TODO check if _paramName is set otherwise throw an error
84 84 LOG4CXX_DEBUG(_logger, "ParamOutputDataMining::establishConnection : " << "Retrieve parameter");
85   - _parameter = _parameterManager.getSampledParameter(_paramName, _samplingMode, _samplingValue, _gapThreshold);
  85 + _parameter = _parameterManager.getSampledParameter(_paramName, _samplingMode, _samplingValue, _gapThreshold, true);
86 86 if(_parameter == NULL) {
87 87 LOG4CXX_ERROR(_logger,"ParamOutput::init parameter : \""<< _paramName <<"\" Not Exist" );
88 88 BOOST_THROW_EXCEPTION( ParamOutput_exception());
... ...
src/ParamOutputImpl/Download/DownloadOutput.cc
... ... @@ -563,7 +563,7 @@ void DownloadOutput::createParameters(void)
563 563 originalParam->getId(),
564 564 "classic",
565 565 _downloadProperties.getTimeResolution(),
566   - originalParam->getGapThreshold());
  566 + originalParam->getGapThreshold(), true);
567 567 //set the resampled parameter id
568 568 _downloadProperties.getParamPropertiesList()[0]->setOutputId(resampledParam->getId());
569 569 _firstParamId = resampledParam->getId();
... ... @@ -621,7 +621,7 @@ void DownloadOutput::createParameters(void)
621 621 paramProperties->getOriginalId(),
622 622 "classic",
623 623 samplingTime,
624   - originalParam->getGapThreshold());
  624 + originalParam->getGapThreshold(), true);
625 625  
626 626 //set the resampled parameter id
627 627 paramProperties->setOutputId(resampledParam->getId());
... ... @@ -647,7 +647,7 @@ void DownloadOutput::createParameters(void)
647 647 {
648 648 resampledParam = _parameterManager.getSampledParameterUnderRefParam(
649 649 originalParam->getId(),
650   - firstParam->getId());
  650 + firstParam->getId(), true);
651 651  
652 652 //set the resampled parameter id
653 653 paramProperties->setOutputId(resampledParam->getId());
... ...
src/ParamOutputImpl/IntervalTrue/ParamOutputIntervalTrueFile.cc
... ... @@ -47,7 +47,7 @@ namespace AMDA {
47 47 }
48 48  
49 49 void ParamOutputIntervalTrueFile::establishConnection() {
50   - _parameter = _parameterManager.getSampledParameter(_paramName, _samplingMode, _samplingValue, _gapThreshold);
  50 + _parameter = _parameterManager.getSampledParameter(_paramName, _samplingMode, _samplingValue, _gapThreshold, true);
51 51 if(_parameter == NULL) {
52 52 LOG4CXX_ERROR(_logger,"ParamOutput::init parameter : \""<< _paramName <<"\" Not Exist" );
53 53 BOOST_THROW_EXCEPTION( ParamOutput_exception());
... ...
src/ParamOutputImpl/Plot/PanelPlotOutput.cc
... ... @@ -2517,7 +2517,7 @@ AMDA::Parameters::ParameterSPtr PanelPlotOutput::createSampledParameter(AMDA::Pa
2517 2517 originalParam->getId(),
2518 2518 "classic",
2519 2519 samplingValue,
2520   - originalParam->getGapThreshold());
  2520 + originalParam->getGapThreshold(), true);
2521 2521  
2522 2522 if (sampledParam == NULL)
2523 2523 {
... ... @@ -2539,7 +2539,7 @@ AMDA::Parameters::ParameterSPtr PanelPlotOutput::createSampledParameterUnderRefe
2539 2539 {
2540 2540 AMDA::Parameters::ParameterSPtr sampledParam = _parameterManager.getSampledParameterUnderRefParam(
2541 2541 originalParam->getId(),
2542   - refParam->getId()
  2542 + refParam->getId(), true
2543 2543 );
2544 2544  
2545 2545 if (sampledParam == NULL)
... ... @@ -2695,7 +2695,7 @@ void PanelPlotOutput::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_
2695 2695 << "-$" + minParam->getId() << minParamIndex.str();
2696 2696  
2697 2697 //create parameter from expression
2698   - AMDA::Parameters::ParameterSPtr usedMinParam = _parameterManager.getParameterFromExpression(minExpr.str(), originalParam->getGapThreshold());
  2698 + AMDA::Parameters::ParameterSPtr usedMinParam = _parameterManager.getParameterFromExpression(minExpr.str(), originalParam->getGapThreshold(), true);
2699 2699  
2700 2700 if (usedMinParam == nullptr)
2701 2701 {
... ... @@ -2716,7 +2716,7 @@ void PanelPlotOutput::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_
2716 2716 << "+$" + maxParam->getId() << maxParamIndex.str();
2717 2717  
2718 2718 //create parameter from expression
2719   - AMDA::Parameters::ParameterSPtr usedMaxParam = _parameterManager.getParameterFromExpression(maxExpr.str(), originalParam->getGapThreshold());
  2719 + AMDA::Parameters::ParameterSPtr usedMaxParam = _parameterManager.getParameterFromExpression(maxExpr.str(), originalParam->getGapThreshold(), true);
2720 2720  
2721 2721 if (usedMaxParam == nullptr)
2722 2722 {
... ...
src/ParamOutputImpl/Plot/Scatter/XYPlot.cc
... ... @@ -138,7 +138,7 @@ void XYPlot::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_)
138 138 boost::replace_all(expr, OrbitParamComponentName, usedXParam->getId());
139 139  
140 140 //create parameter from expression
141   - usedYParam = _parameterManager.getParameterFromExpression(expr, usedXParam->getGapThreshold());
  141 + usedYParam = _parameterManager.getParameterFromExpression(expr, usedXParam->getGapThreshold(), true);
142 142  
143 143 if (usedYParam == nullptr)
144 144 {
... ...
src/Parameters/ParameterManager.cc
... ... @@ -158,7 +158,7 @@ ParameterSPtr&amp; ParameterManager::checkIfIsANeededParameter(ParameterSPtr&amp; pParam
158 158 }
159 159  
160 160 ParameterSPtr ParameterManager::getSampledParameter(const std::string& pIDParam,
161   - const std::string &samplingMode, float samplingValue, float gapThreshold)
  161 + const std::string &samplingMode, float samplingValue, float gapThreshold, bool isUserProcess)
162 162 {
163 163 ParameterSPtr lParameter;
164 164 if (samplingMode == "") {
... ... @@ -198,6 +198,7 @@ ParameterSPtr ParameterManager::getSampledParameter(const std::string&amp; pIDParam,
198 198 applyParamIdCorrection(fixedParamId);
199 199 lBuffer.str(""); lBuffer << "$" << fixedParamId;
200 200 lProcess->setExpression(lBuffer.str());
  201 + lProcess->setIsUserProcess(isUserProcess);
201 202 DataWriterSPtr lDataWriter(lProcess);
202 203 lParameter->setDataWriter(lDataWriter);
203 204 } else {
... ... @@ -212,7 +213,7 @@ ParameterSPtr ParameterManager::getSampledParameter(const std::string&amp; pIDParam,
212 213 return lParameter;
213 214 }
214 215  
215   -ParameterSPtr ParameterManager::getSampledParameterUnderRefParam(const std::string& pIDParam, const std::string& pIDRefParam)
  216 +ParameterSPtr ParameterManager::getSampledParameterUnderRefParam(const std::string& pIDParam, const std::string& pIDRefParam, bool isUserProcess)
216 217 {
217 218 //make a name for the resampled parameter
218 219 boost::hash<std::string> string_hash;
... ... @@ -252,6 +253,7 @@ ParameterSPtr ParameterManager::getSampledParameterUnderRefParam(const std::stri
252 253 applyParamIdCorrection(fixedParamId);
253 254 lBuffer.str(""); lBuffer << "$" << fixedParamId;
254 255 lProcess->setExpression(lBuffer.str());
  256 + lProcess->setIsUserProcess(isUserProcess);
255 257 lProcess->setReferenceParameter(lrefParameter);
256 258 DataWriterSPtr lDataWriter(lProcess);
257 259 lParameter->setDataWriter(lDataWriter);
... ... @@ -268,7 +270,7 @@ ParameterSPtr ParameterManager::getSampledParameterUnderRefParam(const std::stri
268 270 return lParameter;
269 271 }
270 272  
271   -ParameterSPtr ParameterManager::getParameterFromExpression(const std::string& pExpression, double gapThreshold)
  273 +ParameterSPtr ParameterManager::getParameterFromExpression(const std::string& pExpression, double gapThreshold, bool isUserProcess)
272 274 {
273 275 boost::hash<std::string> string_hash;
274 276 std::stringstream lIdent;
... ... @@ -297,6 +299,7 @@ ParameterSPtr ParameterManager::getParameterFromExpression(const std::string&amp; pE
297 299 {
298 300 //set expression and create the data writer
299 301 lProcess->setExpression(pExpression);
  302 + lProcess->setIsUserProcess(isUserProcess);
300 303 if (!isNAN(gapThreshold))
301 304 lProcess->setGapThreshold(gapThreshold);
302 305 DataWriterSPtr lDataWriter(lProcess);
... ...
src/Parameters/ParameterManager.hh
... ... @@ -70,17 +70,17 @@ namespace AMDA
70 70 /**
71 71 * get the parameter or if sampling information is asked, create the sampling parameter
72 72 */
73   - ParameterSPtr getSampledParameter(const std::string& pIDParam, const std::string &samplingMode = "", float samplingValue = 0.0, float gapThreshold = 0.0);
  73 + ParameterSPtr getSampledParameter(const std::string& pIDParam, const std::string &samplingMode = "", float samplingValue = 0.0, float gapThreshold = 0.0, bool isUserProcess = true);
74 74  
75 75 /**
76 76 * get a resampled parameter under a reference parameter
77 77 */
78   - ParameterSPtr getSampledParameterUnderRefParam(const std::string& pIDParam, const std::string& pIDRefParam);
  78 + ParameterSPtr getSampledParameterUnderRefParam(const std::string& pIDParam, const std::string& pIDRefParam, bool isUserProcess);
79 79  
80 80 /**
81 81 * get a parameter from an expression
82 82 */
83   - ParameterSPtr getParameterFromExpression(const std::string& pExpression, double gapThreshold = NAN);
  83 + ParameterSPtr getParameterFromExpression(const std::string& pExpression, double gapThreshold = NAN, bool isUserProcess = true);
84 84  
85 85 /**
86 86 * get a parameter identify by parameterName
... ...
src/Parameters/Process.cc
... ... @@ -28,7 +28,7 @@ Process::Process(Parameter &amp;parameter) :
28 28 AMDA::Parameters::DataWriter(parameter)
29 29 ,DataClient()
30 30 ,_operation(NULL),
31   - _refParameterSPtr(ParameterSPtr()), _gapThreshold(NAN) {
  31 + _refParameterSPtr(ParameterSPtr()), _gapThreshold(NAN), _isUserProcess(false) {
32 32 }
33 33  
34 34 /**
... ... @@ -41,7 +41,7 @@ Process::Process(const Process &amp;pProcess, Parameter &amp;parameter) :
41 41 , _expression(pProcess._expression)
42 42 , _description(pProcess._description)
43 43 ,_operation(NULL), //No need clone of the operation, it is done in the 'init' method implementation
44   - _refParameterSPtr(pProcess._refParameterSPtr), _gapThreshold(pProcess._gapThreshold)
  44 + _refParameterSPtr(pProcess._refParameterSPtr), _gapThreshold(pProcess._gapThreshold), _isUserProcess(pProcess._isUserProcess)
45 45 {
46 46  
47 47 }
... ...
src/Parameters/Process.hh
... ... @@ -60,6 +60,10 @@ public:
60 60 ParameterSPtr getReferenceParameter() { return _refParameterSPtr; }
61 61 AttributeList& getAttributList() { return _attributList; }
62 62  
  63 + bool isUserProcess() {
  64 + return _isUserProcess;
  65 + }
  66 +
63 67 // Set methods
64 68 void setExpression(const std::string& expression) { _expression = expression; }
65 69 void setDescription(const std::string& description) { _description = description; }
... ... @@ -67,6 +71,13 @@ public:
67 71 void setReferenceParameter( ParameterSPtr refParameterSPtr) { _refParameterSPtr = refParameterSPtr;}
68 72 void setGapThreshold(double gapThreshold) { _gapThreshold = gapThreshold; }
69 73  
  74 + /**
  75 + * Set flag to know if it's a process built especially for a user
  76 + */
  77 + void setIsUserProcess(bool isUserProcess) {
  78 + _isUserProcess = isUserProcess;
  79 + }
  80 +
70 81 // Others methods
71 82  
72 83 virtual bool isEmptyExpression() { return _expression.empty(); }
... ... @@ -86,6 +97,7 @@ protected:
86 97 Operation *_operation;
87 98 ParameterSPtr _refParameterSPtr;
88 99 double _gapThreshold;
  100 + bool _isUserProcess;
89 101 };
90 102  
91 103 typedef boost::shared_ptr<Process> ProcessSPtr;
... ...
src/XMLParameterConfigurator/ProcessNode.cc
... ... @@ -75,6 +75,14 @@ void ProcessNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext&amp;
75 75 xmlFree(lProcessDesc);
76 76 }
77 77  
  78 + //user process
  79 + xmlChar *lUserProcess = xmlGetProp(pNode, (const xmlChar *) "userProcess");
  80 + if (lUserProcess != NULL)
  81 + {
  82 + lProcess->setIsUserProcess(strcasecmp ((const char*)lUserProcess, "true") == 0);
  83 + xmlFree(lUserProcess);
  84 + }
  85 +
78 86 DataWriterSPtr lDataWriter( lProcess);
79 87 std::string* xmlFileName = pContext.get<std::string*>();
80 88 lDataWriter->setSignatureTrigger(*xmlFileName);
... ...
src/amdaParameterGenerator/ParameterGenerator.cc
... ... @@ -19,7 +19,7 @@ Generator::~Generator() {
19 19 }
20 20  
21 21 void Generator::establishConnection() {
22   - _parameter = _parameterManager.getSampledParameter(_paramName, _samplingMode, _samplingValue, _gapThreshold).get();
  22 + _parameter = _parameterManager.getSampledParameter(_paramName, _samplingMode, _samplingValue, _gapThreshold, true).get();
23 23 if(_parameter == NULL) {
24 24 LOG4CXX_ERROR(_logger,"ParamOutput::init parameter : \""<< _paramName <<"\" Not Exist" );
25 25 BOOST_THROW_EXCEPTION( ParamOutput_exception());
... ...
src/amdaParameterInfo/ParameterInfo.cc
... ... @@ -23,7 +23,7 @@ ParameterInfo::~ParameterInfo() {
23 23 }
24 24  
25 25 void ParameterInfo::establishConnection() {
26   - _parameter = _parameterManager.getSampledParameter(_paramName, _samplingMode, _samplingValue, _gapThreshold).get();
  26 + _parameter = _parameterManager.getSampledParameter(_paramName, _samplingMode, _samplingValue, _gapThreshold, true).get();
27 27 if(_parameter == NULL) {
28 28 LOG4CXX_ERROR(_logger,"ParamOutput::init parameter : \""<< _paramName <<"\" Not Exist" );
29 29 BOOST_THROW_EXCEPTION( ParamOutput_exception());
... ...