TracktionEngine
Loading...
Searching...
No Matches
engine::AsyncFunctionCaller Struct Reference

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

Detailed Description

Holds a list of function objects and enables you to call them asyncronously.

Constructor & Destructor Documentation

◆ AsyncFunctionCaller()

engine::AsyncFunctionCaller::AsyncFunctionCaller ( )
default

Creates an empty AsyncFunctionCaller.

◆ ~AsyncFunctionCaller()

engine::AsyncFunctionCaller::~AsyncFunctionCaller ( )
override

Destructor.

Member Function Documentation

◆ addFunction()

void engine::AsyncFunctionCaller::addFunction ( int functionID,
const std::function< void()> & f )

Adds a function and associates a functionID with it.

References functions.

◆ updateAsync()

void engine::AsyncFunctionCaller::updateAsync ( int functionID)

Triggers an asyncronous call to one of the functions.

References functions.

◆ handleUpdateNowIfNeeded()

void 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.

◆ handleAsyncUpdate()

void engine::AsyncFunctionCaller::handleAsyncUpdate ( )
override

.

References functions.

Member Data Documentation

◆ functions

std::map<int, std::pair<bool, std::function<void (void)> > > engine::AsyncFunctionCaller::functions

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