DSPatch  v.7.0.1
Public Member Functions | List of all members
DSPatch::Circuit Class Referencefinal

Workspace for adding and routing components. More...

#include <Circuit.h>

Public Member Functions

 NONCOPYABLE (Circuit)
 
 DEFINE_PTRS (Circuit)
 
int AddComponent (Component::SPtr const &component)
 
void RemoveComponent (Component::SCPtr const &component)
 
void RemoveComponent (int componentIndex)
 
void RemoveAllComponents ()
 
int GetComponentCount () const
 
bool ConnectOutToIn (Component::SCPtr const &fromComponent, int fromOutput, Component::SCPtr const &toComponent, int toInput)
 
bool ConnectOutToIn (Component::SCPtr const &fromComponent, int fromOutput, int toComponent, int toInput)
 
bool ConnectOutToIn (int fromComponent, int fromOutput, Component::SCPtr const &toComponent, int toInput)
 
bool ConnectOutToIn (int fromComponent, int fromOutput, int toComponent, int toInput)
 
void DisconnectComponent (Component::SCPtr const &component)
 
void DisconnectComponent (int componentIndex)
 
void SetBufferCount (int bufferCount)
 
int GetBufferCount () const
 
void Tick (Component::TickMode mode=Component::TickMode::Parallel)
 
void StartAutoTick (Component::TickMode mode=Component::TickMode::Parallel)
 
void StopAutoTick ()
 
void PauseAutoTick ()
 
void ResumeAutoTick ()
 

Detailed Description

Workspace for adding and routing components.

Components can be added to a Circuit via the AddComponent() method, and routed to and from other components via the ConnectOutToIn() methods.

NOTE: Each component input can only accept a single "wire" at a time. When a wire is connected to an input that already has a connected wire, that wire is replaced with the new one. One output, on the other hand, can be distributed to multiple inputs.

To boost performance in stream processing circuits, multi-buffering can be enabled via the SetBufferCount() method. A circuit's buffer count can be adjusted at runtime.

The Circuit Tick() method runs through it's internal array of components and calls each component's Tick() and Reset() methods once. A circuit's Tick() method can be called in a loop from the main application thread, or alternatively, by calling StartAutoTick(), a separate thread will spawn, automatically calling Tick() continuously until PauseAutoTick() or StopAutoTick() is called.

TickMode::Parallel (default) will spawn a thread per component in a circuit. The aim of this mode is to improve the performance of circuits that contain parallel branches. TickMode::Series on the other hand, tells the circuit to tick its components one-by-one in a single thread. This mode aims to improve the performance of circuits that do not contain parallel branches.

Definition at line 89 of file Circuit.h.


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