TracktionEngine
|
Holds a list of function objects and enables you to call them asyncronously. More...
#include <tracktion_AsyncFunctionUtils.h>
Inherits juce::AsyncUpdater.
Public Member Functions | |
AsyncFunctionCaller ()=default | |
Creates an empty AsyncFunctionCaller. | |
~AsyncFunctionCaller () override | |
Destructor. | |
void | addFunction (int functionID, const std::function< void()> &f) |
Adds a function and associates a functionID with it. | |
void | updateAsync (int functionID) |
Triggers an asyncronous call to one of the functions. | |
void | handleUpdateNowIfNeeded () |
If an update has been triggered and is pending, this will invoke it synchronously. | |
void | handleAsyncUpdate () override |
Public Attributes | |
std::map< int, std::pair< bool, std::function< void(void)> > > | functions |
Holds a list of function objects and enables you to call them asyncronously.
|
default |
Creates an empty AsyncFunctionCaller.
|
override |
Destructor.
void tracktion::engine::AsyncFunctionCaller::addFunction | ( | int | functionID, |
const std::function< void()> & | f | ||
) |
Adds a function and associates a functionID with it.
References functions.
void tracktion::engine::AsyncFunctionCaller::updateAsync | ( | int | functionID | ) |
Triggers an asyncronous call to one of the functions.
References functions.
void tracktion::engine::AsyncFunctionCaller::handleUpdateNowIfNeeded | ( | ) |
If an update has been triggered and is pending, this will invoke it synchronously.
Use this as a kind of "flush" operation - if an update is pending, the handleAsyncUpdate() method will be called immediately; if no update is pending, then nothing will be done.
Because this may invoke the callback, this method must only be called on the main event thread.
|
override |
.
References functions.
std::map<int, std::pair<bool, std::function<void (void)> > > tracktion::engine::AsyncFunctionCaller::functions |
Referenced by addFunction(), handleAsyncUpdate(), and updateAsync().