FOUND
Loading...
Searching...
No Matches
found::Pipeline< Input, Output > Class Template Reference

Pipeline is composite Stage (i.e. More...

#include <pipeline.hpp>

Inheritance diagram for found::Pipeline< Input, Output >:
Collaboration diagram for found::Pipeline< Input, Output >:

Public Member Functions

 Pipeline (std::vector< std::reference_wrapper< Action > > &stages)
 Constructs a Pipeline.
 
 Pipeline ()
 Constructs an empty Pipeline.
 
template<typename I , typename O >
PipelineAddStage (Stage< I, O > &stage)
 Adds a stage to this pipeline.
 
template<typename I >
PipelineComplete (Stage< I, Output > &stage)
 Adds a stage to the pipeline and marks it as the last stage, preventing further manipulation of the Pipeline.
 
Output Run (const Input &input) override
 Executes this Pipeline.
 
- Public Member Functions inherited from found::Stage< Input, Output >
 Stage ()=default
 Constructs a new Stage.
 
virtual ~Stage ()=default
 Destroys this.
 
void DoAction () override
 Executes Run (with a stored input and storing the output)
 
Input & GetResource ()
 Returns the stored input of this.
 
Output *& GetProduct ()
 Returns the stored output of this.
 

Private Attributes

std::vector< std::reference_wrapper< Action > > stages
 The stages of this.
 
Input * firstResource
 The pointer to the variable that will store the first input.
 
Output finalProduct
 The final product (output)
 
void ** lastProduct = nullptr
 A temporary variable that always points to the last Stage's product field.
 
bool ready
 An indicator for if this Pipeline is ready.
 

Additional Inherited Members

- Protected Attributes inherited from found::Stage< Input, Output >
Input resource
 The stored input for this.
 
Output * product
 The pointer to the stored output for this.
 

Detailed Description

template<typename Input, typename Output>
class found::Pipeline< Input, Output >

Pipeline is composite Stage (i.e.

A Stage that is made up of many stages). You can add 1 to many stages into a Pipeline so long as the Input to the first stage is the same Input to the Pipeline, and the Output to the last stage is the Output of the Pipeline.

A Pipeline runs by feeding the input to the first stage, taking its output and feeding it to the next stage, and so on until the last stage outputs the output.

Parameters
InputThe Pipeline's Input
OutputThe Pipeline's Output

Constructor & Destructor Documentation

◆ Pipeline() [1/2]

template<typename Input , typename Output >
found::Pipeline< Input, Output >::Pipeline ( std::vector< std::reference_wrapper< Action > > &  stages)
inlineexplicit

Constructs a Pipeline.

Parameters
stagesThe vector of stages to provide this object

◆ Pipeline() [2/2]

template<typename Input , typename Output >
found::Pipeline< Input, Output >::Pipeline ( )
inline

Constructs an empty Pipeline.

Member Function Documentation

◆ AddStage()

template<typename Input , typename Output >
template<typename I , typename O >
Pipeline & found::Pipeline< Input, Output >::AddStage ( Stage< I, O > &  stage)
inline

Adds a stage to this pipeline.

Parameters
stageThe stage to add to the pipeline
Returns
this, with the new stage added (for chaining)
Exceptions
invalid_argumentiff this is the first time this method is called, and I does not match Input OR if the Pipeline is already complete (aka this::Complete was called successfully)
Precondition
Iff this method has already been called, O from the last parameter must match I of the next parameter

◆ Complete()

template<typename Input , typename Output >
template<typename I >
Pipeline & found::Pipeline< Input, Output >::Complete ( Stage< I, Output > &  stage)
inline

Adds a stage to the pipeline and marks it as the last stage, preventing further manipulation of the Pipeline.

Parameters
stageThe stage to add
Returns
this, with the last stage added (to run this::Run)
Exceptions
invalid_argumentiff this is the first time this method is called, and I does not match Input OR if the Pipeline is already complete (aka this::Complete was called successfully)

◆ Run()

template<typename Input , typename Output >
Output found::Pipeline< Input, Output >::Run ( const Input &  input)
inlineoverridevirtual

Executes this Pipeline.

Parameters
inputThe input to this Pipeline
Returns
The output of the Pipeline
Note
A Pipeline runs by feeding the input to the first stage, taking its output and feeding it to the next stage, and so on until the last stage outputs the output.
Precondition
The pipeline must have been completed successfully, i.e. before this::Run is called, this::Complete must have been called successfully

Implements found::Stage< Input, Output >.

Member Data Documentation

◆ finalProduct

template<typename Input , typename Output >
Output found::Pipeline< Input, Output >::finalProduct
private

The final product (output)

◆ firstResource

template<typename Input , typename Output >
Input* found::Pipeline< Input, Output >::firstResource
private

The pointer to the variable that will store the first input.

◆ lastProduct

template<typename Input , typename Output >
void** found::Pipeline< Input, Output >::lastProduct = nullptr
private

A temporary variable that always points to the last Stage's product field.

◆ ready

template<typename Input , typename Output >
bool found::Pipeline< Input, Output >::ready
private

An indicator for if this Pipeline is ready.

◆ stages

template<typename Input , typename Output >
std::vector<std::reference_wrapper<Action> > found::Pipeline< Input, Output >::stages
private

The stages of this.


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