Torc  0.1
Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
TorcQThread Class Referenceabstract

A Torc specific wrapper around QThread. More...

#include <torcqthread.h>

Inheritance diagram for TorcQThread:
[legend]

Signals

void Started (void)
 
void Finished (void)
 

Public Member Functions

 TorcQThread (const QString &Name)
 
virtual ~TorcQThread ()=default
 
virtual void Start (void)=0
 
virtual void Finish (void)=0
 

Static Public Member Functions

static void SetMainThread (void)
 
static bool IsMainThread (void)
 
static void InitRand (void)
 

Protected Member Functions

virtual void run (void)
 
void Initialise (void)
 Performs Torc specific thread initialisation. More...
 
void Deinitialise (void)
 Performs Torc specific thread cleanup. More...
 

Detailed Description

A Torc specific wrapper around QThread.

TorcQThread performs basic Torc thread setup when a new thread is started (principally logging initialisation and random number seeding) and cleanup (logging and database cleanup) when a thread is exiting.

Subclass TorcQThread and reimplement Start and Finish to add additional code that will be executed in the new thread after initialisation and just before exiting respectively.

To trigger code in other objects, use the TorcQThread specific Started and Finished signals (instead of 'started' and 'finished', as provided by QThread).

Note
Torc database access is restricted to full TorcQThreads and is disallowed from QRunnable subclasses.
Todo:
Make run private again and enfore event driven loops for all classes.

Definition at line 7 of file torcqthread.h.

Constructor & Destructor Documentation

TorcQThread::TorcQThread ( const QString &  Name)
explicit

Definition at line 64 of file torcqthread.cpp.

virtual TorcQThread::~TorcQThread ( )
virtualdefault

Member Function Documentation

void TorcQThread::Deinitialise ( void  )
protected

Performs Torc specific thread cleanup.

Definition at line 90 of file torcqthread.cpp.

virtual void TorcQThread::Finish ( void  )
pure virtual
void TorcQThread::Finished ( void  )
signal
void TorcQThread::Initialise ( void  )
protected

Performs Torc specific thread initialisation.

Definition at line 79 of file torcqthread.cpp.

void TorcQThread::InitRand ( void  )
static

Definition at line 59 of file torcqthread.cpp.

bool TorcQThread::IsMainThread ( void  )
static

Definition at line 52 of file torcqthread.cpp.

void TorcQThread::run ( void  )
protectedvirtual

Reimplemented in TorcPiSwitchInputThread, and LoggingThread.

Definition at line 71 of file torcqthread.cpp.

void TorcQThread::SetMainThread ( void  )
static

Definition at line 45 of file torcqthread.cpp.

virtual void TorcQThread::Start ( void  )
pure virtual
void TorcQThread::Started ( void  )
signal

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