Helios++
Helios software for LiDAR simulations
PulseTaskDropper Class Reference

Class implementing a task dropper to deal with pulse tasks. More...

#include <PulseTaskDropper.h>

Inheritance diagram for PulseTaskDropper:
Collaboration diagram for PulseTaskDropper:

Public Member Functions

 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. More...
 
void drop (PulseThreadPoolInterface &pool) override
 Like TaskDropper::drop but dropping all pulse tasks through a pulse thread pool. More...
 
bool tryDrop (PulseThreadPoolInterface &pool) override
 Like TaskDropper::tryDrop but dropping all pulse tasks through a pulse thread pool in a non-blocking way. More...
 
- Public Member Functions inherited from BuddingTaskDropper< PulseTaskDropper, PulseTask, PulseThreadPoolInterface, std::vector< std::vector< double > > &, RandomnessGenerator< double > &, RandomnessGenerator< double > &, NoiseSource< double > & >
 BuddingTaskDropper (int const maxTasks=32, int const delta1=8, int const initDelta1=8, int const delta2=1, char const lastSign=0)
 Default constructor for the budding task dropper. More...
 
PulseTaskDropper emptyClone () const
 Do an empty clone of this budding task dropper. It is, an exact clone but with an empty tasks vector. More...
 
virtual PulseTaskDropper reproduce (char const sign)
 Do the budding reproduction of current task dropper. More...
 
virtual PulseTaskDropper evolve (long &lastIdle, long const idle, long const idleTh=100000, long const idleEps=100000)
 Create the bud of current budding task dropper according to the defined evolutive criteria. More...
 
virtual char getLastSign () const
 Obtain the last sign of the budding task dropper. More...
 
virtual int getDelta1 () const
 Obtain the \(\Delta_1\) of the budding task dropper. More...
 
virtual int getInitDelta1 () const
 Obtain the init value of \(Delta_1\) of the budding task dropper. More...
 
virtual int getDelta2 () const
 Obtain the \(\Delta_2\) of the budding task dropper. More...
 
- Public Member Functions inherited from TaskDropper< TaskType, ThreadPoolType, TaskArgs >
 TaskDropper (size_t const maxTasks=32)
 Default constructor for TaskDropper. More...
 
virtual bool add (shared_ptr< TaskType > task)
 Add a task to the TaskDropper. More...
 
virtual bool add (shared_ptr< TaskType > task, TaskArgs ... args)
 Like TaskDropper::add but for tasks with arguments. More...
 
virtual bool add (ThreadPoolType &pool, shared_ptr< TaskType > task)
 Like TaskDropper::add but running the drop method in parallel through a callback from given thread pool. More...
 
virtual char tryAdd (ThreadPoolType &pool, shared_ptr< TaskType > task)
 Like TaskDropper::add(ThreadPoolType &, shared_ptr<TaskType>) but supporting non-blocking calls. More...
 
virtual void drop ()
 Drop all tasks, one after another. More...
 
virtual void drop (TaskArgs ... args)
 Drop all tasks with arguments, one after another. More...
 
virtual void drop (ThreadPoolType &pool)
 A callback for TaskDropper::drop but using a thread pool to be executed in parallel. More...
 
virtual bool tryDrop (ThreadPoolType &pool)
 Like drop(ThreadPoolType &) but supporting non blocking calls. More...
 
TaskDropper emptyClone () const
 Do an empty clone of this task dropper. It is, an exact clone but with an empty tasks vector. More...
 
virtual void operator() ()
 Void functor operator calling drop method to be compatible with thread pools. More...
 
virtual void operator() (TaskArgs ... args)
 Functor operator with arguments calling drop method with arguments which can be used by thread pools. More...
 
virtual size_t getMaxTasks () const
 Get current maximum tasks limit. More...
 
virtual void setMaxTasks (size_t const maxTasks)
 Set new maximum tasks limit. More...
 
virtual shared_ptr< TaskType > popTask ()
 Pop a task from vector of tasks. More...
 

Additional Inherited Members

- Protected Member Functions inherited from TaskDropper< TaskType, ThreadPoolType, TaskArgs >
virtual void doTask (TaskType &task)
 Execute a task with no arguments. More...
 
virtual void doTask (TaskType &task, TaskArgs ... args)
 Execute a task with corresponding arguments. More...
 
- Protected Attributes inherited from BuddingTaskDropper< PulseTaskDropper, PulseTask, PulseThreadPoolInterface, std::vector< std::vector< double > > &, RandomnessGenerator< double > &, RandomnessGenerator< double > &, NoiseSource< double > & >
int delta1
 Magnitude of increase/decrease for max tasks. More...
 
int initDelta1
 The initial value of \(\Delta_1\).
 
int delta2
 Magnitude of increase/decrease for \(\Delta_1\). More...
 
char lastSign
 Must be \(0\) at initial instance but then it should be either \(1\) or \(-1\).
 
- Protected Attributes inherited from TaskDropper< TaskType, ThreadPoolType, TaskArgs >
std::vector< shared_ptr< TaskType > > tasks
 Tasks to be dropped as a whole. More...
 
size_t maxTasks
 Specify the maximum number of tasks before forcing a drop. More...
 

Detailed Description

Class implementing a task dropper to deal with pulse tasks.

Author
Alberto M. Esmoris Pena
Version
1.0
See also
TaskDropper
PulseThreadPool
PulseWarehouseThreadPool

Constructor & Destructor Documentation

◆ PulseTaskDropper()

PulseTaskDropper::PulseTaskDropper ( int const  maxTasks = 32,
int const  delta1 = 8,
int const  initDelta1 = 8,
int const  delta2 = 1,
char const  lastSign = 0 
)
inline

Default constructor for PulseTaskDropper.

Parameters
maxTasksValue to initialize maximum tasks limit
See also
TaskDropper
TaskDropper::maxTasks

Member Function Documentation

◆ drop()

void PulseTaskDropper::drop ( PulseThreadPoolInterface pool)
inlineoverride

Like TaskDropper::drop but dropping all pulse tasks through a pulse thread pool.

Parameters
poolPulse thread pool to be used for parallel execution
See also
TaskDropper::drop
PulseThreadPool
PulseWarehouseThreadPool
FullWaveformPulseRunnable

◆ tryDrop()

bool PulseTaskDropper::tryDrop ( PulseThreadPoolInterface pool)
inlineoverride

Like TaskDropper::tryDrop but dropping all pulse tasks through a pulse thread pool in a non-blocking way.

Parameters
poolPulse thread pool to be used for parallel execution
See also
TaskDropper::tryDrop

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