Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

MessageQueueStatusThread Class Reference

description of MessageQueueStatusThread More...

#include <MessageQueueStatusThread.h>

Inheritance diagram for MessageQueueStatusThread:

Detailed Description

description of MessageQueueStatusThread

Definition at line 16 of file MessageQueueStatusThread.h.

List of all members.

Classes

class  StatusListener
 An interface to allow you to receive callbacks when a message has been read from a MessageQueue, subscribed via an external class which is monitoring the queue's MessageQueueBase::pollStatus() (e.g. LoadFileThread). More...

Public Member Functions

 MessageQueueStatusThread ()
 constructor
 MessageQueueStatusThread (MessageQueueBase &mq, StatusListener *listener=NULL)
 constructor, automatically starts the thread with the specified queue, and an optional initial listener
 ~MessageQueueStatusThread ()
 destructor, remove ourself from queue
virtual void addStatusListener (StatusListener *l)
 Request updates to StatusListener callbacks.
virtual void removeStatusListener (StatusListener *l)
 Unsubscribes a StatusListener from future updates.
virtual void setMessageQueue (MessageQueueBase &mq)
 (re)sets the message queue being listened to
virtual MessageQueueBasegetMessageQueue ()
 returns the current queue

Protected Member Functions

virtual bool launched ()
 start the thread
virtual void * run ()
 wait for the queue's message read semaphore to be raised, and notify listeners
virtual Threadstop ()
 indicates it's time to stop monitoring the queue (need to raise the semaphore so run() will notice the stop)
virtual void cancelled ()
 cleanup
virtual void fireMessagesRead (unsigned int howmany)
 Notifies statusListeners that a message has been read by all MessageQueue receivers.

Protected Attributes

std::list< StatusListener * > statusListeners
 MessageQueueBase::StatusListeners currently subscribed from addStatusListener().
MessageQueueBasequeue
 The MessageQueue that this thread is monitoring.
SemaphoreManager::semid_t semid
 the semaphore which is being monitored, raised by queue when a message is read
unsigned int numRead
 the number of messages read sent last time the semaphore (semid) was raised

Private Member Functions

 MessageQueueStatusThread (const MessageQueueStatusThread &)
 don't call, shouldn't copy
MessageQueueStatusThreadoperator= (const MessageQueueStatusThread &)
 don't call, shouldn't assign

Constructor & Destructor Documentation

MessageQueueStatusThread::MessageQueueStatusThread (  ) 

constructor

Definition at line 37 of file MessageQueueStatusThread.h.

MessageQueueStatusThread::MessageQueueStatusThread ( MessageQueueBase mq,
StatusListener listener = NULL 
) [explicit]

constructor, automatically starts the thread with the specified queue, and an optional initial listener

Definition at line 41 of file MessageQueueStatusThread.h.

MessageQueueStatusThread::~MessageQueueStatusThread (  ) 

destructor, remove ourself from queue

Definition at line 9 of file MessageQueueStatusThread.cc.

MessageQueueStatusThread::MessageQueueStatusThread ( const MessageQueueStatusThread  )  [private]

don't call, shouldn't copy


Member Function Documentation

void MessageQueueStatusThread::addStatusListener ( StatusListener l  )  [virtual]

Request updates to StatusListener callbacks.

Definition at line 16 of file MessageQueueStatusThread.cc.

Referenced by MessageQueueStatusThread().

void MessageQueueStatusThread::cancelled (  )  [protected, virtual]

cleanup

Reimplemented from Thread.

Definition at line 113 of file MessageQueueStatusThread.cc.

void MessageQueueStatusThread::fireMessagesRead ( unsigned int  howmany  )  [protected, virtual]

Notifies statusListeners that a message has been read by all MessageQueue receivers.

Definition at line 121 of file MessageQueueStatusThread.cc.

Referenced by run().

MessageQueueBase * MessageQueueStatusThread::getMessageQueue (  )  [virtual]

returns the current queue

Definition at line 76 of file MessageQueueStatusThread.cc.

bool MessageQueueStatusThread::launched (  )  [protected, virtual]

start the thread

Reimplemented from Thread.

Definition at line 80 of file MessageQueueStatusThread.cc.

MessageQueueStatusThread& MessageQueueStatusThread::operator= ( const MessageQueueStatusThread  )  [private]

don't call, shouldn't assign

void MessageQueueStatusThread::removeStatusListener ( StatusListener l  )  [virtual]

Unsubscribes a StatusListener from future updates.

Definition at line 37 of file MessageQueueStatusThread.cc.

void * MessageQueueStatusThread::run (  )  [protected, virtual]

wait for the queue's message read semaphore to be raised, and notify listeners

Reimplemented from Thread.

Definition at line 84 of file MessageQueueStatusThread.cc.

void MessageQueueStatusThread::setMessageQueue ( MessageQueueBase mq  )  [virtual]

(re)sets the message queue being listened to

Definition at line 47 of file MessageQueueStatusThread.cc.

Referenced by MessageQueueStatusThread().

Thread & MessageQueueStatusThread::stop (  )  [protected, virtual]

indicates it's time to stop monitoring the queue (need to raise the semaphore so run() will notice the stop)

Reimplemented from Thread.

Definition at line 106 of file MessageQueueStatusThread.cc.

Referenced by removeStatusListener(), setMessageQueue(), and ~MessageQueueStatusThread().


Member Data Documentation

unsigned int MessageQueueStatusThread::numRead [protected]

the number of messages read sent last time the semaphore (semid) was raised

Definition at line 83 of file MessageQueueStatusThread.h.

Referenced by addStatusListener(), and run().

the semaphore which is being monitored, raised by queue when a message is read

Definition at line 80 of file MessageQueueStatusThread.h.

Referenced by addStatusListener(), cancelled(), run(), and stop().

MessageQueueBase::StatusListeners currently subscribed from addStatusListener().

Definition at line 74 of file MessageQueueStatusThread.h.

Referenced by addStatusListener(), fireMessagesRead(), removeStatusListener(), and setMessageQueue().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:13 2016 by Doxygen 1.6.3