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

Workspace for adding and routing components. More...

#include <Circuit.h>

Inheritance diagram for DSPatch::Circuit:
DSPatch::Component

Public Member Functions

 NONCOPYABLE (Circuit)
 
 DEFINE_PTRS (Circuit)
 
 Circuit (int threadCount=0)
 
virtual void PauseAutoTick () override
 
void SetInputCount (int inputCount)
 
void SetOutputCount (int outputCount)
 
void SetThreadCount (int threadCount)
 
int GetThreadCount () const
 
int AddComponent (Component::SPtr const &component)
 
void RemoveComponent (Component::SCPtr const &component)
 
void RemoveComponent (int component)
 
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)
 
bool ConnectInToIn (int fromInput, Component::SCPtr const &toComponent, int toInput)
 
bool ConnectInToIn (int fromInput, int toComponent, int toInput)
 
bool ConnectOutToOut (Component::SCPtr const &fromComponent, int fromOutput, int toOutput)
 
bool ConnectOutToOut (int fromComponent, int fromOutput, int toOutput)
 
void DisconnectComponent (Component::SCPtr const &component)
 
void DisconnectComponent (int componentIndex)
 
- Public Member Functions inherited from DSPatch::Component
 NONCOPYABLE (Component)
 
 DEFINE_PTRS (Component)
 
void Tick ()
 
void Reset ()
 
virtual void StartAutoTick ()
 
virtual void StopAutoTick ()
 
virtual void ResumeAutoTick ()
 
bool ConnectInput (Component::SPtr const &fromComponent, int fromOutput, int toInput)
 
void DisconnectInput (int inputNo)
 
void DisconnectInput (Component::SCPtr const &fromComponent)
 
void DisconnectAllInputs ()
 
int GetInputCount () const
 
int GetOutputCount () const
 
std::string GetInputName (int inputNo) const
 
std::string GetOutputName (int outputNo) const
 

Protected Member Functions

virtual void Process_ (SignalBus const &inputs, SignalBus &outputs) override
 
- Protected Member Functions inherited from DSPatch::Component
void SetInputCount_ (int inputCount, std::vector< std::string > const &inputNames={})
 
void SetOutputCount_ (int outputCount, std::vector< std::string > const &outputNames={})
 

Detailed Description

Workspace for adding and routing components.

Components can be added to a Circuit and routed to and from other Components. ConnectOutToIn and DisconnectOutToIn provide a means of routing component outputs to other component inputs, while ConnectInToIn / DisconnectInToIn and ConnectOutToOut / DisconnectOutToOut route the circuit's IO signals to and from it's internal components.

N.B. Each component input can only accept one 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.

For process intensive circuits, multi-threaded processing can be enabled via the SetThreadCount() method. The Circuit class allows the user to specify the number of threads in which he/she requires the circuit to process (0 threads: multi-threading disabled). A circuit's thread count can be adjusted at runtime, allowing the user to increase / decrease the number of threads as required during execution.

Circuit is derived from Component and therefore inherits all Component behavior. This means that a Circuit can be added to, and routed within another Circuit as a component. This also means a circuit object needs to be Tick()ed and Reset()ed as a component (see Component). The Circuit Process_() method simply runs through it's internal array of components and calls each component's Tick() and Reset() methods.

Definition at line 62 of file Circuit.h.


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