![]() |
DSPatch v.11.3.1
|
Abstract base class for DSPatch components. More...
#include <Component.h>
Public Types | |
enum class | ProcessOrder { InOrder , OutOfOrder } |
using | SPtr = std::shared_ptr<Component> |
Public Member Functions | |
Component (const Component &)=delete | |
Component & | operator= (const Component &)=delete |
Component (ProcessOrder processOrder=ProcessOrder::InOrder) | |
bool | ConnectInput (const Component::SPtr &fromComponent, int fromOutput, int toInput) |
void | DisconnectInput (int inputNo) |
void | DisconnectInput (const Component::SPtr &fromComponent) |
void | DisconnectAllInputs () |
int | GetInputCount () const |
int | GetOutputCount () const |
std::string | GetInputName (int inputNo) const |
std::string | GetOutputName (int outputNo) const |
void | SetBufferCount (int bufferCount, int startBuffer) |
int | GetBufferCount () const |
void | Tick (int bufferNo) |
void | TickParallel (int bufferNo) |
void | Scan (std::vector< Component * > &components) |
void | ScanParallel (std::vector< std::vector< DSPatch::Component * > > &componentsMap, int &scanPosition) |
void | EndScan () |
Protected Member Functions | |
virtual void | Process_ (SignalBus &, SignalBus &)=0 |
void | SetInputCount_ (int inputCount, const std::vector< std::string > &inputNames={}) |
void | SetOutputCount_ (int outputCount, const std::vector< std::string > &outputNames={}) |
Abstract base class for DSPatch components.
Classes derived from Component can be added to a Circuit and routed to and from other Components.
On construction, derived classes must configure the component's IO buses by calling SetInputCount_() and SetOutputCount_() respectively.
Derived classes must also implement the virtual method: Process_(). The Process_() method is a callback from the DSPatch engine that occurs when a new set of input signals is ready for processing. The Process_() method has 2 arguments: the input bus, and the output bus. This method's purpose is to pull its required inputs out of the input bus, process these inputs, and populate the output bus with the results (see SignalBus).
In order for a component to do any work it must be ticked. This is performed by repeatedly calling the Tick() method. This method is responsible for acquiring the next set of input signals from its input wires and populating the component's input bus. The acquired input bus is then passed to the Process_() method.
PERFORMANCE TIP: If a component is capable of processing its buffers out-of-order within a stream processing circuit, consider initialising its base with ProcessOrder::OutOfOrder to improve performance. Note however that Process_() must be thread-safe to operate in this mode.
Definition at line 64 of file Component.h.
using DSPatch::Component::SPtr = std::shared_ptr<Component> |
Definition at line 70 of file Component.h.
|
strong |
Definition at line 72 of file Component.h.
|
inline |
Definition at line 186 of file Component.h.
|
inline |
Definition at line 194 of file Component.h.
|
inline |
Definition at line 260 of file Component.h.
|
inline |
Definition at line 245 of file Component.h.
|
inline |
Definition at line 231 of file Component.h.
|
inline |
Definition at line 488 of file Component.h.
|
inline |
Definition at line 354 of file Component.h.
|
inline |
Definition at line 272 of file Component.h.
|
inline |
Definition at line 283 of file Component.h.
|
inline |
Definition at line 277 of file Component.h.
|
inline |
Definition at line 293 of file Component.h.
|
inline |
Definition at line 437 of file Component.h.
|
inline |
Definition at line 457 of file Component.h.
|
inline |
Definition at line 302 of file Component.h.
|
inlineprotected |
Definition at line 494 of file Component.h.
|
inlineprotected |
Definition at line 506 of file Component.h.
|
inline |
Definition at line 359 of file Component.h.
|
inline |
Definition at line 394 of file Component.h.