CEBL  2.1
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
TimeoutThread Class Reference

#include <TimeoutThread.hpp>

Public Member Functions

 TimeoutThread ()
virtual ~TimeoutThread ()
bool isHalted ()
bool isStarted ()
double getTimeoutLength ()
 get length of timeout in milliseconds
void setTimeoutLength (double l)
 set length of timeotu in milliseconds

Protected Member Functions

virtual void timeoutFunction ()=0
void timeoutStart ()
 start the thread
void haltAndJoin ()
 halt the thread and wait for it to finish
void sleep (double stime)
 sleep for stime in milliseconds

Protected Attributes

boost::thread * updater_thread
 the thread object
bool is_started
 flag to indicate whether or not the thread is started
bool halt
 flag to order thread to halt on next iteration
bool halted
 flag to indicate whether or not thread has hlated
boost::mutex thread_lock
 mutex to lock the thread
double timeout_length
 how often updater is called

Friends

void runTimeoutThread (TimeoutThread *)
 friend function to start timeout

Detailed Description

TimeoutThread.hpp

Author:
Jeshua Bratman

Simple interface for classes which require a function to be run as a timeout. Uses boost threading library.

Definition at line 34 of file TimeoutThread.hpp.


Constructor & Destructor Documentation

TimeoutThread::TimeoutThread ( )

Definition at line 16 of file TimeoutThread.cpp.

TimeoutThread::~TimeoutThread ( )
virtual

Definition at line 27 of file TimeoutThread.cpp.


Member Function Documentation

double TimeoutThread::getTimeoutLength ( )
inline

get length of timeout in milliseconds

Definition at line 74 of file TimeoutThread.hpp.

References timeout_length.

void TimeoutThread::haltAndJoin ( )
protected

halt the thread and wait for it to finish

Definition at line 36 of file TimeoutThread.cpp.

Referenced by RealTimeClassification::stopClassifying().

bool TimeoutThread::isHalted ( )
inline

Definition at line 71 of file TimeoutThread.hpp.

References halted.

bool TimeoutThread::isStarted ( )
inline

Reimplemented in EEGDataStream.

Definition at line 72 of file TimeoutThread.hpp.

References is_started.

void TimeoutThread::setTimeoutLength ( double  l)
inline

set length of timeotu in milliseconds

Definition at line 76 of file TimeoutThread.hpp.

References timeout_length.

void TimeoutThread::sleep ( double  stime)
protected

sleep for stime in milliseconds

Definition at line 104 of file TimeoutThread.cpp.

virtual void TimeoutThread::timeoutFunction ( )
protectedpure virtual

Implemented in RealTimeClassification.

void TimeoutThread::timeoutStart ( )
protected

start the thread

Definition at line 57 of file TimeoutThread.cpp.

References cppR::bind(), and runTimeoutThread().

Referenced by RealTimeClassification::startClassifying().


Friends And Related Function Documentation

void runTimeoutThread ( TimeoutThread t)
friend

friend function to start timeout

Definition at line 51 of file TimeoutThread.cpp.


Field Documentation

bool TimeoutThread::halt
protected

flag to order thread to halt on next iteration

Definition at line 48 of file TimeoutThread.hpp.

Referenced by RealTimeClassification::timeoutFunction().

bool TimeoutThread::halted
protected

flag to indicate whether or not thread has hlated

Definition at line 50 of file TimeoutThread.hpp.

Referenced by isHalted().

bool TimeoutThread::is_started
protected

flag to indicate whether or not the thread is started

Definition at line 46 of file TimeoutThread.hpp.

Referenced by EEGDataStream::isStarted(), and isStarted().

boost::mutex TimeoutThread::thread_lock
protected

mutex to lock the thread

Definition at line 52 of file TimeoutThread.hpp.

Referenced by RealTimeClassification::clearClassificationQueue(), and RealTimeClassification::timeoutFunction().

double TimeoutThread::timeout_length
protected

how often updater is called

Definition at line 54 of file TimeoutThread.hpp.

Referenced by getTimeoutLength(), RealTimeClassification::RealTimeClassification(), and setTimeoutLength().

boost::thread* TimeoutThread::updater_thread
protected

the thread object

Definition at line 44 of file TimeoutThread.hpp.


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