Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Public Member Functions | Protected Attributes | Friends | List of all members
OTask Class Referenceabstract

Task of a threads collection. More...

#include <threading.h>

Inheritance diagram for OTask:
Inheritance graph
[legend]
Collaboration diagram for OTask:
Collaboration graph
[legend]

Public Member Functions

 OTask ()
 Default constructor. More...
 
virtual ~OTask ()
 Destructor : waits for the end of the task to destroy it. More...
 
bool isRunning () const
 Return true if the task is running, false otherwise. More...
 
bool isCompleted () const
 Return true if the task is completed, false otherwise. More...
 
bool isCanceled () const
 Return true if the task has been cancelled, false otherwise. More...
 
virtual void main ()=0
 Main routine of the task. This pure virtual method should be overloaded into an inherited class to describe the task to do. More...
 
void reset ()
 Reset the task status (_running=false and _completed=false) More...
 
- Public Member Functions inherited from IRefCount
 IRefCount ()
 
virtual ~IRefCount ()
 
virtual int incRef ()
 
virtual int decRef ()
 
int getRefCount () const
 

Protected Attributes

bool _running
 Running flag. More...
 
bool _completed
 Completed flag. More...
 
bool _canceled
 Cancel flag. More...
 
- Protected Attributes inherited from IRefCount
int m_refCount
 The reference counter. More...
 

Friends

class OSlaveThread
 
class OThreadPool
 

Detailed Description

Task of a threads collection.

This abstract class encapsulates a primitive task which can be run in a threads collections. It is necessary to overload it by the implementation of a pure virtual methode OTask::main which defines the task to run. A task is pushed into the threads collection with the OThreadPool::push method, which starts as soon as a thread is available. A task can't be cancelled after its run.

Author
Projet_Tympan

Definition at line 167 of file threading.h.

Constructor & Destructor Documentation

◆ OTask()

OTask::OTask ( )

Default constructor.

Definition at line 65 of file threading.cpp.

◆ ~OTask()

OTask::~OTask ( )
virtual

Destructor : waits for the end of the task to destroy it.

Definition at line 67 of file threading.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ isCanceled()

bool OTask::isCanceled ( ) const

Return true if the task has been cancelled, false otherwise.

Definition at line 87 of file threading.cpp.

Here is the caller graph for this function:

◆ isCompleted()

bool OTask::isCompleted ( ) const

Return true if the task is completed, false otherwise.

Definition at line 81 of file threading.cpp.

Here is the caller graph for this function:

◆ isRunning()

bool OTask::isRunning ( ) const

Return true if the task is running, false otherwise.

Definition at line 75 of file threading.cpp.

◆ main()

void OTask::main ( )
pure virtual

Main routine of the task. This pure virtual method should be overloaded into an inherited class to describe the task to do.

Implemented in TYTask.

◆ reset()

void OTask::reset ( void  )

Reset the task status (_running=false and _completed=false)

Definition at line 93 of file threading.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ OSlaveThread

friend class OSlaveThread
friend

Definition at line 217 of file threading.h.

◆ OThreadPool

friend class OThreadPool
friend

Definition at line 218 of file threading.h.

Member Data Documentation

◆ _canceled

bool OTask::_canceled
protected

Cancel flag.

Definition at line 215 of file threading.h.

◆ _completed

bool OTask::_completed
protected

Completed flag.

Definition at line 212 of file threading.h.

◆ _running

bool OTask::_running
protected

Running flag.

Definition at line 209 of file threading.h.


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