TracktionEngine
Public Member Functions | Public Attributes | List of all members
tracktion::engine::AsyncFunctionCaller Struct Reference

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

Inherits juce::AsyncUpdater.

Public Member Functions

 AsyncFunctionCaller ()=default
 Creates an empty AsyncFunctionCaller. More...
 
 ~AsyncFunctionCaller () override
 Destructor. More...
 
void addFunction (int functionID, const std::function< void()> &f)
 Adds a function and associates a functionID with it. More...
 
void updateAsync (int functionID)
 Triggers an asyncronous call to one of the functions. More...
 
void handleUpdateNowIfNeeded ()
 If an update has been triggered and is pending, this will invoke it synchronously. More...
 
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()

tracktion::engine::AsyncFunctionCaller::AsyncFunctionCaller ( )
default

Creates an empty AsyncFunctionCaller.

◆ ~AsyncFunctionCaller()

tracktion::engine::AsyncFunctionCaller::~AsyncFunctionCaller ( )
override

Destructor.

Member Function Documentation

◆ addFunction()

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

Adds a function and associates a functionID with it.

References functions.

◆ updateAsync()

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

Triggers an asyncronous call to one of the functions.

References functions.

◆ handleUpdateNowIfNeeded()

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.

◆ handleAsyncUpdate()

void tracktion::engine::AsyncFunctionCaller::handleAsyncUpdate ( )
override

.

References functions.

Member Data Documentation

◆ functions

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

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