Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::Dispatcher< C > Class Template Referencefinal

#include <inviwo/core/util/dispatcher.h>

Public Types

using Callback = std::function<C>
 
using Function = C
 
using Handle = std::shared_ptr<Callback>
 

Public Member Functions

template<typename T >
Handle add (T &&callback)
 
 Dispatcher (const Dispatcher &)
 
 Dispatcher (Dispatcher &&rhs) noexcept
 
template<typename... A>
void invoke (A &&... args)
 
Dispatcheroperator= (const Dispatcher &that)
 
Dispatcheroperator= (Dispatcher &&that) noexcept
 

Detailed Description

template<typename C>
class inviwo::Dispatcher< C >

Dispatches functions to a number of callbacks and cleans up callbacks when they are dead. Thread-safe via copy-on-write semantics on the callback vector.

  • add() is implemented with a CAS loop that copies the callback vector, appends the new callback and attempts to swap it in.
  • invoke() performs a single load of the callback vector and invokes all live callbacks. No locks are held during invocation.

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