[修改]修改了错误的exporter名称
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Created by fly on 2022/4/6.
|
||||
//
|
||||
|
||||
#ifndef FAULT_SIMULATION_ALGORITHM_ALGORITHM_HPP
|
||||
#define FAULT_SIMULATION_ALGORITHM_ALGORITHM_HPP
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
class algorithm {
|
||||
public:
|
||||
virtual void set_config(nlohmann::json const &config) = 0;
|
||||
|
||||
virtual nlohmann::json config() = 0;
|
||||
|
||||
virtual double eval(double value) = 0;
|
||||
|
||||
protected:
|
||||
double jsonValue(nlohmann::json const &j, std::string const &key) {
|
||||
if (j.contains(key)) {
|
||||
if (j[key].is_string()) {
|
||||
return std::atof(j[key].get<std::string>().c_str());
|
||||
}
|
||||
if (j[key].is_number()) {
|
||||
return j[key].get<double>();
|
||||
}
|
||||
}
|
||||
|
||||
return std::nan("");
|
||||
}
|
||||
};
|
||||
|
||||
#endif //FAULT_SIMULATION_ALGORITHM_ALGORITHM_HPP
|
||||
Reference in New Issue
Block a user