Helios++
Helios software for LiDAR simulations
PulseTaskDropper.h
1 #pragma once
2 
3 #include <util/threadpool/BuddingTaskDropper.h>
4 #include <PulseThreadPoolInterface.h>
5 #include <scanner/detector/PulseTask.h>
6 #include <scanner/detector/PulseThreadPool.h>
7 #include <noise/RandomnessGenerator.h>
8 #include <noise/NoiseSource.h>
9 
10 
20  PulseTaskDropper,
21  PulseTask,
22  PulseThreadPoolInterface,
23  std::vector<std::vector<double>>&,
24  RandomnessGenerator<double>&,
25  RandomnessGenerator<double>&,
26  NoiseSource<double>&
27 >{
28 public:
29  // *** CONSTRUCTION / DESTRUCTION *** //
30  // ************************************ //
38  int const maxTasks=32,
39  int const delta1=8,
40  int const initDelta1=8,
41  int const delta2=1,
42  char const lastSign=0
43  ) :
46  PulseTask,
48  std::vector<std::vector<double>>&,
49  RandomnessGenerator<double>&,
50  RandomnessGenerator<double>&,
51  NoiseSource<double>&
53  {}
54  virtual ~PulseTaskDropper() = default;
55 
56  // *** TASK DROPPER METHODS *** //
57  // ***************************** //
58  using TaskDropper<
59  PulseTask,
61  std::vector<std::vector<double>>&,
65  >::drop; // To avoid overriding hides drop overloads
66  using TaskDropper<
67  PulseTask,
69  std::vector<std::vector<double>>&,
73  >::tryDrop; // To avoid override hides tryDrop overloads
83  inline void drop(PulseThreadPoolInterface &pool) override
84  {pool.run_pulse_task(*this);}
91  inline bool tryDrop(PulseThreadPoolInterface &pool) override
92  {return pool.try_run_pulse_task(*this);}
93 };
The budding task dropper is a task dropper which implements the logic for its own reproduction so bud...
Definition: BuddingTaskDropper.h:78
Class to handle a noise source.
Definition: NoiseSource.h:17
Class implementing a task dropper to deal with pulse tasks.
Definition: PulseTaskDropper.h:27
PulseTaskDropper(int const maxTasks=32, int const delta1=8, int const initDelta1=8, int const delta2=1, char const lastSign=0)
Default constructor for PulseTaskDropper.
Definition: PulseTaskDropper.h:37
bool tryDrop(PulseThreadPoolInterface &pool) override
Like TaskDropper::tryDrop but dropping all pulse tasks through a pulse thread pool in a non-blocking ...
Definition: PulseTaskDropper.h:91
void drop(PulseThreadPoolInterface &pool) override
Like TaskDropper::drop but dropping all pulse tasks through a pulse thread pool.
Definition: PulseTaskDropper.h:83
Pulse task interface.
Definition: PulseTask.h:13
Interface for thread pools supporting pulse tasks.
Definition: PulseThreadPoolInterface.h:18
virtual void run_pulse_task(TaskDropper< PulseTask, PulseThreadPoolInterface, std::vector< std::vector< double >> &, RandomnessGenerator< double > &, RandomnessGenerator< double > &, NoiseSource< double > & > &dropper)=0
Compute a chunk of pulse tasks in parallel, blocking fashion.
virtual bool try_run_pulse_task(TaskDropper< PulseTask, PulseThreadPoolInterface, std::vector< std::vector< double >> &, RandomnessGenerator< double > &, RandomnessGenerator< double > &, NoiseSource< double > & > &dropper)=0
Compute a chunk of pulse tasks in parallel, non-blocking fashion.
Class to generate random numbers.
Definition: RandomnessGenerator.h:34
Class which handles tasks dropping. It is, executing and then removing each task when dropping.
Definition: TaskDropper.h:22
virtual void drop()
Drop all tasks, one after another.
Definition: TaskDropper.h:127
size_t maxTasks
Specify the maximum number of tasks before forcing a drop.
Definition: TaskDropper.h:39