![]() |
DSPatch
v.2.42
C++ Cross-Platform, Object-Oriented, Flow-Based Programming Library
|
Workspace for adding and routing components. More...
#include <DspCircuit.h>
Public Member Functions | |
DspCircuit (unsigned short threadCount=0) | |
virtual void | PauseAutoTick () |
void | SetThreadCount (unsigned short threadCount) |
unsigned short | GetThreadCount () const |
bool | AddComponent (DspComponent *component, std::string componentName="") |
bool | AddComponent (DspComponent &component, std::string componentName="") |
void | RemoveComponent (DspComponent *component) |
void | RemoveComponent (DspComponent &component) |
void | RemoveComponent (std::string componentName) |
void | RemoveAllComponents () |
template<class ComponentType > | |
ComponentType * | GetComponent (std::string componentName) |
unsigned short | GetComponentCount () const |
template<class FromComponentType , class FromOutputType , class ToComponentType , class ToInputType > | |
bool | ConnectOutToIn (FromComponentType &fromComponent, FromOutputType fromOutput, ToComponentType &toComponent, ToInputType toInput) |
template<class FromInputType , class ToComponentType , class ToInputType > | |
bool | ConnectInToIn (FromInputType fromInput, ToComponentType &toComponent, ToInputType toInput) |
template<class FromComponentType , class FromOutputType , class ToOutputType > | |
bool | ConnectOutToOut (FromComponentType &fromComponent, FromOutputType fromOutput, ToOutputType toOutput) |
template<class FromComponentType , class FromOutputType , class ToComponentType , class ToInputType > | |
void | DisconnectOutToIn (FromComponentType &fromComponent, FromOutputType fromOutput, ToComponentType &toComponent, ToInputType toInput) |
template<class FromInputType , class ToComponentType , class ToInputType > | |
bool | DisconnectInToIn (FromInputType fromInput, ToComponentType &toComponent, ToInputType toInput) |
template<class FromComponentType , class FromOutputType , class ToOutputType > | |
bool | DisconnectOutToOut (FromComponentType &fromComponent, FromOutputType fromOutput, ToOutputType toOutput) |
void | DisconnectComponent (std::string component) |
bool | AddInput (std::string inputName="") |
bool | AddOutput (std::string outputName="") |
void | ClearInputs () |
void | ClearOutputs () |
![]() | |
void | SetComponentName (std::string componentName) |
std::string | GetComponentName () const |
void | SetParentCircuit (DspCircuit *parentCircuit) |
DspCircuit * | GetParentCircuit () |
template<class FromOutputType , class ToInputType > | |
bool | ConnectInput (DspComponent *fromComponent, FromOutputType fromOutput, ToInputType toInput) |
template<class FromOutputType , class ToInputType > | |
bool | ConnectInput (DspComponent &fromComponent, FromOutputType fromOutput, ToInputType toInput) |
template<class FromOutputType , class ToInputType > | |
void | DisconnectInput (DspComponent *fromComponent, FromOutputType fromOutput, ToInputType toInput) |
template<class FromOutputType , class ToInputType > | |
void | DisconnectInput (DspComponent &fromComponent, FromOutputType fromOutput, ToInputType toInput) |
void | DisconnectInput (unsigned short inputIndex) |
void | DisconnectInput (std::string inputName) |
void | DisconnectInput (DspComponent *inputComponent) |
void | DisconnectInputs () |
unsigned short | GetInputCount () const |
unsigned short | GetOutputCount () const |
bool | FindInput (std::string signalName, unsigned short &returnIndex) const |
bool | FindInput (unsigned short signalIndex, unsigned short &returnIndex) const |
bool | FindOutput (std::string signalName, unsigned short &returnIndex) const |
bool | FindOutput (unsigned short signalIndex, unsigned short &returnIndex) const |
void | Tick () |
void | Reset () |
virtual void | StartAutoTick () |
virtual void | StopAutoTick () |
virtual void | ResumeAutoTick () |
void | SetBufferCount (unsigned short bufferCount) |
unsigned short | GetBufferCount () const |
void | ThreadTick (unsigned short threadNo) |
void | ThreadReset (unsigned short threadNo) |
bool | SetInputSignal (unsigned short inputIndex, const DspSignal *newSignal) |
bool | SetInputSignal (unsigned short inputIndex, unsigned short threadIndex, const DspSignal *newSignal) |
DspSignal * | GetOutputSignal (unsigned short outputIndex) |
DspSignal * | GetOutputSignal (unsigned short outputIndex, unsigned short threadIndex) |
Protected Member Functions | |
virtual void | Process_ (DspSignalBus &inputs, DspSignalBus &outputs) |
![]() | |
bool | AddInput_ (std::string inputName="") |
bool | AddOutput_ (std::string outputName="") |
void | ClearInputs_ () |
void | ClearOutputs_ () |
Workspace for adding and routing components.
DspComponents can be added to a DspCircuit and routed to and from other DspComponents. When a DspComponent is added to a DspCircuit, a unique string ID is optional. This name can be used to identify the component within the circuit's component collection. 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 another 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. DspCircuit 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.
DspCircuit is derived from DspComponent and therefore inherits all DspComponent behavior. This means that a DspCircuit can be added to, and routed within another DspCircuit as a component. This also means a circuit object needs to be Tick()ed and Reset()ed as a component (see DspComponent). The DspCircuit 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 DspCircuit.h.