NAP
Public Types | Public Member Functions | List of all members
ParentProcess Class Reference

#include <audio/core/process.h>

Public Types

enum  Mode { Sequential, Parallel }
 

Public Member Functions

 ParentProcess (NodeManager &nodeManager, ThreadPool &threadPool, AsyncObserver &observer)
 
 ParentProcess (ParentProcess &parent)
 
void addChild (Process &child)
 
void removeChild (Process &child)
 
void processParallel ()
 
void processSequential ()
 
void process () override
 
void setMode (Mode mode)
 
Mode getMode () const
 
- Public Member Functions inherited from Process
 Process (NodeManager &nodeManager)
 
 Process (ParentProcess &parent)
 
 Process (const Process &)=delete
 
Processoperator= (const Process &)=delete
 
virtual ~Process ()
 
void update ()
 
NodeManagergetNodeManager () const
 
int getBufferSize () const
 
float getSampleRate () const
 
DiscreteTimeValue getSampleTime () const
 

Additional Inherited Members

- Protected Member Functions inherited from Process
virtual void sampleRateChanged (float sampleRate)
 
virtual void bufferSizeChanged (int bufferSize)
 
bool isRegisteredWithNodeManager () const
 

Description

Parent process that triggers the processing of a number of child processes that it refers to. The ParentProcess can be either in sequential or parallel mode. In case it is set to parallel mode all child processes are started simultaneously on different threads. In sequential case all child processes are processed one after the other on the calling thread.

Inheritance diagram for ParentProcess:
[legend]
Collaboration diagram for ParentProcess:
[legend]

Member Enumeration Documentation

◆ Mode

enum Mode
strong
Enumerator
Sequential 
Parallel 

Constructor & Destructor Documentation

◆ ParentProcess() [1/2]

ParentProcess ( NodeManager nodeManager,
ThreadPool threadPool,
AsyncObserver observer 
)

Constructor

Parameters
nodeManagerthe node manager the process runs on
threadPoolthe threadpool used for parallelization when the ParentProcess is set to parallel mode.
observerAsyncObserver object used to help the child processes signal the caller when they are done in the case of parallel processing mode.

◆ ParentProcess() [2/2]

Constructor that takes the parent process of this process as argument in order to use its ThreadPool, AsyncObserver end NodeManager.

Member Function Documentation

◆ addChild()

void addChild ( Process child)

Add a reference to a child process whose processing will be triggered by this parent process.

◆ getMode()

Mode getMode ( ) const
Returns
wether the child processes will be processed in parallel or sequential mode.

◆ process()

void process ( )
overridevirtual

Process method chooses between parallel or sequential processing of the children according to mode specified by the setMode() method.

Implements Process.

◆ processParallel()

void processParallel ( )

Directly triggers parallel processing of all child processes. Child processes will be processed simultaneously on different threads in the ThreadPool.

◆ processSequential()

void processSequential ( )

Directly triggers sequential (or serial) processing of all child processes.

◆ removeChild()

void removeChild ( Process child)

Removes the reference of a child process so it will no longer be processed by this parent process.

◆ setMode()

void setMode ( Mode  mode)

Specifies wether the child processes will be processed in parallel or sequential mode. In case of parallel processing the child processes are triggered simultaneously on different threads in the ThreadPool. In case of sequential processing they are processed one by one on the caller thread.