SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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:
Collaboration graph

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 54 of file FXWorkerThread.h.

Constructor & Destructor Documentation

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

Desctructor.

Definition at line 57 of file FXWorkerThread.h.

Member Function Documentation

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

Referenced by FXWorkerThread::run().

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 75 of file FXWorkerThread.h.

References myIndex.

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

Field Documentation

int FXWorkerThread::Task::myIndex
private

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

Definition at line 80 of file FXWorkerThread.h.

Referenced by setIndex().


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