DSPatch v.11.4.3
Loading...
Searching...
No Matches
DSPatch::Component Class Referenceabstract

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
 
Componentoperator= (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 ()
 
void Tick (int bufferNo)
 
void TickParallel ()
 
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={})
 

Detailed Description

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.

Member Typedef Documentation

◆ SPtr

using DSPatch::Component::SPtr = std::shared_ptr<Component>

Definition at line 70 of file Component.h.

Member Enumeration Documentation

◆ ProcessOrder

enum class DSPatch::Component::ProcessOrder
strong

Definition at line 72 of file Component.h.

Constructor & Destructor Documentation

◆ Component()

DSPatch::Component::Component ( ProcessOrder processOrder = ProcessOrder::InOrder)
inline

Definition at line 190 of file Component.h.

Member Function Documentation

◆ ConnectInput()

bool DSPatch::Component::ConnectInput ( const Component::SPtr & fromComponent,
int fromOutput,
int toInput )
inline

Definition at line 198 of file Component.h.

◆ DisconnectAllInputs()

void DSPatch::Component::DisconnectAllInputs ( )
inline

Definition at line 284 of file Component.h.

◆ DisconnectInput() [1/2]

void DSPatch::Component::DisconnectInput ( const Component::SPtr & fromComponent)
inline

Definition at line 262 of file Component.h.

◆ DisconnectInput() [2/2]

void DSPatch::Component::DisconnectInput ( int inputNo)
inline

Definition at line 241 of file Component.h.

◆ EndScan()

void DSPatch::Component::EndScan ( )
inline

Definition at line 544 of file Component.h.

◆ GetBufferCount()

int DSPatch::Component::GetBufferCount ( ) const
inline

Definition at line 384 of file Component.h.

◆ GetInputCount()

int DSPatch::Component::GetInputCount ( ) const
inline

Definition at line 302 of file Component.h.

◆ GetInputName()

std::string DSPatch::Component::GetInputName ( int inputNo) const
inline

Definition at line 313 of file Component.h.

◆ GetOutputCount()

int DSPatch::Component::GetOutputCount ( ) const
inline

Definition at line 307 of file Component.h.

◆ GetOutputName()

std::string DSPatch::Component::GetOutputName ( int outputNo) const
inline

Definition at line 323 of file Component.h.

◆ Scan()

void DSPatch::Component::Scan ( std::vector< Component * > & components)
inline

Definition at line 493 of file Component.h.

◆ ScanParallel()

void DSPatch::Component::ScanParallel ( std::vector< std::vector< DSPatch::Component * > > & componentsMap,
int & scanPosition )
inline

Definition at line 513 of file Component.h.

◆ SetBufferCount()

void DSPatch::Component::SetBufferCount ( int bufferCount,
int startBuffer )
inline

Definition at line 332 of file Component.h.

◆ SetInputCount_()

void DSPatch::Component::SetInputCount_ ( int inputCount,
const std::vector< std::string > & inputNames = {} )
inlineprotected

Definition at line 550 of file Component.h.

◆ SetOutputCount_()

void DSPatch::Component::SetOutputCount_ ( int outputCount,
const std::vector< std::string > & outputNames = {} )
inlineprotected

Definition at line 562 of file Component.h.

◆ Tick() [1/2]

void DSPatch::Component::Tick ( )
inline

Definition at line 389 of file Component.h.

◆ Tick() [2/2]

void DSPatch::Component::Tick ( int bufferNo)
inline

Definition at line 403 of file Component.h.

◆ TickParallel() [1/2]

void DSPatch::Component::TickParallel ( )
inline

Definition at line 431 of file Component.h.

◆ TickParallel() [2/2]

void DSPatch::Component::TickParallel ( int bufferNo)
inline

Definition at line 455 of file Component.h.


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