6#ifndef IOGROUP_HPP_INCLUDE
7#define IOGROUP_HPP_INCLUDE
51 static std::unique_ptr<IOGroup>
make_unique(
const std::string &iogroup_name);
117 virtual double sample(
int sample_idx) = 0;
169 virtual std::function<double(
const std::vector<double> &)>
agg_function(
const std::string &signal_name)
const = 0;
174 virtual std::function<std::string(
double)>
format_function(
const std::string &signal_name)
const;
212 virtual std::string
name(
void)
const = 0;
224 static const std::string M_UNITS[];
225 static const std::string M_BEHAVIORS[];
226 static const std::map<std::string, m_units_e> M_UNITS_STRING;
227 static const std::map<std::string, m_signal_behavior_e> M_BEHAVIOR_STRING;
Definition IOGroup.hpp:231
virtual ~IOGroupFactory()=default
IOGroupFactory()
Definition IOGroup.cpp:86
virtual std::function< std::string(double)> format_function(const std::string &signal_name) const
Returns a function that can be used to convert a signal of the given name into a printable string....
Definition IOGroup.cpp:208
static std::unique_ptr< IOGroup > make_unique(const std::string &iogroup_name)
Definition IOGroup.cpp:202
m_signal_behavior_e
Description of the runtime behavior of a signal.
Definition IOGroup.hpp:36
@ M_NUM_SIGNAL_BEHAVIOR
Definition IOGroup.hpp:45
@ M_SIGNAL_BEHAVIOR_VARIABLE
signals that vary up and down over time
Definition IOGroup.hpp:42
@ M_SIGNAL_BEHAVIOR_CONSTANT
signals that have a constant value
Definition IOGroup.hpp:38
@ M_SIGNAL_BEHAVIOR_MONOTONE
signals that increase monotonically
Definition IOGroup.hpp:40
@ M_SIGNAL_BEHAVIOR_LABEL
signals that should not be summarized over time
Definition IOGroup.hpp:44
virtual bool is_valid_signal(const std::string &signal_name) const =0
Test if signal_name refers to a signal supported by the group.
virtual void save_control(const std::string &save_path)=0
virtual void save_control(void)=0
Save the state of all controls so that any subsequent changes made through the IOGroup can be undone ...
virtual int signal_behavior(const std::string &signal_name) const =0
Returns a hint about how a signal will change as a function of time.
virtual void restore_control(void)=0
Restore all controls to values recorded in previous call to the save() method.
virtual std::string name(void) const =0
Get the IOGroup name.
virtual int control_domain_type(const std::string &control_name) const =0
Query the domain for a named control.
static std::vector< std::string > iogroup_names(void)
Definition IOGroup.cpp:196
static std::string units_to_string(int)
Convert the m_units_e value to the corresponding string.
Definition IOGroup.cpp:234
virtual void restore_control(const std::string &save_path)=0
virtual std::string control_description(const std::string &control_name) const =0
Returns a description of the control. This string can be used by tools to generate help text for user...
virtual bool is_valid_control(const std::string &control_name) const =0
Test if control_name refers to a control supported by the group.
virtual std::function< double(const std::vector< double > &)> agg_function(const std::string &signal_name) const =0
Return a function that should be used when aggregating the given signal.
virtual double sample(int sample_idx)=0
Retrieve signal value from data read by last call to read_batch() for a particular signal previously ...
virtual void read_batch(void)=0
Read all pushed signals from the platform so that the next call to sample() will reflect the updated ...
virtual double read_signal(const std::string &signal_name, int domain_type, int domain_idx)=0
Read from platform and interpret into SI units a signal given its name and domain....
virtual void write_batch(void)=0
Write all of the pushed controls so that values previously given to adjust() are written to the platf...
static m_units_e string_to_units(const std::string &str)
Convert a string to the corresponding m_units_e value.
Definition IOGroup.cpp:224
virtual void adjust(int control_idx, double setting)=0
Adjust a setting for a particular control that was previously pushed with push_control()....
static m_signal_behavior_e string_to_behavior(const std::string &str)
Convert a string to the corresponding m_signal_behavior_e value.
Definition IOGroup.cpp:243
virtual int push_signal(const std::string &signal_name, int domain_type, int domain_idx)=0
Add a signal to the list of signals that is read by read_batch() and sampled by sample().
virtual void write_control(const std::string &control_name, int domain_type, int domain_idx, double setting)=0
Interpret the setting and write setting to the platform. Does not modify the values stored by calling...
virtual int push_control(const std::string &control_name, int domain_type, int domain_idx)=0
Add a control to the list of controls that is written by write_batch() and configured with adjust().
virtual ~IOGroup()=default
virtual std::string signal_description(const std::string &signal_name) const =0
Returns a description of the signal. This string can be used by tools to generate help text for users...
m_units_e
Definition IOGroup.hpp:23
@ M_UNITS_HERTZ
Definition IOGroup.hpp:26
@ M_NUM_UNITS
Definition IOGroup.hpp:32
@ M_UNITS_JOULES
Definition IOGroup.hpp:28
@ M_UNITS_VOLTS
Definition IOGroup.hpp:31
@ M_UNITS_CELSIUS
Definition IOGroup.hpp:29
@ M_UNITS_WATTS
Definition IOGroup.hpp:27
@ M_UNITS_AMPERES
Definition IOGroup.hpp:30
@ M_UNITS_NONE
Definition IOGroup.hpp:24
@ M_UNITS_SECONDS
Definition IOGroup.hpp:25
virtual std::set< std::string > signal_names(void) const =0
Returns the names of all signals provided by the IOGroup.
static const std::string M_PLUGIN_PREFIX
Definition IOGroup.hpp:221
virtual int signal_domain_type(const std::string &signal_name) const =0
Query the domain for a named signal.
virtual std::set< std::string > control_names(void) const =0
Returns the names of all controls provided by the IOGroup.
#define GEOPM_PUBLIC
Definition geopm_public.h:10
IOGroupFactory & iogroup_factory(void)
Definition IOGroup.cpp:183