Helios++
Helios software for LiDAR simulations
SharedSubTask Class Referenceabstract

A shared task is said to be a collection of shared sub-tasks. Each shared sub-task can be computed in parallel with respect to its siblings. More...

#include <SharedSubTask.h>

Inheritance diagram for SharedSubTask:
Collaboration diagram for SharedSubTask:

Public Member Functions

 SharedSubTask (std::shared_ptr< SharedSubTaskCompletionHandler > ch)
 Default constructor for shared sub-task. More...
 
virtual void operator() ()
 The functor that will be called by any thread. It calls the SharedSubTask::run method to solve/compute the sub-task. Also, once the task has been computed, it delegates upon the task completion handler. More...
 
virtual void run ()=0
 Abstract run function that must be implemented by any derived class which pretends to provide a concrete implementation of a SharedSubTask.
 
virtual void postProcess ()
 Post-processing to be applied after shared sub-task has finished. By default it is a void function which does nothing, but it can be overridden.
 
virtual size_t getKey ()
 Obtain the key of the shared sub-task inside the shared task sequencer context. More...
 
virtual void setKey (size_t const key)
 Set the key of the shared sub-task inside the shared task sequencer context. More...
 
virtual std::shared_ptr< boost::thread > getThread ()
 Get the thread associated to the shared sub-task. More...
 
virtual void setThread (std::shared_ptr< boost::thread > thread)
 Set the thread associated to the shared sub-task. More...
 

Protected Attributes

std::shared_ptr< SharedSubTaskCompletionHandlerch
 The shared sub-task completion handler that handles what must be done after a shared sub-task execution has been finished. The most paradigmatic case of a valid task completion handler is the shared task sequencer. More...
 
size_t key = 0
 The key identifying the shared sub task inside the shared task sequencer context. More...
 
std::shared_ptr< boost::thread > thread = nullptr
 The thread associated with the shared sub-tasks. It is nullptr until the shared sub-task has been started by its corresponding shared task sequencer.
 

Detailed Description

A shared task is said to be a collection of shared sub-tasks. Each shared sub-task can be computed in parallel with respect to its siblings.

Author
Alberto M. Esmoris Pena
Version
1.0
See also
SharedTaskSequencer

Constructor & Destructor Documentation

◆ SharedSubTask()

SharedSubTask::SharedSubTask ( std::shared_ptr< SharedSubTaskCompletionHandler ch)
inline

Default constructor for shared sub-task.

See also
SharedSubTask::tch

Member Function Documentation

◆ getKey()

virtual size_t SharedSubTask::getKey ( )
inlinevirtual

Obtain the key of the shared sub-task inside the shared task sequencer context.

Returns
Key of the shared sub-task inside the shared task sequencer context
See also
SharedSubTask::key

◆ getThread()

virtual std::shared_ptr<boost::thread> SharedSubTask::getThread ( )
inlinevirtual

Get the thread associated to the shared sub-task.

Returns
Thread associated to the shared sub-task
See also
SharedSubTask::thread

◆ operator()()

virtual void SharedSubTask::operator() ( )
inlinevirtual

The functor that will be called by any thread. It calls the SharedSubTask::run method to solve/compute the sub-task. Also, once the task has been computed, it delegates upon the task completion handler.

See also
SharedSubTask::ch

◆ setKey()

virtual void SharedSubTask::setKey ( size_t const  key)
inlinevirtual

Set the key of the shared sub-task inside the shared task sequencer context.

Parameters
keyKey of the shared sub-task inside the shared task sequencer context
See also
SharedSubTask::key

◆ setThread()

virtual void SharedSubTask::setThread ( std::shared_ptr< boost::thread >  thread)
inlinevirtual

Set the thread associated to the shared sub-task.

Parameters
threadThread associated to the shared sub-task
See also
SharedSubTask::thread

Member Data Documentation

◆ ch

std::shared_ptr<SharedSubTaskCompletionHandler> SharedSubTask::ch
protected

The shared sub-task completion handler that handles what must be done after a shared sub-task execution has been finished. The most paradigmatic case of a valid task completion handler is the shared task sequencer.

See also
SharedTaskSequencer
SharedSubTaskCompletionHandler

◆ key

size_t SharedSubTask::key = 0
protected

The key identifying the shared sub task inside the shared task sequencer context.

See also
SharedTaskSequencer
SharedTaskSequencer::subTasks

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