#include <mc_rtc/gui/StateBuilder.h>
Public Member Functions | |
StateBuilder () | |
template<typename T > | |
void | addElement (const std::vector< std::string > &category, T element) |
template<typename SourceT , typename T > | |
void | addElement (SourceT *source, const std::vector< std::string > &category, T element) |
template<typename T , typename... Args> | |
void | addElement (const std::vector< std::string > &category, T element, Args... args) |
template<typename SourceT , typename T , typename... Args> | |
void | addElement (SourceT *source, const std::vector< std::string > &category, T element, Args... args) |
template<typename T > | |
void | addElement (const std::vector< std::string > &category, ElementsStacking stacking, T element) |
template<typename SourceT , typename T > | |
void | addElement (SourceT *source, const std::vector< std::string > &category, ElementsStacking stacking, T element) |
template<typename T , typename... Args> | |
void | addElement (const std::vector< std::string > &category, ElementsStacking stacking, T element, Args... args) |
template<typename SourceT , typename T , typename... Args> | |
void | addElement (SourceT *source, const std::vector< std::string > &category, ElementsStacking stacking, T element, Args... args) |
bool | hasElement (const std::vector< std::string > &category, const std::string &name) |
void | reset () |
void | removeCategory (const std::vector< std::string > &category) |
void | removeElement (const std::vector< std::string > &category, const std::string &name) |
void | removeElements (void *source) |
void | removeElements (const std::vector< std::string > &category, void *source, bool recurse=false) |
template<typename... Args> | |
void | addXYPlot (const std::string &name, plot::AxisConfiguration xConfig, plot::AxisConfiguration yLeftConfig, plot::AxisConfiguration yRightConfig, Args... args) |
template<typename... Args> | |
void | addXYPlot (const std::string &name, plot::AxisConfiguration xConfig, plot::AxisConfiguration yLeftConfig, Args... args) |
template<typename... Args> | |
void | addXYPlot (const std::string &name, plot::AxisConfiguration xConfig, Args... args) |
template<typename... Args> | |
void | addXYPlot (const std::string &name, Args... args) |
template<typename T , typename... Args> | |
void | addPlot (const std::string &name, T abscissa, plot::AxisConfiguration yLeftConfig, plot::AxisConfiguration yRightConfig, Args... args) |
template<typename T , typename... Args> | |
void | addPlot (const std::string &name, T abscissa, plot::AxisConfiguration yLeftConfig, Args... args) |
template<typename T , typename... Args> | |
void | addPlot (const std::string &name, T abscissa, Args... args) |
template<typename T > | |
bool | addPlotData (const std::string &name, T data) |
void | removePlot (const std::string &name) |
size_t | update (std::vector< char > &data) |
void | update () |
bool | handleRequest (const std::vector< std::string > &category, const std::string &name, const mc_rtc::Configuration &data) |
mc_rtc::Configuration | data () |
size_t | size () const |
Static Public Attributes | |
static constexpr int8_t | PROTOCOL_VERSION = 4 |
Used to build a GUI state from multiple objects
mc_rtc::gui::StateBuilder::StateBuilder | ( | ) |
Constructor
void mc_rtc::gui::StateBuilder::addElement | ( | const std::vector< std::string > & | category, |
ElementsStacking | stacking, | ||
T | element | ||
) |
void mc_rtc::gui::StateBuilder::addElement | ( | const std::vector< std::string > & | category, |
ElementsStacking | stacking, | ||
T | element, | ||
Args... | args | ||
) |
Add multiple elements to the same category at once with a specific stacking
category | Category of the elements |
element | Element added to the GUI |
stacking | Stacking direction |
args | Other elements added to the GUI |
void mc_rtc::gui::StateBuilder::addElement | ( | const std::vector< std::string > & | category, |
T | element | ||
) |
void mc_rtc::gui::StateBuilder::addElement | ( | const std::vector< std::string > & | category, |
T | element, | ||
Args... | args | ||
) |
Add multiple elements to the same category at once
category | Category of the elements |
element | Element added to the GUI |
args | Other elements added to the GUI |
void mc_rtc::gui::StateBuilder::addElement | ( | SourceT * | source, |
const std::vector< std::string > & | category, | ||
ElementsStacking | stacking, | ||
T | element | ||
) |
void mc_rtc::gui::StateBuilder::addElement | ( | SourceT * | source, |
const std::vector< std::string > & | category, | ||
ElementsStacking | stacking, | ||
T | element, | ||
Args... | args | ||
) |
Add multiple elements to the same category at once with a specific stacking
source | Source attached to this object |
category | Category of the elements |
element | Element added to the GUI |
stacking | Stacking direction |
args | Other elements added to the GUI |
void mc_rtc::gui::StateBuilder::addElement | ( | SourceT * | source, |
const std::vector< std::string > & | category, | ||
T | element | ||
) |
void mc_rtc::gui::StateBuilder::addElement | ( | SourceT * | source, |
const std::vector< std::string > & | category, | ||
T | element, | ||
Args... | args | ||
) |
Add multiple elements to the same category at once
source | Source attached to this object |
category | Category of the elements |
element | Element added to the GUI |
args | Other elements added to the GUI |
void mc_rtc::gui::StateBuilder::addPlot | ( | const std::string & | name, |
T | abscissa, | ||
Args... | args | ||
) |
Add a plot identified by the provided name
In this form, T is expected to provide an abscissa, the other parameters are expected to provide Y-axis or XY-axis data
name | Name of the plot, this is a unique identifier |
abscissa | Describe the abscissa axis |
void mc_rtc::gui::StateBuilder::addPlot | ( | const std::string & | name, |
T | abscissa, | ||
plot::AxisConfiguration | yLeftConfig, | ||
Args... | args | ||
) |
Add a plot identified by the provided name
In this form, T is expected to provide an abscissa, the other parameters are expected to provide Y-axis or 2D data
name | Name of the plot, this is a unique identifier |
abscissa | Describe the abscissa axis |
yLeftConfig | Configuration for the left axis |
void mc_rtc::gui::StateBuilder::addPlot | ( | const std::string & | name, |
T | abscissa, | ||
plot::AxisConfiguration | yLeftConfig, | ||
plot::AxisConfiguration | yRightConfig, | ||
Args... | args | ||
) |
Add a plot identified by the provided name
In this form, T is expected to provide an abscissa, the other parameters are expected to provide Y-axis or 2D data
name | Name of the plot, this is a unique identifier |
abscissa | Describe the abscissa axis |
yLeftConfig | Configuration for the left axis |
yRightConfig | Configuration for the right axis |
bool mc_rtc::gui::StateBuilder::addPlotData | ( | const std::string & | name, |
T | data | ||
) |
Add more data to an existing plot
T must be a Y-axis or 2D data
No-op if the plot has not been added yet
No-op if T a Y-axis and the plot was added with addXYPlot
name | Name of the plot, it must have been added via addPlot or addXYPlot before |
data | Extra data to be added |
void mc_rtc::gui::StateBuilder::addXYPlot | ( | const std::string & | name, |
Args... | args | ||
) |
Add a plot identified by the provided name
In this form, Args are expected to provide 2D data
name | Name of the plot |
xConfig | Configuration for the left axis |
yLeftConfig | Configuration for the left axis |
void mc_rtc::gui::StateBuilder::addXYPlot | ( | const std::string & | name, |
plot::AxisConfiguration | xConfig, | ||
Args... | args | ||
) |
Add a plot identified by the provided name
In this form, Args are expected to provide 2D data
name | Name of the plot |
xConfig | Configuration for the left axis |
yLeftConfig | Configuration for the left axis |
void mc_rtc::gui::StateBuilder::addXYPlot | ( | const std::string & | name, |
plot::AxisConfiguration | xConfig, | ||
plot::AxisConfiguration | yLeftConfig, | ||
Args... | args | ||
) |
Add a plot identified by the provided name
In this form, Args are expected to provide 2D data
name | Name of the plot |
xConfig | Configuration for the left axis |
yLeftConfig | Configuration for the left axis |
void mc_rtc::gui::StateBuilder::addXYPlot | ( | const std::string & | name, |
plot::AxisConfiguration | xConfig, | ||
plot::AxisConfiguration | yLeftConfig, | ||
plot::AxisConfiguration | yRightConfig, | ||
Args... | args | ||
) |
Add a plot identified by the provided name
In this form, Args are expected to provide 2D data
name | Name of the plot |
xConfig | Configuration for the left axis |
yLeftConfig | Configuration for the left axis |
yRightConfig | Configuration for the right axis |
mc_rtc::Configuration mc_rtc::gui::StateBuilder::data | ( | ) |
Access static data store
This assumes you are accessing the data to modify and will trigger a regeneration of the data portion of the message. For better performances use sparsely.
bool mc_rtc::gui::StateBuilder::handleRequest | ( | const std::vector< std::string > & | category, |
const std::string & | name, | ||
const mc_rtc::Configuration & | data | ||
) |
Handle a request
bool mc_rtc::gui::StateBuilder::hasElement | ( | const std::vector< std::string > & | category, |
const std::string & | name | ||
) |
Checks if an element is already in the GUI
category | Category of the element |
name | Name of the element |
void mc_rtc::gui::StateBuilder::removeCategory | ( | const std::vector< std::string > & | category | ) |
Remove a given category
void mc_rtc::gui::StateBuilder::removeElement | ( | const std::vector< std::string > & | category, |
const std::string & | name | ||
) |
Remove a single element
void mc_rtc::gui::StateBuilder::removeElements | ( | const std::vector< std::string > & | category, |
void * | source, | ||
bool | recurse = false |
||
) |
Remove all elements attached to the given source in the specified category
category | Category where elements will be searched |
source | Source that will be searched |
recurse | Also search for elements in sub-categories of the given category |
void mc_rtc::gui::StateBuilder::removeElements | ( | void * | source | ) |
Remove all elements attached to the given source
One should prefer to remove a category or target a specific category, otherwise the whole GUI has to be searched to find matching elements
For example, if your source has added a category and a few elements in the root: gui()->removeCategory({"MyCategory"}); gui()->removeElements({}, this); Should be used instead of: gui()->removeElements(this);
void mc_rtc::gui::StateBuilder::removePlot | ( | const std::string & | name | ) |
Remove a plot identified by the provided name
void mc_rtc::gui::StateBuilder::reset | ( | ) |
Remove all elements
|
inline |
Return the number of elements in the GUI
void mc_rtc::gui::StateBuilder::update | ( | ) |
Update the plots only
size_t mc_rtc::gui::StateBuilder::update | ( | std::vector< char > & | data | ) |
Update the GUI message
data | Will hold binary data representing the GUI |
|
staticconstexpr |