fix: 添加 hasExpression(),修复 bound_alg/exp_bound 编译错误

This commit is contained in:
Huamonarch 2026-05-15 16:01:14 +08:00
parent 18a5675109
commit 43c545eea3
3 changed files with 7 additions and 4 deletions

View File

@ -28,7 +28,7 @@ void BoundAlg::doInitExtend() {
} }
bool BoundAlg::checkFilter() { bool BoundAlg::checkFilter() {
if (!expr_engine_->exps_.count("feedback")) { if (!expr_engine_->hasExpression("feedback")) {
return true; // 无筛选表达式,所有数据参与 return true; // 无筛选表达式,所有数据参与
} }
try { try {

View File

@ -1,8 +1,8 @@
#include "mix_cc/ihyper_db.h" #include <mix_cc/ihyper_db.h>
#include <algorithm> #include <algorithm>
#include <base/BitTool.h> #include <base/BitTool.h>
#include <eqpalg/algs/exp_bound.h>> #include <eqpalg/algs/exp_bound.h>
#include <eqpalg/exp_macro/get_macro_replaced_exp.h> #include <eqpalg/exp_macro/get_macro_replaced_exp.h>
#include <eqpalg/feature_extraction/daa.h> #include <eqpalg/feature_extraction/daa.h>
#include <eqpalg/utility/build_alarm_info.h> #include <eqpalg/utility/build_alarm_info.h>
@ -23,7 +23,7 @@ int ExpBound::init() {
res += this->reload_config_data_source(); /*3.数据源*/ res += this->reload_config_data_source(); /*3.数据源*/
logger_->Debug() << "数据来源,0:iHyperDB,1:memory" << this->data_source_ logger_->Debug() << "数据来源,0:iHyperDB,1:memory" << this->data_source_
<< ",单位unit_" << unit_ << std::endl; << ",单位unit_" << unit_ << std::endl;
res += this->first_fill_mm_vars(); /*4.数据项*/ res += expr_engine_->firstFill(data_source_, now_time_, query_time_range_); /*4.数据项*/
res += init_X_exp(); res += init_X_exp();
rule_stat_.unit = unit_; rule_stat_.unit = unit_;
rule_stat_.limit_down = -32768; rule_stat_.limit_down = -32768;

View File

@ -56,6 +56,9 @@ public:
*/ */
int registerRawExpression(const std::string& name, const std::string& raw_exp_str); int registerRawExpression(const std::string& name, const std::string& raw_exp_str);
/** 查询表达式是否已注册 */
bool hasExpression(const std::string& name) const { return exps_.count(name) > 0; }
// ========== 表达式求值 ========== // ========== 表达式求值 ==========
double evaluate(const std::string& name); double evaluate(const std::string& name);