Inviwo
0.9.10.1
Inviwo documentation
|
#include <statecoordinator.h>
Public Member Functions | |
StateCoordinator (const T &value, std::function< void(const T &)> notifyer, std::function< T()> updater) | |
void | update () |
void | setUpdate (std::function< T()> updater) |
void | setNotify (std::function< void(const T &)> notifier) |
operator const T & () const | |
const T & | get () const |
A utility class for keeping track of changes to some state, and delivering notifications when it changes. The StateCoordinator uses two functors one for updating the state (updater), and one for delivering a notification (notifier) when the result of the updater changes. Moreover there is an update function which the user should call whenever the result of the updater might change. For example in Processor the isSink StateCoordinator updater depends on the number of outports, hence we call update after each call to addPort and removePort.
|
inline |
Construct a StateCoordinator with a initial value, a notification functor, and a update functor.
|
inline |
Get the value.
|
inline |
Implicit conversion to value.
|
inline |
Set the notifier functor
|
inline |
Set the update functor
|
inline |
Trigger an update. Will call the updater and if the value changes call the notifier. This function should be called whenever the outcome of the updater might change.