ESP
0.1
The Example-based Sensor Predictions (ESP) system tries to bring machine learning to the maker community.
|
Functions for specifying parameters that can be tuned by the user. More...
#include <string>
#include "ofxDatGui.h"
Go to the source code of this file.
Classes | |
class | Tuneable |
Functions | |
void | registerTuneable (int &value, int min, int max, const string &name, const string &description, std::function< void(int)> cb=nullptr) |
void | registerTuneable (double &value, double min, double max, const string &name, const string &description, std::function< void(double)> cb=nullptr) |
void | registerTuneable (bool &value, const string &name, const string &description, std::function< void(bool)> cb=nullptr) |
Functions for specifying parameters that can be tuned by the user.
For each tuneable parameter, a corresponding slider or checkbox is created in the interface to allow the user to modify the value of that parameter.
There are two possible behaviors when UI event happens:
void registerTuneable | ( | int & | value, |
int | min, | ||
int | max, | ||
const string & | name, | ||
const string & | description, | ||
std::function< void(int)> | cb = nullptr |
||
) |
Create a tuneable parameter of type int. This will generate a slider in the interface allowing the user to modify the value of the variable referenced by this tuneable parameter.
value | reference to the variable in which the value of this tuneable parameter is stored. The initial value of the tuneable parameter will be taken from the value of this variable when this function is called. When the user changes the value of the tuneable parameter, the variable referenced by this parameter will be set to the new value. |
min | the minimum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter. |
max | the maximum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter. |
name | the name of the tuneable parameter. Will be shown to the user. |
description | the description of the tuneable parameter. Shown to the user. |
cb | a callback function that is invoked when user input is received. |
void registerTuneable | ( | double & | value, |
double | min, | ||
double | max, | ||
const string & | name, | ||
const string & | description, | ||
std::function< void(double)> | cb = nullptr |
||
) |
Create a tuneable parameter of type double. This will generate a slider in the interface allowing the user to modify the value of the variable referenced by this tuneable parameter.
value | reference to the variable in which the value of this tuneable parameter is stored. The initial value of the tuneable parameter will be taken from the value of this variable when this function is called. When the user changes the value of the tuneable parameter, the variable referenced by this parameter will be set to the new value. |
min | the minimum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter. |
max | the maximum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter. |
name | the name of the tuneable parameter. Will be shown to the user. |
description | the description of the tuneable parameter. Shown to the user. |
cb | a callback function that is invoked when user input is received. |
void registerTuneable | ( | bool & | value, |
const string & | name, | ||
const string & | description, | ||
std::function< void(bool)> | cb = nullptr |
||
) |
Create a tuneable parameter of type bool. This will generate a checkbox in the interface allowing the user to modify the value of the variable referenced by this tuneable parameter. Checking the checkbox sets the variable to true; unchecking it sets it to false.
value | reference to the variable in which the value of this tuneable parameter is stored. The initial value of the tuneable parameter will be taken from the value of this variable when this function is called. When the user changes the value of the tuneable parameter, the variable referenced by this parameter will be set to the new value. |
name | the name of the tuneable parameter. Will be shown to the user. |
description | the description of the tuneable parameter. Shown to the user. |
cb | a callback function that is invoked when user input is received. |