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...
 
 OTask ()
 Default constructor. More...
 
virtual ~OTask ()
 Destructor : waits for the end of the task to destroy it. More...
 
bool isRunning () const
 
bool isCompleted () const
 
bool isCanceled () const
 
virtual void main ()=0
 
void reset ()
 
- 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() [1/2]

OTask::OTask ( )

Default constructor.

Definition at line 67 of file threading.cpp.

◆ ~OTask() [1/2]

OTask::~OTask ( )
virtual

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

Definition at line 69 of file threading.cpp.

Here is the call graph for this function:

◆ OTask() [2/2]

OTask::OTask ( )

Default constructor.

◆ ~OTask() [2/2]

virtual OTask::~OTask ( )
virtual

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

Member Function Documentation

◆ isCanceled() [1/2]

bool OTask::isCanceled ( ) const

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

Definition at line 89 of file threading.cpp.

Here is the caller graph for this function:

◆ isCanceled() [2/2]

bool OTask::isCanceled ( ) const

◆ isCompleted() [1/2]

bool OTask::isCompleted ( ) const

Return true if the task is completed, false otherwise.

Definition at line 83 of file threading.cpp.

Here is the caller graph for this function:

◆ isCompleted() [2/2]

bool OTask::isCompleted ( ) const

◆ isRunning() [1/2]

bool OTask::isRunning ( ) const

Return true if the task is running, false otherwise.

Definition at line 77 of file threading.cpp.

◆ isRunning() [2/2]

bool OTask::isRunning ( ) const

◆ main() [1/2]

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, and TYTask.

◆ main() [2/2]

virtual void OTask::main ( )
pure virtual

Implemented in TYTask, and TYTask.

◆ reset() [1/2]

void OTask::reset ( void  )

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

Definition at line 95 of file threading.cpp.

Here is the caller graph for this function:

◆ reset() [2/2]

void OTask::reset ( )

Friends And Related Function Documentation

◆ OSlaveThread

OSlaveThread
friend

Definition at line 217 of file threading.h.

◆ OThreadPool

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: