Switchboard Extension SDK
Loading...
Searching...
No Matches
switchboard::EventEmitter Class Reference

Base class for objects that can emit events. More...

#include <EventEmitter.hpp>

Inheritance diagram for switchboard::EventEmitter:
switchboard::SwitchboardObject switchboard::Engine switchboard::Extension switchboard::Node switchboard::AudioNode switchboard::AudioProcessorNode switchboard::AudioSinkNode switchboard::AudioSourceNode switchboard::SingleBusAudioProcessorNode switchboard::SingleBusAudioSinkNode switchboard::SingleBusAudioSourceNode

Public Member Functions

 EventEmitter ()
 Constructor for the EventEmitter class.
virtual ~EventEmitter ()
 Destructor for the EventEmitter class.
unsigned int addEventListener (const std::string &eventName, EventCallback callback)
 Adds a new event listener to the object.
bool removeEventListener (unsigned int listenerID)
 Removes an event listener from the object.

Protected Member Functions

void emitEvent (const std::string &eventName, const EventData &data)
 Emits an event.

Detailed Description

Base class for objects that can emit events.

Member Function Documentation

◆ addEventListener()

unsigned int switchboard::EventEmitter::addEventListener ( const std::string & eventName,
EventCallback callback )

Adds a new event listener to the object.

Parameters
eventNameThe name of the event to listen to.
callbackThe callback function to call when the event is fired.
Returns
The ID of the listener.

◆ emitEvent()

void switchboard::EventEmitter::emitEvent ( const std::string & eventName,
const EventData & data )
protected

Emits an event.

Parameters
eventNameThe name of the event to fire.
dataThe data to pass to the event listeners.

◆ removeEventListener()

bool switchboard::EventEmitter::removeEventListener ( unsigned int listenerID)

Removes an event listener from the object.

Parameters
listenerIDThe ID of the listener to remove.
Returns
True if the listener was removed, false if the listener was not found.

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