ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Attributes | List of all members
ctd::mptk::Thread Class Reference

IFW CTD Multiprocessing Toolkit Thread base class. More...

#include <Thread.hpp>

Inheritance diagram for ctd::mptk::Thread:
TestThread TestThread1

Public Types

enum  ThreadExecControl {
  THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1,
  THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING,
  THREAD_EXEC_PAUSED
}
 Thread execution control/status. More...
 
enum  ThreadExecControl {
  THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1,
  THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING,
  THREAD_EXEC_PAUSED
}
 Thread execution control/status. More...
 
enum  ThreadExecControl {
  THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1,
  THREAD_EXEC_RUNNING, THREAD_EXEC_PAUSED, THREAD_EXEC_STOPPED = 1, THREAD_EXEC_RUNNING,
  THREAD_EXEC_PAUSED
}
 Thread execution control/status. More...
 

Public Member Functions

 Thread (const std::string &thread_id, MessageBus &message_bus, const double period=0.1)
 Constructor method, setting up the internal members. More...
 
virtual ~Thread ()
 
std::string Id ()
 Return the thread ID. More...
 
void Loop ()
 Method to invoke the user provided business logic of the thread. More...
 
virtual void UserLogic ()
 User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management. More...
 
void Start ()
 Start the thread execution. More...
 
void Stop ()
 Stop the thread execution. More...
 
void Pause ()
 Pause the thread execution. More...
 
bool CheckExecFlag ()
 Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return. More...
 
ThreadExecControl GetExecFlag () const
 Return the value of the Thread Execution Flag. More...
 
bool Terminated () const
 Returns true if thread no longer running. More...
 
MessageBusMsgBus ()
 Get acces to the MessageBus associated with this thread object. More...
 
std::string Print () const
 Generate ASCII output providing a status of the object. More...
 
 Thread (const std::string &thread_id, MessageBus &message_bus, const double period=0.1)
 Constructor method, setting up the internal members. More...
 
virtual ~Thread ()
 
std::string Id ()
 Return the thread ID. More...
 
void Loop ()
 Method to invoke the user provided business logic of the thread. More...
 
virtual void UserLogic ()
 User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management. More...
 
void Start ()
 Start the thread execution. More...
 
void Stop ()
 Stop the thread execution. More...
 
void Pause ()
 Pause the thread execution. More...
 
bool CheckExecFlag ()
 Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return. More...
 
ThreadExecControl GetExecFlag () const
 Return the value of the Thread Execution Flag. More...
 
bool Terminated () const
 Returns true if thread no longer running. More...
 
MessageBusMsgBus ()
 Get acces to the MessageBus associated with this thread object. More...
 
std::string Print () const
 Generate ASCII output providing a status of the object. More...
 
 Thread (const std::string &thread_id, MessageBus &message_bus, const double period=0.1)
 Constructor method, setting up the internal members. More...
 
virtual ~Thread ()
 
std::string Id ()
 Return the thread ID. More...
 
void Loop ()
 Method to invoke the user provided business logic of the thread. More...
 
virtual void UserLogic ()
 User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management. More...
 
void Start ()
 Start the thread execution. More...
 
void Stop ()
 Stop the thread execution. More...
 
void Pause ()
 Pause the thread execution. More...
 
bool CheckExecFlag ()
 Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return. More...
 
ThreadExecControl GetExecFlag () const
 Return the value of the Thread Execution Flag. More...
 
bool Terminated () const
 Returns true if thread no longer running. More...
 
MessageBusMsgBus ()
 Get acces to the MessageBus associated with this thread object. More...
 
std::string Print () const
 Generate ASCII output providing a status of the object. More...
 

Static Public Attributes

static std::map< std::string,
Thread * > 
s_thread_registry
 
static const std::string THREAD_REGISTRY = "ThreadRegistry"
 

Detailed Description

IFW CTD Multiprocessing Toolkit Thread base class.

Member Enumeration Documentation

Thread execution control/status.

Enumerator
THREAD_EXEC_STOPPED 
THREAD_EXEC_RUNNING 
THREAD_EXEC_PAUSED 
THREAD_EXEC_STOPPED 
THREAD_EXEC_RUNNING 
THREAD_EXEC_PAUSED 
THREAD_EXEC_STOPPED 
THREAD_EXEC_RUNNING 
THREAD_EXEC_PAUSED 

Thread execution control/status.

Enumerator
THREAD_EXEC_STOPPED 
THREAD_EXEC_RUNNING 
THREAD_EXEC_PAUSED 
THREAD_EXEC_STOPPED 
THREAD_EXEC_RUNNING 
THREAD_EXEC_PAUSED 
THREAD_EXEC_STOPPED 
THREAD_EXEC_RUNNING 
THREAD_EXEC_PAUSED 

Thread execution control/status.

Enumerator
THREAD_EXEC_STOPPED 
THREAD_EXEC_RUNNING 
THREAD_EXEC_PAUSED 
THREAD_EXEC_STOPPED 
THREAD_EXEC_RUNNING 
THREAD_EXEC_PAUSED 
THREAD_EXEC_STOPPED 
THREAD_EXEC_RUNNING 
THREAD_EXEC_PAUSED 

Constructor & Destructor Documentation

ctd::mptk::Thread::Thread ( const std::string &  thread_id,
MessageBus message_bus,
const double  period = 0.1 
)

Constructor method, setting up the internal members.

Parameters
thread_idThe ID of the thread.
periodPeriod (s) (soft realtime) execution time for the thread loop (if relevant).
ctd::mptk::Thread::~Thread ( )
virtual
ctd::mptk::Thread::Thread ( const std::string &  thread_id,
MessageBus message_bus,
const double  period = 0.1 
)

Constructor method, setting up the internal members.

Parameters
thread_idThe ID of the thread.
periodPeriod (s) (soft realtime) execution time for the thread loop (if relevant).
virtual ctd::mptk::Thread::~Thread ( )
virtual
ctd::mptk::Thread::Thread ( const std::string &  thread_id,
MessageBus message_bus,
const double  period = 0.1 
)

Constructor method, setting up the internal members.

Parameters
thread_idThe ID of the thread.
periodPeriod (s) (soft realtime) execution time for the thread loop (if relevant).
virtual ctd::mptk::Thread::~Thread ( )
virtual

Member Function Documentation

bool ctd::mptk::Thread::CheckExecFlag ( )

Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return.

bool ctd::mptk::Thread::CheckExecFlag ( )

Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return.

bool ctd::mptk::Thread::CheckExecFlag ( )

Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread, at least during every internal cycle (of LogicUser()). The behavior is as follows: THREAD_EXEC_RUNNING: Return immediately with true. THREAD_EXEC_PAUSED: Wait internally for flag to change to THREAD_EXEC_RUN/_STOP. TRHEAD_EXEC_STOPPED: Return immediately with false. Thread LogicUser() shall return.

Thread::ThreadExecControl ctd::mptk::Thread::GetExecFlag ( ) const

Return the value of the Thread Execution Flag.

ThreadExecControl ctd::mptk::Thread::GetExecFlag ( ) const

Return the value of the Thread Execution Flag.

ThreadExecControl ctd::mptk::Thread::GetExecFlag ( ) const

Return the value of the Thread Execution Flag.

std::string ctd::mptk::Thread::Id ( )

Return the thread ID.

std::string ctd::mptk::Thread::Id ( )

Return the thread ID.

std::string ctd::mptk::Thread::Id ( )

Return the thread ID.

void ctd::mptk::Thread::Loop ( )

Method to invoke the user provided business logic of the thread.

Todo:
: Measure drift + standard deviation + log period statistics.
Todo:
: Measure drift + standard deviation + log period statistics.
void ctd::mptk::Thread::Loop ( )

Method to invoke the user provided business logic of the thread.

void ctd::mptk::Thread::Loop ( )

Method to invoke the user provided business logic of the thread.

MessageBus& ctd::mptk::Thread::MsgBus ( )

Get acces to the MessageBus associated with this thread object.

MessageBus& ctd::mptk::Thread::MsgBus ( )

Get acces to the MessageBus associated with this thread object.

MessageBus & ctd::mptk::Thread::MsgBus ( )

Get acces to the MessageBus associated with this thread object.

void ctd::mptk::Thread::Pause ( )

Pause the thread execution.

void ctd::mptk::Thread::Pause ( )

Pause the thread execution.

void ctd::mptk::Thread::Pause ( )

Pause the thread execution.

std::string ctd::mptk::Thread::Print ( ) const

Generate ASCII output providing a status of the object.

std::string ctd::mptk::Thread::Print ( ) const

Generate ASCII output providing a status of the object.

std::string ctd::mptk::Thread::Print ( ) const

Generate ASCII output providing a status of the object.

void ctd::mptk::Thread::Start ( )

Start the thread execution.

void ctd::mptk::Thread::Start ( )

Start the thread execution.

void ctd::mptk::Thread::Start ( )

Start the thread execution.

void ctd::mptk::Thread::Stop ( )

Stop the thread execution.

void ctd::mptk::Thread::Stop ( )

Stop the thread execution.

void ctd::mptk::Thread::Stop ( )

Stop the thread execution.

bool ctd::mptk::Thread::Terminated ( ) const

Returns true if thread no longer running.

bool ctd::mptk::Thread::Terminated ( ) const

Returns true if thread no longer running.

bool ctd::mptk::Thread::Terminated ( ) const

Returns true if thread no longer running.

void ctd::mptk::Thread::UserLogic ( )
virtual

User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management.

Reimplemented in TestThread, and TestThread1.

virtual void ctd::mptk::Thread::UserLogic ( )
virtual

User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management.

Reimplemented in TestThread, and TestThread1.

virtual void ctd::mptk::Thread::UserLogic ( )
virtual

User provided business logic. The UserLogic method need not execute an internal loop. It is taken care of by the Control() method. Instead the UserLogic() method should (normally) execute it business logic, and return control to the Control() method, which will take of the thread management.

Reimplemented in TestThread, and TestThread1.

Member Data Documentation

std::map< std::string, Thread * > ctd::mptk::Thread::s_thread_registry
static
const std::string ctd::mptk::Thread::THREAD_REGISTRY = "ThreadRegistry"
static

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