Eclipse SUMO - Simulation of Urban MObility
FXWorkerThread::Task Class Referenceabstract

Abstract superclass of a task to be run with an index to keep track of pending tasks. More...

#include <FXWorkerThread.h>

Collaboration diagram for FXWorkerThread::Task:

Public Member Functions

virtual void run (FXWorkerThread *context)=0
 Abstract method which in subclasses should contain the computations to be performed. More...
 
void setIndex (const int newIndex)
 Sets the running index of this task. More...
 
virtual ~Task ()
 Desctructor. More...
 

Private Attributes

int myIndex
 the index of the task, valid only after the task has been added to the pool More...
 

Detailed Description

Abstract superclass of a task to be run with an index to keep track of pending tasks.

Definition at line 55 of file FXWorkerThread.h.

Constructor & Destructor Documentation

◆ ~Task()

virtual FXWorkerThread::Task::~Task ( )
inlinevirtual

Desctructor.

Definition at line 58 of file FXWorkerThread.h.

Member Function Documentation

◆ run()

virtual void FXWorkerThread::Task::run ( FXWorkerThread context)
pure virtual

Abstract method which in subclasses should contain the computations to be performed.

If there is data to be shared among several tasks (but not among several threads) it can be put in the a thread class subclassing the FXWorkerThread. the instance of the thread is then made available via the context parameter.

Parameters
[in]contextThe thread which runs the task

◆ setIndex()

void FXWorkerThread::Task::setIndex ( const int  newIndex)
inline

Sets the running index of this task.

Every task receive an index which is unique among all pending tasks of the same thread pool.

Parameters
[in]newIndexthe index to assign

Definition at line 76 of file FXWorkerThread.h.

References myIndex.

Referenced by FXWorkerThread::Pool::add().

Field Documentation

◆ myIndex

int FXWorkerThread::Task::myIndex
private

the index of the task, valid only after the task has been added to the pool

Definition at line 81 of file FXWorkerThread.h.

Referenced by setIndex().


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