47 lines
1.5 KiB
C++
47 lines
1.5 KiB
C++
|
|
#include <eqpalg/algs/exp_sample_multi_dim.h>
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief 重新载入多维样本相关配置
|
||
|
|
* @return int
|
||
|
|
*/
|
||
|
|
int ExpSampleMultiDim::init() {
|
||
|
|
int ret = 0;
|
||
|
|
try {
|
||
|
|
ExpSample::init();
|
||
|
|
this->reload_config_xyz();
|
||
|
|
if (sample_tag_x1_str_ != "null" && !sample_tag_x1_str_.empty()) {
|
||
|
|
exp_xs_.emplace_back(std::make_unique<mix_cc::matheval::Expression>(
|
||
|
|
sample_tag_x1_str_.c_str(), &this->mm_vars));
|
||
|
|
}
|
||
|
|
if (sample_tag_x2_str_ != "null" && !sample_tag_x2_str_.empty()) {
|
||
|
|
exp_xs_.emplace_back(std::make_unique<mix_cc::matheval::Expression>(
|
||
|
|
sample_tag_x2_str_.c_str(), &this->mm_vars));
|
||
|
|
}
|
||
|
|
if (sample_tag_x3_str_ != "null" && !sample_tag_x3_str_.empty()) {
|
||
|
|
exp_xs_.emplace_back(std::make_unique<mix_cc::matheval::Expression>(
|
||
|
|
sample_tag_x3_str_.c_str(), &this->mm_vars));
|
||
|
|
}
|
||
|
|
this->logger_->Debug() << "sample tag load done" << std::endl;
|
||
|
|
} catch (const std::exception& e) {
|
||
|
|
std::throw_with_nested(
|
||
|
|
mix_cc::Exception(-1, "load error", BOOST_CURRENT_LOCATION));
|
||
|
|
ret = -1;
|
||
|
|
}
|
||
|
|
return ret;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief 载入样本结果表达式
|
||
|
|
* @return int
|
||
|
|
*/
|
||
|
|
int ExpSampleMultiDim::reload_config_xyz() {
|
||
|
|
json x1 = this->rule_json_["sample"]["tag_x1"][1];
|
||
|
|
this->sample_tag_x1_str_ = x1.get<std::string>();
|
||
|
|
json x2 = this->rule_json_["sample"]["tag_x2"][1];
|
||
|
|
this->sample_tag_x2_str_ = x2.get<std::string>();
|
||
|
|
json x3 = this->rule_json_["sample"]["tag_x3"][1];
|
||
|
|
this->sample_tag_x3_str_ = x3.get<std::string>();
|
||
|
|
|
||
|
|
return 0;
|
||
|
|
}
|