ParamTableProcess.cc
2.58 KB
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
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
/*
* ParamTableProcess.cc
*
* Created on: Nov 23, 2022
* Author: AKKA
*/
#include "ParamTableProcess.hh"
#include <stdlib.h>
#include <string>
#include "AMDA_exception.hh"
#include "DicError.hh"
#include "ParameterManager.hh"
#include "ParamMgr.hh"
#include "ParamTableOperation.hh"
namespace AMDA {
namespace Parameters {
ParamTableProcess::ParamTableProcess(Parameter ¶meter)
: MultiParamProcess_CRTP(parameter) {
}
ParamTableProcess::ParamTableProcess(const ParamTableProcess& pProcess, Parameter ¶meter)
: MultiParamProcess_CRTP(pProcess,parameter) {
//Establish Connection Without Parse
MultiParamProcess::establishConnection();
}
ParamTableProcess::~ParamTableProcess() {
}
void ParamTableProcess::establishConnection() {
std::vector<std::string> strs;
boost::split(strs, _expression, boost::is_any_of("|"));
if (strs.size() != 2) {
BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ParamTableProcess::establishConnection cannot retrieve paramId or dim")));
}
std::string paramId = strs[0];
int dim = std::stoi(strs[1].c_str());
_paramSPtr = _parameter.getParameterManager().getParameter(paramId);
_paramNameList[_paramSPtr->getId()].first = _paramSPtr;
AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(_paramSPtr->getInfoId());
if (paramInfo == nullptr) {
BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ParamTableProcess::establishConnection cannot retrieve param info")));
}
_paramTable = paramInfo->getTable(dim);
std::map<std::string, std::string> tableParams = _paramTable->getTableParams(&_parameter.getParameterManager());
for (std::map<std::string, std::string>::iterator it = tableParams.begin(); it != tableParams.end(); ++it) {
AMDA::Parameters::ParameterSPtr p = _parameter.getParameterManager().getParameter(it->second);
_paramNameList[it->second].first = p;
}
MultiParamProcess::establishConnection();
}
TimeStamp ParamTableProcess::init() {
TimeStamp timeStamp = MultiParamProcess::init();
//_parameter.init(this, _timeIntervalList);
this->setOperation((Operation*)(new AMDA::Parameters::ParamTable::ParamTableOperation(*this)));
this->getParamData().reset( this->getOperation()->getParamOutput());
return timeStamp;
}
boost::shared_ptr<AMDA::Info::ParamTable> ParamTableProcess::getParamTable() {
return _paramTable;
}
} /* namespace Parameters */
} /* namespace AMDA */