iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::ParamChangedListener Class Referenceabstract

#include <nrt/Core/Model/ParamChangedListener.H>

Base class for a listener for Parameter changes on a Blackboard.

Parameter listeners get called each time a parameter value changes on the Blackboard they monitor. Typically, a graphical user interface would register a listener for the Blackboard that holds the Module (and possible sub-components/sub-modules) whose parameters are displayed in the user interface, so that the values of these parameters gets updated in real time.

Definition at line 50 of file ParamChangedListener.H.

Inherited by ConfigurationWidget.

Public Member Functions

 ParamChangedListener ()=delete
 No default constructor.
 ParamChangedListener (std::string const &bbuid, std::string const &module)
 Constructor specifying which Module on which Blackboard to monitor. More...
void activate ()
 Activate the listener (start listening) More...
void deactivate ()
 De-activate the listener (stop listening)
virtual ~ParamChangedListener ()
 Virtual destructor for safe inheritance. More...
std::string const & bbuid () const
 Recover the Blackboard uid that we are listening on.
std::string const & module () const
 Recover the Module uid that we are listening on.
virtual void onParamChanged (nrt::ParameterState const state, nrt::ParameterSummary const &ps)=0
 Callback function called when a parameter of the monitored Module is changed. More...

Constructor & Destructor Documentation

nrt::ParamChangedListener::ParamChangedListener ( std::string const &  bbuid,
std::string const &  module 

Constructor specifying which Module on which Blackboard to monitor.

After construction, the listener needs to be activated by calling activate(). This is not done during construction as objects that derive from ParamChangeListener and overload onParamChanged() will not be fully constructed yet by the time the base class constructor is invoked, which would result in a pure virtual function called fatal error.

virtual nrt::ParamChangedListener::~ParamChangedListener ( )

Virtual destructor for safe inheritance.

If needed, this will automatically deactivate() first.

Member Function Documentation

void nrt::ParamChangedListener::activate ( )

Activate the listener (start listening)

onParamChanged() may be called immediately upon activation.

virtual void nrt::ParamChangedListener::onParamChanged ( nrt::ParameterState const  state,
nrt::ParameterSummary const &  ps 
pure virtual

Callback function called when a parameter of the monitored Module is changed.

Derived classes must overload this function and take the desired action upon Parameter change.

The documentation for this class was generated from the following file: