|
Pottu
|
Pipeline capsules the pottu-stage pipeline loop and allows running it multithreaded. More...
#include <Pipeline.hpp>

Classes | |
| struct | BuiltPipeline |
Public Member Functions | |
| void | setSource (DataSource *stage) noexcept |
| Sets the data source. More... | |
| void | setTimeStamper (StageRawToStampedRaw *stage) noexcept |
| Sets the time stamper. More... | |
| void | setDetectorEventGenerator (StageStampedRawToDetectorEvent *stage) noexcept |
| Sets the detector event generator. More... | |
| void | add (StageDetectorEvent *stage) noexcept |
| Adds a normal processing stage. More... | |
| void | add (StageDetectorEventToDetectorEvent *stage) noexcept |
| Adds a normal processing stage which has an internal detector event buffer. More... | |
| void | add (StageDetectorEventFinal *stage) noexcept |
| Adds a processing stage which consumes the data. More... | |
| void | run (std::size_t num_threads=1) |
| Runs the defined pipeline until the data source has no more data. More... | |
| void | _buildSingleThreadedPipeline () |
| void | _buildMultiThreadedPipeline (std::size_t num_lines) |
| void | _runSingleThreaded () |
Public Attributes | |
| DataSource * | _source {nullptr} |
| StageRawToStampedRaw * | _stamper {nullptr} |
| StageStampedRawToDetectorEvent * | _deteventgen {nullptr} |
| std::vector< std::variant< StageDetectorEvent *, StageDetectorEventToDetectorEvent *, StageDetectorEventFinal * > > | _stagesRest |
| std::unique_ptr< BuiltPipeline > | _builtPipeline |
Pipeline capsules the pottu-stage pipeline loop and allows running it multithreaded.
This pipeline object is a quite simple. It is intended to be used in a typical sort which includes pipeline like:
The order of processing StageDetectorEvent objects and StageDetectorEventToDetectorEvent objects is the same as that those were added into the pipeline. The very first stages are fixed and can be set in any moment when the pipeline is not running.
Missing of any of the first three stages will throw an exception if tried to run.
To run a pipeline multithreaded, define the preprocessor name POTTU_ENABLE_MULTITHREADING=1. One can do this for example by adding target_compile_definitions( yoursort PRIVATE POTTU_ENABLE_MULTITHREADING=1 [OTHER DEFINES...] ) in the CMakeLists.txt file.
|
inlinenoexcept |
Adds a normal processing stage.
Currently there is no interface to modify the array of added stages except adding more of stages. If really required then modify _stagesRest vector directly and reset the unique_ptr _builtPipeline.
|
inlinenoexcept |
Adds a processing stage which consumes the data.
If multiple final stages are added then the data vector is copied for these.
|
inlinenoexcept |
Adds a normal processing stage which has an internal detector event buffer.
Currently there is no interface to modify the array of added stages except adding more of stages. If really required then modify _stagesRest vector directly and reset the unique_ptr _builtPipeline.
|
inline |
Runs the defined pipeline until the data source has no more data.
| num_threads | Number of threads to use to run the pipeline. Special value zero tries to detect the maximum number of concurrent threads in the system. If fails in that then uses 4 threads. |
The actual pipeline and the required buffers to carry the data between stages are created when this function is called first time or if new stages have been added or if this method is called with different thread number.
If more data has been added (for example new data files) then run() can be called again.
|
inlinenoexcept |
Sets the detector event generator.
| stage | Typically pointer to a DetectorEventGenerator object. |
This overwrites the earlier set stage.
|
inlinenoexcept |
Sets the data source.
| stage | Typically pointer to a FileReader object. |
This overwrites the earlier stage.
|
inlinenoexcept |
Sets the time stamper.
| stage | Typically pointer to a TimeStamper object. |
This overwrites the earlier set stage.