Vuo  2.0.0
Public Types | Public Member Functions | List of all members
VuoTriggerSet< TriggerDataType, TriggerContextType > Class Template Reference

Description

template<typename TriggerDataType, typename TriggerContextType = void *>
class VuoTriggerSet< TriggerDataType, TriggerContextType >

Manages a set of callbacks for nodes' trigger ports.

It's safe for multiple threads to call addTrigger(), removeTrigger(), size(), and fire() on the same set.

Definition at line 21 of file VuoTriggerSet.hh.

Public Types

typedef void(* TriggerFunctionType) (TriggerDataType)
 A node's trigger method. More...
 

Public Member Functions

 VuoTriggerSet ()
 Creates a new trigger set. More...
 
 ~VuoTriggerSet ()
 Destroys the trigger set. More...
 
void addTrigger (TriggerFunctionType trigger)
 Adds a trigger method to the trigger set. More...
 
void addTrigger (TriggerFunctionType trigger, TriggerContextType context)
 Adds a trigger method, with caller-defined context data, to the trigger set. More...
 
void removeTrigger (TriggerFunctionType trigger)
 Removes a trigger method from the trigger set. More...
 
unsigned int size (void)
 Returns the number of triggers in the trigger set. More...
 
void fire (TriggerDataType data)
 Fires the contextless triggers in the trigger set, passing them data. More...
 
void fire (void(^)(TriggerFunctionType trigger, TriggerContextType context))
 Fires the context-having triggers in the trigger set, passing them data. More...
 

Member Typedef Documentation

◆ TriggerFunctionType

template<typename TriggerDataType , typename TriggerContextType = void *>
typedef void(* VuoTriggerSet< TriggerDataType, TriggerContextType >::TriggerFunctionType) (TriggerDataType)

A node's trigger method.

Definition at line 25 of file VuoTriggerSet.hh.

Constructor & Destructor Documentation

◆ VuoTriggerSet()

template<typename TriggerDataType , typename TriggerContextType >
VuoTriggerSet< TriggerDataType, TriggerContextType >::VuoTriggerSet

Creates a new trigger set.

Definition at line 48 of file VuoTriggerSet.hh.

◆ ~VuoTriggerSet()

template<typename TriggerDataType , typename TriggerContextType >
VuoTriggerSet< TriggerDataType, TriggerContextType >::~VuoTriggerSet

Destroys the trigger set.

Definition at line 57 of file VuoTriggerSet.hh.

Member Function Documentation

◆ addTrigger() [1/2]

template<typename TriggerDataType , typename TriggerContextType >
void VuoTriggerSet< TriggerDataType, TriggerContextType >::addTrigger ( TriggerFunctionType  trigger)

Adds a trigger method to the trigger set.

This function may be called from any thread.

Definition at line 70 of file VuoTriggerSet.hh.

◆ addTrigger() [2/2]

template<typename TriggerDataType , typename TriggerContextType >
void VuoTriggerSet< TriggerDataType, TriggerContextType >::addTrigger ( TriggerFunctionType  trigger,
TriggerContextType  context 
)

Adds a trigger method, with caller-defined context data, to the trigger set.

This function may be called from any thread.

Definition at line 83 of file VuoTriggerSet.hh.

◆ fire() [1/2]

template<typename TriggerDataType , typename TriggerContextType >
void VuoTriggerSet< TriggerDataType, TriggerContextType >::fire ( TriggerDataType  data)

Fires the contextless triggers in the trigger set, passing them data.

This function may be called from any thread.

Definition at line 130 of file VuoTriggerSet.hh.

◆ fire() [2/2]

template<typename TriggerDataType , typename TriggerContextType >
void VuoTriggerSet< TriggerDataType, TriggerContextType >::fire ( void(^)(TriggerFunctionType trigger, TriggerContextType context)  block)

Fires the context-having triggers in the trigger set, passing them data.

This function may be called from any thread.

Definition at line 144 of file VuoTriggerSet.hh.

◆ removeTrigger()

template<typename TriggerDataType , typename TriggerContextType >
void VuoTriggerSet< TriggerDataType, TriggerContextType >::removeTrigger ( TriggerFunctionType  trigger)

Removes a trigger method from the trigger set.

This function may be called from any thread.

Definition at line 96 of file VuoTriggerSet.hh.

◆ size()

template<typename TriggerDataType , typename TriggerContextType >
unsigned int VuoTriggerSet< TriggerDataType, TriggerContextType >::size ( void  )

Returns the number of triggers in the trigger set.

This function may be called from any thread.

Definition at line 115 of file VuoTriggerSet.hh.


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