fw4spl
fwGuiQt::WorkerQt Class Reference

Private implementation of fwThread::Worker using boost::asio. More...

+ Inheritance diagram for fwGuiQt::WorkerQt:
+ Collaboration diagram for fwGuiQt::WorkerQt:

Public Member Functions

void init (int &argc, char **argv, bool guiEnabled=true)
 
void stop ()
 Waits for the last task to be processed and stops the loop.
 
void post (TaskType handler)
 Requests invocation of the given task handler and returns immediately.
 
::fwThread::Worker::FutureType getFuture ()
 Returns a std::shared_future associated with the execution of Worker's loop. More...
 
virtual ::fwThread::ThreadIdType getThreadId () const
 Returns the worker's thread id.
 
virtual void processTasks ()
 Processes all worker pending tasks for the calling thread until there are no more tasks to process. You can call this function occasionally when your program is busy performing a long operation. More...
 
virtual void processTasks (PeriodType maxtime)
 Processes worker pending tasks for the calling thread for maxtime milliseconds or until there are no more tasks to process. You can call this function occasionally when your program is busy performing a long operation. More...
 
- Public Member Functions inherited from fwThread::Worker
virtual bool isA (const std::string &type) const override
 
template<typename R , typename CALLABLE >
std::shared_future< R > postTask (CALLABLE f)
 Requests invocation of the given callable and returns a shared future. More...
 
template<typename R , typename TASK >
std::shared_future< R > postTask (TASK f)
 
virtual const std::string & getLeafClassname () const override
 return object's classname without its namespace, i.e. BaseObject
 
virtual const std::string & getClassname () const override
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
- Public Member Functions inherited from fwCore::BaseObject

Protected Member Functions

std::shared_ptr< ::fwThread::TimercreateTimer ()
 Creates and returns a fwThread::Timer running in this Worker.
 
 WorkerQt (const WorkerQt &)
 Copy constructor forbidden.
 
WorkerQtoperator= (const WorkerQt &)
 Copy operator forbidden.
 
- Protected Member Functions inherited from fwThread::Worker
 Worker (const Worker &)
 Copy constructor forbidden.
 
Workeroperator= (const Worker &)
 Copy operator forbidden.
 

Protected Attributes

int m_argc
 
QSharedPointer< QApplication > m_app
 
::fwThread::ThreadIdType m_threadId
 
- Protected Attributes inherited from fwThread::Worker
FutureType m_future
 Worker's loop future.
 

Additional Inherited Members

- Public Types inherited from fwThread::Worker
typedef ::fwCore::HiResClock::HiResClockType PeriodType
 
typedef std::function< void() > TaskType
 
typedef ::boost::any ExitReturnType
 
typedef std::shared_future< ExitReturnType > FutureType
 
- Static Public Member Functions inherited from fwThread::Worker
static bool isTypeOf (const std::string &type)
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 
- Static Public Member Functions inherited from fwCore::BaseObject
static bool isTypeOf (const std::string &type)
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 
- Static Protected Member Functions inherited from fwThread::Worker
static FWTHREAD_API std::shared_ptr< WorkerdefaultFactory ()
 

Detailed Description

Private implementation of fwThread::Worker using boost::asio.

Definition at line 59 of file WorkerQt.cpp.

Member Function Documentation

fwThread::Worker::FutureType fwGuiQt::WorkerQt::getFuture ( )
virtual

Returns a std::shared_future associated with the execution of Worker's loop.

Warning
Calling getFuture() may be blocking if it is required by a specific implementation (for example, the Qt implementation).

Reimplemented from fwThread::Worker.

Definition at line 213 of file WorkerQt.cpp.

References SLM_ASSERT.

void fwGuiQt::WorkerQt::processTasks ( )
virtual

Processes all worker pending tasks for the calling thread until there are no more tasks to process. You can call this function occasionally when your program is busy performing a long operation.

Warning
WxWidgets version is not yet implemented.

Implements fwThread::Worker.

Definition at line 261 of file WorkerQt.cpp.

void fwGuiQt::WorkerQt::processTasks ( PeriodType  maxtime)
virtual

Processes worker pending tasks for the calling thread for maxtime milliseconds or until there are no more tasks to process. You can call this function occasionally when your program is busy performing a long operation.

Parameters
maxtimemilliseconds to process worker pending tasks.
Warning
Qt implementation processes all Qt and Worker pending events, be careful.
WxWidgets version is not yet implemented.

Implements fwThread::Worker.

Definition at line 268 of file WorkerQt.cpp.


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