RunningTask< T > Class Template Reference

#include <ArmarXCore/core/services/tasks/RunningTask.h>

+ Inheritance diagram for RunningTask< T >:

Public Types

typedef void(T::* method_type) (void)
 Typedef for the thread method.
 
using pointer_type = IceUtil::Handle<RunningTask<T>>
 Shared pointer type for convenience.
 
- Public Types inherited from RunningTaskBase
using CallbackT = std::function<void()>
 

Public Member Functions

 RunningTask (T *parent, method_type runningFn, const std::string &name="")
 Constructs a running task within the class parent which calls the runningFn in a new thread.
 
- Public Member Functions inherited from RunningTaskBase
std::string getName () const
 
bool isFinished () const
 Retrieve finished state of the thread.
 
bool isRunning () const
 Retrieve running state of the thread.
 
bool isStopped ()
 Retrieve whether stop() has been called.
 
void join ()
 Wait for the RunningTask to finish without telling it to finish.
 
 RunningTaskBase (std::string const &name)
 
template<typename T>
 RunningTaskBase (T *parent, void(T::*runningFn)(), const std::string &name="")
 Constructs a running task within the class parent which calls the runningFn in a new thread.
 
void setName (const std::string &name)
 
void setThreadList (ThreadListPtr threadList)
 
void start ()
 Starts the thread.
 
void stop (bool waitForJoin=true)
 Stops the thread.
 
bool waitForFinished (int timeoutMS=-1)
 wait blocking for thread to be finished.
 
void waitForStop ()
 Wait blocking for thread until stop() has been called.
 
 ~RunningTaskBase () override
 Destructor stops the thread and waits for completion.
 

Additional Inherited Members

- Public Attributes inherited from RunningTaskBase
CallbackT callback
 

Detailed Description

template<class T>
class armarx::RunningTask< T >

Definition at line 161 of file RunningTask.h.

Member Typedef Documentation

◆ method_type

template<class T>
typedef void(T::* method_type) (void)

Typedef for the thread method.

Thread methods need to follow the template void methodName(void). Parameter passing is not used since methods are members of the class.

Definition at line 169 of file RunningTask.h.

◆ pointer_type

template<class T>
using pointer_type = IceUtil::Handle<RunningTask<T>>

Shared pointer type for convenience.

Definition at line 174 of file RunningTask.h.

Constructor & Destructor Documentation

◆ RunningTask()

template<class T>
RunningTask ( T * parent,
method_type runningFn,
const std::string & name = "" )
inline

Constructs a running task within the class parent which calls the runningFn in a new thread.

Parameters
nameof this thread, that describes what it is doing. If string is empty, it will use the name of the class with RTTI

Definition at line 183 of file RunningTask.h.

+ Here is the caller graph for this function:

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