My Project
Loading...
Searching...
No Matches
Public Member Functions | List of all members
found::Pipeline< Input, Output > Class Template Reference

#include <pipeline.hpp>

Inheritance diagram for found::Pipeline< Input, Output >:
Inheritance graph
[legend]
Collaboration diagram for found::Pipeline< Input, Output >:
Collaboration graph
[legend]

Public Member Functions

 Pipeline (std::vector< std::reference_wrapper< Action > > &stages)
 
template<typename I , typename O >
PipelineAddStage (Stage< I, O > &stage)
 
template<typename I >
PipelineComplete (Stage< I, Output > &stage)
 
Output Run (const Input &input) override
 
- Public Member Functions inherited from found::Stage< Input, Output >
 Stage ()=default
 
virtual ~Stage ()=default
 
void DoAction () override
 
Input & GetResource ()
 
Output *& GetProduct ()
 

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()

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

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 >.


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