From 43c545eea371d771eb3d3c2145d06aa2ec7f9d0c Mon Sep 17 00:00:00 2001 From: Huamonarch Date: Fri, 15 May 2026 16:01:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=20hasExpression()?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=20bound=5Falg/exp=5Fbound=20?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eqpalg/algs/bound_alg.cpp | 2 +- eqpalg/algs/exp_bound.cpp | 6 +++--- eqpalg/utility/expression_engine.h | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/eqpalg/algs/bound_alg.cpp b/eqpalg/algs/bound_alg.cpp index 8f78086..7321e0a 100644 --- a/eqpalg/algs/bound_alg.cpp +++ b/eqpalg/algs/bound_alg.cpp @@ -28,7 +28,7 @@ void BoundAlg::doInitExtend() { } bool BoundAlg::checkFilter() { - if (!expr_engine_->exps_.count("feedback")) { + if (!expr_engine_->hasExpression("feedback")) { return true; // 无筛选表达式,所有数据参与 } try { diff --git a/eqpalg/algs/exp_bound.cpp b/eqpalg/algs/exp_bound.cpp index 66e8355..a1a18a2 100644 --- a/eqpalg/algs/exp_bound.cpp +++ b/eqpalg/algs/exp_bound.cpp @@ -1,8 +1,8 @@ -#include "mix_cc/ihyper_db.h" +#include #include #include -#include > +#include #include #include #include @@ -23,7 +23,7 @@ int ExpBound::init() { res += this->reload_config_data_source(); /*3.数据源*/ logger_->Debug() << "数据来源,0:iHyperDB,1:memory:" << this->data_source_ << ",单位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(); rule_stat_.unit = unit_; rule_stat_.limit_down = -32768; diff --git a/eqpalg/utility/expression_engine.h b/eqpalg/utility/expression_engine.h index 293aa56..26b0957 100644 --- a/eqpalg/utility/expression_engine.h +++ b/eqpalg/utility/expression_engine.h @@ -56,6 +56,9 @@ public: */ 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);