|
Oxygen Engine
Modern C++ 3D Engine using OpenGL
|
#include <OxygenEngine/util/pipeline.h>
Public Member Functions | |
| template<class... Args> | |
| Pipeline (Args &&... args) | |
| template<typename T , typename ... Args> | |
| Pipeline & | addPipe (const std::string &name, Args &&...args) |
| void | init () |
| void | clean () |
| Response | run (const Request &request) |
| Response | getDefaultResponse () |
| template<class... Types> | |
| void | generateDefaultResponse (Types... args) |
| template<typename T > | |
| T * | getPipeByName (const std::string &name) |
| void | enableStepByStepMode () |
| void | disableStepByStepMode () |
| bool | isStepByStepMode () |
| std::pair< Response, bool > | step (const Request &request) |
Protected Member Functions | |
| void | _rebuildPipeOrder () |
Protected Attributes | |
| std::vector< std::unique_ptr< PipeHandler > > | _pipes |
| Response | _default_response |
| std::map< std::string, PipeHandler * > | _pipes_by_name |
| std::optional< int32_t > | _last_step_pipe = std::nullopt |
Send a request through multiple handlers
Each pipe has a choice to handle the request and/or send it to sucessive stages
Can be used as a chain of responsibility or like HTTP middleware to process a request
Example usage:
This example will run the pipeline to convert gabuzomeu to result in following order : A->B->C->D->E
|
inline |
Create the pipeline and init the default response
| args | value constructor params |
|
inline |
Add a new handler in the pipeline
| name | Name of the pipe, used for getPipeByName |
| ... | Handler constructor |
|
inline |
Clean pipeline handlers
|
inline |
Change the pipeline's the default value
| args | value constructor params |
|
inline |
Init pipeline handlers
|
inline |
Send a Request through a pipeline to generate a Response