eis/eqpalg/build_algorithm.cpp

76 lines
2.4 KiB
C++
Raw Permalink Normal View History

#include <eqpalg/algs/roller2.h>
#include <eqpalg/algs/trend_slope2.h>
#include <eqpalg/build_algorithm.h>
#include <eqpalg/algs/bound_alg.h>
#include <eqpalg/algs/bound_hold_alg.h>
#include <eqpalg/algs/exp_bound.h>
#include <eqpalg/algs/exp_sample2D.h>
#include <eqpalg/algs/exp_times.h>
#include <eqpalg/algs/fault_code.h>
#include <eqpalg/algs/feedback_alg.h>
#include <eqpalg/algs/glitch_detection.h>
#include <eqpalg/algs/logic_alg.h>
#include <eqpalg/algs/null.h>
#include <eqpalg/algs/roller3.h>
#include <eqpalg/algs/trend_slope3.h>
std::unique_ptr<AlgBase> build_algorithm(int algId, const string &ruleId,
const string &name,
const mix_cc::json &rule_json,
const double padding_low,
const double padding_up) {
LOG d("build_algorithm");
switch (algId) {
case 1:
return std::make_unique<LogicAlg>(name, rule_json, ruleId);
break;
case 2:
return std::make_unique<BoundAlg>(name, rule_json, ruleId);
break;
case 3:
return std::make_unique<FeedbackAlg>(name, rule_json, ruleId, algId);
break;
case 4:
return std::make_unique<FeedbackAlg>(name, rule_json, ruleId, algId);
break;
case 5:
return std::make_unique<BoundHoldAlg>(name, rule_json, ruleId);
break;
case 6:
case 7:
return std::make_unique<ExpTimes>(name, rule_json, ruleId, algId);
break;
case 8:
return std::make_unique<TrendSlope2>(name, rule_json, ruleId);
break;
case 9:
return std::make_unique<Roller2>(name, rule_json, ruleId, -1);
break;
case 10:
case 11:
return std::make_unique<FaultCode>(name, rule_json, ruleId, algId - 10);
break;
case 12:
case 13:
return std::make_unique<ExpSample2D>(name, rule_json, ruleId, algId);
break;
case 14:
return std::make_unique<TrendSlope3>(name, rule_json, ruleId);
break;
case 15:
return std::make_unique<GlitchDetection>(name, rule_json, ruleId);
break;
case 16:
case 18:
return std::make_unique<Roller3>(name, rule_json, ruleId, algId);
break;
case 17:
return std::make_unique<ExpBound>(name, rule_json, ruleId, algId);
break;
default:
d.Warn() << "undefined algorithm" << endl;
return std::make_unique<Null>(name, rule_json, ruleId);
}
d.Warn() << "out of control flow" << endl;
return std::make_unique<Null>(name, rule_json, ruleId);
}