Inviwo  0.9.10.1
Inviwo documentation
inviwo::StateCoordinator< T > Class Template Reference

#include <statecoordinator.h>

+ Inheritance diagram for inviwo::StateCoordinator< T >:

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
 

Detailed Description

template<typename T>
class inviwo::StateCoordinator< T >

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.

Constructor & Destructor Documentation

◆ StateCoordinator()

template<typename T>
inviwo::StateCoordinator< T >::StateCoordinator ( const T &  value,
std::function< void(const T &)>  notifyer,
std::function< T()>  updater 
)
inline

Construct a StateCoordinator with a initial value, a notification functor, and a update functor.

Member Function Documentation

◆ get()

template<typename T>
const T& inviwo::StateCoordinator< T >::get ( ) const
inline

Get the value.

◆ operator const T &()

template<typename T>
inviwo::StateCoordinator< T >::operator const T & ( ) const
inline

Implicit conversion to value.

◆ setNotify()

template<typename T>
void inviwo::StateCoordinator< T >::setNotify ( std::function< void(const T &)>  notifier)
inline

Set the notifier functor

◆ setUpdate()

template<typename T>
void inviwo::StateCoordinator< T >::setUpdate ( std::function< T()>  updater)
inline

Set the update functor

◆ update()

template<typename T>
void inviwo::StateCoordinator< T >::update ( )
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.


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