ESP  0.1
The Example-based Sensor Predictions (ESP) system tries to bring machine learning to the maker community.
tuneable.h File Reference

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)
 

Detailed Description

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:

  1. If a corresponding callback is provided, it's called
  2. If there is no callback provided, we proceed to reload the pipeline

Function Documentation

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.

Parameters
valuereference 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.
minthe minimum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter.
maxthe maximum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter.
namethe name of the tuneable parameter. Will be shown to the user.
descriptionthe description of the tuneable parameter. Shown to the user.
cba 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.

Parameters
valuereference 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.
minthe minimum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter.
maxthe maximum value of the parameter, used to contrain the range of values to which the user can set the tuneable parameter.
namethe name of the tuneable parameter. Will be shown to the user.
descriptionthe description of the tuneable parameter. Shown to the user.
cba 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.

Parameters
valuereference 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.
namethe name of the tuneable parameter. Will be shown to the user.
descriptionthe description of the tuneable parameter. Shown to the user.
cba callback function that is invoked when user input is received.