DSPatch  v.3.00
C++ Cross-Platform, Object-Oriented, Flow-Based Programming Library
Public Member Functions | Protected Member Functions | List of all members
DspCircuit Class Reference

Workspace for adding and routing components. More...

#include <DspCircuit.h>

Inheritance diagram for DspCircuit:
DspComponent

Public Member Functions

 DspCircuit (int threadCount=0)
 
void SetThreadCount (int threadCount)
 
int GetThreadCount () const
 
bool AddComponent (DspComponent *component, std::string const &componentName="")
 
bool AddComponent (DspComponent &component, std::string const &componentName="")
 
void RemoveComponent (DspComponent const *component)
 
void RemoveComponent (DspComponent const &component)
 
void RemoveComponent (std::string const &componentName)
 
void RemoveAllComponents ()
 
template<class ComponentType >
ComponentType * GetComponent (std::string const &componentName)
 
int GetComponentCount () const
 
template<class FromComponentType , class FromOutputId , class ToComponentType , class ToInputId >
bool ConnectOutToIn (FromComponentType &fromComponent, FromOutputId const &fromOutput, ToComponentType &toComponent, ToInputId const &toInput)
 
template<class FromInputId , class ToComponentType , class ToInputId >
bool ConnectInToIn (FromInputId const &fromInput, ToComponentType &toComponent, ToInputId const &toInput)
 
template<class FromComponentType , class FromOutputId , class ToOutputId >
bool ConnectOutToOut (FromComponentType &fromComponent, FromOutputId const &fromOutput, ToOutputId const &toOutput)
 
template<class FromComponentType , class FromOutputId , class ToComponentType , class ToInputId >
void DisconnectOutToIn (FromComponentType const &fromComponent, FromOutputId const &fromOutput, ToComponentType const &toComponent, ToInputId const &toInput)
 
template<class FromInputId , class ToComponentType , class ToInputId >
bool DisconnectInToIn (FromInputId const &fromInput, ToComponentType const &toComponent, ToInputId const &toInput)
 
template<class FromComponentType , class FromOutputId , class ToOutputId >
bool DisconnectOutToOut (FromComponentType const &fromComponent, FromOutputId const &fromOutput, ToOutputId const &toOutput)
 
void DisconnectComponent (std::string const &component)
 
bool AddInput (std::string const &inputName="")
 
bool AddOutput (std::string const &outputName="")
 
void RemoveInput ()
 
void RemoveOutput ()
 
void RemoveAllInputs ()
 
void RemoveAllOutputs ()
 
- Public Member Functions inherited from DspComponent
void SetCallback (Callback_t const &callback, void *userData=NULL)
 
void SetComponentName (std::string const &componentName)
 
std::string GetComponentName () const
 
template<class FromOutputId , class ToInputId >
bool ConnectInput (DspComponent *fromComponent, FromOutputId const &fromOutput, ToInputId const &toInput)
 
template<class FromOutputId , class ToInputId >
bool ConnectInput (DspComponent &fromComponent, FromOutputId const &fromOutput, ToInputId const &toInput)
 
template<class FromOutputId , class ToInputId >
void DisconnectInput (DspComponent const *fromComponent, FromOutputId const &fromOutput, ToInputId const &toInput)
 
template<class FromOutputId , class ToInputId >
void DisconnectInput (DspComponent const &fromComponent, FromOutputId const &fromOutput, ToInputId const &toInput)
 
void DisconnectInput (int inputIndex)
 
void DisconnectInput (std::string const &inputName)
 
void DisconnectInput (DspComponent const *inputComponent)
 
void DisconnectAllInputs ()
 
int GetInputCount ()
 
int GetOutputCount ()
 
int GetParameterCount ()
 
std::string GetInputName (int index)
 
std::string GetOutputName (int index)
 
std::string GetParameterName (int index)
 
bool GetParameter (int index, DspParameter &param)
 
DspParameter const * GetParameter (int index)
 
bool SetParameter (int index, DspParameter const &param)
 
void Tick ()
 
void Reset ()
 
void StartAutoTick ()
 
void StopAutoTick ()
 
void PauseAutoTick ()
 
void ResumeAutoTick ()
 

Protected Member Functions

virtual void Process_ (DspSignalBus &inputs, DspSignalBus &outputs)
 
- Protected Member Functions inherited from DspComponent
virtual bool ParameterUpdating_ (int, DspParameter const &)
 
bool AddInput_ (std::string const &inputName="")
 
bool AddOutput_ (std::string const &outputName="")
 
int AddParameter_ (std::string const &paramName, DspParameter const &param)
 
bool RemoveInput_ ()
 
bool RemoveOutput_ ()
 
bool RemoveParameter_ ()
 
void RemoveAllInputs_ ()
 
void RemoveAllOutputs_ ()
 
void RemoveAllParameters_ ()
 
int GetInputCount_ ()
 
int GetOutputCount_ ()
 
int GetParameterCount_ ()
 
DspParameter const * GetParameter_ (int index) const
 
bool SetParameter_ (int index, DspParameter const &param)
 

Additional Inherited Members

- Public Types inherited from DspComponent
enum  CallbackType {
  InputAdded, InputRemoved, OutputAdded, OutputRemoved,
  ParameterAdded, ParameterRemoved, ParameterUpdated
}
 
typedef void(* Callback_t) (DspComponent *component, CallbackType const &callbackType, int index, void *userData)
 

Detailed Description

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.


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