ProcessMexVexElsDecode.cc 2.33 KB
/*
 * 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 {

  ProcessMexVexElsDecode::ProcessMexVexElsDecode(Parameter &parameter, std::string energyTable) : MultiParamProcess_CRTP(parameter), _energyTable(energyTable) {
  }

  ProcessMexVexElsDecode::ProcessMexVexElsDecode(const ProcessMexVexElsDecode& pProcess, Parameter &parameter)
    : MultiParamProcess_CRTP(pProcess,parameter) {
  }

  ProcessMexVexElsDecode::~ProcessMexVexElsDecode() {
  }

  void ProcessMexVexElsDecode::establishConnection() {
	  ParameterCreatorFromExpression creator(_parameter.getParameterManager());
	  ParameterSPtr lParameter = creator.getOneParameterFromExpression(_parameter,_expression);
	  _paramNameList[lParameter->getId()].first = lParameter;
	
	  if (_parameter.getId() != _energyTable) {
		 ParameterSPtr energyTableParam = _parameter.getParameterManager().getParameter(_energyTable);
	    _paramNameList[energyTableParam->getId()].first = energyTableParam;
	  }

	  MultiParamProcess::establishConnection();
  }

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

	ParamData* lmainParamInput = _paramNameList.begin()->second.first->getParamData(this).get();

	MexVexElsDecodeCreator lMexVexElsDecodeCreator(*this, *lmainParamInput, _energyTable);
	_operation = lMexVexElsDecodeCreator.getOperation();	
	//_operation = new MexVexElsDecode::MexVexElsDecode<float>(*this, *lmainParamInput);
	_paramData = ParamDataSPtr(_operation->getParamOutput());
	_paramData->setMinSampling(lmainParamInput->getMinSampling());

	return timeStamp;
}

ProcessMexElsDecode::ProcessMexElsDecode(Parameter &parameter) : ProcessMexVexElsDecode(parameter, "mex_els_energytable") {
	
}

ProcessVexElsDecode::ProcessVexElsDecode(Parameter &parameter) : ProcessMexVexElsDecode(parameter, "vex_els_energytable") {
	
}

} /* namespace Parameters */
} /* namespace AMDA */