6 #ifndef CONSTCONFIGIOGROUP_HPP_INCLUDE
7 #define CONSTCONFIGIOGROUP_HPP_INCLUDE
26 const std::string &user_file_path,
27 const std::string &default_file_path,
39 int push_signal(
const std::string &signal_name,
int domain_type,
int domain_idx)
override;
43 int push_control(
const std::string &control_name,
int domain_type,
int domain_idx)
override;
48 double sample(
int batch_idx)
override;
52 void adjust(
int batch_idx,
double setting)
override;
53 double read_signal(
const std::string &signal_name,
int domain_type,
int domain_idx)
override;
57 void write_control(
const std::string &control_name,
int domain_type,
int domain_idx,
double setting)
override;
62 std::function<double(
const std::vector<double> &)>
agg_function(
const std::string &signal_name)
const override;
63 std::function<std::string(
double)>
format_function(
const std::string &signal_name)
const override;
72 void save_control(
const std::string &save_path)
override;
77 std::string
name(
void)
const override;
82 struct m_signal_desc_s {
83 json11::Json::Type type;
87 struct m_signal_info_s {
90 std::function<double(
const std::vector<double> &)>
agg_function;
91 std::string description;
92 bool is_common_value_provided;
93 std::vector<double> values;
96 struct m_signal_ref_s {
97 std::shared_ptr<m_signal_info_s> signal_info;
101 void parse_config_json(
const std::string &config);
102 static json11::Json construct_config_json_obj(
const std::string &config);
103 static void check_json_signal(
const json11::Json::object::value_type &signal);
105 static const std::string M_PLUGIN_NAME;
106 static const std::string M_SIGNAL_PREFIX;
107 static const std::map<std::string, m_signal_desc_s> M_SIGNAL_FIELDS;
108 static const std::string M_CONFIG_PATH_ENV;
109 static const std::string M_DEFAULT_CONFIG_FILE_PATH;
112 const std::string M_THIS_HOST;
113 std::map<std::string, std::shared_ptr<m_signal_info_s> > m_signal_available;
114 std::vector<m_signal_ref_s> m_pushed_signals;
Definition: ConstConfigIOGroup.hpp:22
void restore_control(void) override
Does nothing; this IOGroup does not provide any controls.
Definition: ConstConfigIOGroup.cpp:244
std::string signal_description(const std::string &signal_name) const override
Returns a description of the signal. This string can be used by tools to generate help text for users...
Definition: ConstConfigIOGroup.cpp:271
static std::unique_ptr< IOGroup > make_plugin(void)
Definition: ConstConfigIOGroup.cpp:319
ConstConfigIOGroup()
Definition: ConstConfigIOGroup.cpp:41
void save_control(void) override
Does nothing; this IOGroup does not provide any controls.
Definition: ConstConfigIOGroup.cpp:240
std::set< std::string > signal_names(void) const override
Returns the names of all signals provided by the IOGroup.
Definition: ConstConfigIOGroup.cpp:79
double sample(int batch_idx) override
Retrieve signal value from data read by last call to read_batch() for a particular signal previously ...
Definition: ConstConfigIOGroup.cpp:175
void write_batch(void) override
Does nothing; this IOGroup does not provide any controls.
Definition: ConstConfigIOGroup.cpp:171
double read_signal(const std::string &signal_name, int domain_type, int domain_idx) override
Read from platform and interpret into SI units a signal given its name and domain....
Definition: ConstConfigIOGroup.cpp:198
std::set< std::string > control_names(void) const override
Definition: ConstConfigIOGroup.cpp:88
bool is_valid_control(const std::string &control_name) const override
Definition: ConstConfigIOGroup.cpp:98
int control_domain_type(const std::string &control_name) const override
Definition: ConstConfigIOGroup.cpp:114
int signal_domain_type(const std::string &signal_name) const override
Definition: ConstConfigIOGroup.cpp:103
static std::string plugin_name(void)
Definition: ConstConfigIOGroup.cpp:314
std::function< double(const std::vector< double > &)> agg_function(const std::string &signal_name) const override
Return a function that should be used when aggregating the given signal.
Definition: ConstConfigIOGroup.cpp:249
bool is_valid_signal(const std::string &signal_name) const override
Test if signal_name refers to a signal supported by the group.
Definition: ConstConfigIOGroup.cpp:93
int signal_behavior(const std::string &signal_name) const override
Definition: ConstConfigIOGroup.cpp:298
int push_control(const std::string &control_name, int domain_type, int domain_idx) override
Should not be called; this IOGroup does not provide any controls.
Definition: ConstConfigIOGroup.cpp:159
void adjust(int batch_idx, double setting) override
Should not be called; this IOGroup does not provide any controls.
Definition: ConstConfigIOGroup.cpp:191
void write_control(const std::string &control_name, int domain_type, int domain_idx, double setting) override
Should not be called; this IOGroup does not provide any controls.
Definition: ConstConfigIOGroup.cpp:231
int push_signal(const std::string &signal_name, int domain_type, int domain_idx) override
Add a signal to the list of signals that is read by read_batch() and sampled by sample().
Definition: ConstConfigIOGroup.cpp:119
std::function< std::string(double)> format_function(const std::string &signal_name) const override
Returns a function that can be used to convert a signal of the given name into a printable string....
Definition: ConstConfigIOGroup.cpp:261
void read_batch(void) override
this is essentially a no-op as this IOGroup's signals are constant.
Definition: ConstConfigIOGroup.cpp:167
std::string name(void) const override
Get the IOGroup name.
Definition: ConstConfigIOGroup.cpp:309
std::string control_description(const std::string &control_name) const override
Definition: ConstConfigIOGroup.cpp:290
Definition: IOGroup.hpp:21
std::string hostname(void)
Returns the current hostname as a string.
Definition: Helper.cpp:132