Blame view

src/ExternLib/mexvex_els_decode/ProcessMexVexElsDecode.cc 2.54 KB
35de3ffa   Elena.Budnik   mexvex_els
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
/*
 * ProcessMexVexElsDecode.cc
 *
 *  Created on: Oct 14, 2016
 *      Author: elena
 */
#include <stdlib.h>
#include <string>

#include <boost/lexical_cast.hpp>

#include "DicError.hh"
#include "AMDA_exception.hh"

#include "Operation.hh"
#include "ParameterManager.hh"
#include "ProcessMexVexElsDecode.hh"
#include "MexVexElsDecodeCreator.hh"
//#include "MexVexElsDecode.hh"
#include "ParamMgr.hh"
#include "ParameterCreatorFromExpression.hh"

using namespace std;
using namespace boost;
using namespace log4cxx;

namespace AMDA {
namespace Parameters {

6a28e3ab   Benjamin Renard   Fix Mex/Vex ELS p...
30
  ProcessMexVexElsDecode::ProcessMexVexElsDecode(Parameter &parameter) : MultiParamProcess_CRTP(parameter) {
35de3ffa   Elena.Budnik   mexvex_els
31
32
33
  }

  ProcessMexVexElsDecode::ProcessMexVexElsDecode(const ProcessMexVexElsDecode& pProcess, Parameter &parameter)
c960cb6f   Benjamin Renard   Fix copy construc...
34
    : MultiParamProcess_CRTP(pProcess,parameter), _energyTableName(pProcess._energyTableName), _inputParamName(pProcess._inputParamName)  {
35de3ffa   Elena.Budnik   mexvex_els
35
36
37
38
39
  }

  ProcessMexVexElsDecode::~ProcessMexVexElsDecode() {
  }

6a28e3ab   Benjamin Renard   Fix Mex/Vex ELS p...
40
41
  void ProcessMexVexElsDecode::parse() {
  	ParameterCreatorFromExpression creator(_parameter.getParameterManager());
854a7fcf   Benjamin Renard   First implementat...
42
  	ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression, isUserProcess());
6a28e3ab   Benjamin Renard   Fix Mex/Vex ELS p...
43
  	_paramNameList[lParameter->getId()].first = lParameter;
c960cb6f   Benjamin Renard   Fix copy construc...
44
	_inputParamName = lParameter->getId();
6a28e3ab   Benjamin Renard   Fix Mex/Vex ELS p...
45
46
47
48
  	if (_attributList.size() != 1) {
  		BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessMexVexElsDecode::parse require one attribute'")));
  	}
	if (_attributList[0] != _expression) {
854a7fcf   Benjamin Renard   First implementat...
49
		lParameter = creator.getOneParameterFromExpression(_parameter,_attributList[0], isUserProcess());
6a28e3ab   Benjamin Renard   Fix Mex/Vex ELS p...
50
51
52
53
54
55
56
		_paramNameList[lParameter->getId()].first = lParameter;
		_energyTableName = lParameter->getId();
	}
	else {
		_energyTableName = lParameter->getId();
	}
  }
35de3ffa   Elena.Budnik   mexvex_els
57

6a28e3ab   Benjamin Renard   Fix Mex/Vex ELS p...
58
59
60
  void ProcessMexVexElsDecode::establishConnection() {
  	parse();
  	MultiParamProcess::establishConnection();
35de3ffa   Elena.Budnik   mexvex_els
61
62
63
64
65
66
  }

  TimeStamp  ProcessMexVexElsDecode::init() {
	
	TimeStamp timeStamp = MultiParamProcess::init();

6a28e3ab   Benjamin Renard   Fix Mex/Vex ELS p...
67
68
69
	ParamData* lmainParamInput = _paramNameList[_inputParamName].first->getParamData(this).get();

	ParamData* lenergyTableParamInput = _paramNameList[_energyTableName].first->getParamData(this).get();
35de3ffa   Elena.Budnik   mexvex_els
70

6a28e3ab   Benjamin Renard   Fix Mex/Vex ELS p...
71
	MexVexElsDecodeCreator lMexVexElsDecodeCreator(*this, *lmainParamInput, *lenergyTableParamInput);
35de3ffa   Elena.Budnik   mexvex_els
72
	_operation = lMexVexElsDecodeCreator.getOperation();	
35de3ffa   Elena.Budnik   mexvex_els
73
74
75
76
77
78
	_paramData = ParamDataSPtr(_operation->getParamOutput());
	_paramData->setMinSampling(lmainParamInput->getMinSampling());

	return timeStamp;
}

35de3ffa   Elena.Budnik   mexvex_els
79
80
} /* namespace Parameters */
} /* namespace AMDA */