Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

MessageReceiver.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_MessageReceiver_h_
00003 #define INCLUDED_MessageReceiver_h_
00004 
00005 #ifdef PLATFORM_APERIOS
00006 #  warning MessageReceiver is not Aperios compatable
00007 #else
00008 
00009 #include "MessageQueue.h"
00010 #include "Thread.h"
00011 
00012 //! description of MessageReceiver
00013 class MessageReceiver : public Thread {
00014 public:
00015   explicit MessageReceiver(MessageQueueBase& mq, bool (*callback) (RCRegion*)=NULL, bool startThread=true);
00016   ~MessageReceiver();
00017   
00018   RCRegion * peekNextMessage();
00019   RCRegion * getNextMessage();
00020   void markRead();
00021   void waitNextMessage();
00022   unsigned int runloop();
00023   void finish();
00024   
00025   void setCallback(bool (*callback) (RCRegion*)) { process=callback; }
00026   
00027 protected:
00028   typedef MessageQueueBase::index_t index_t;
00029   MessageQueueBase& queue;
00030   unsigned int nextMessage;
00031   unsigned int lastProcessedMessage;
00032   bool (*process) (RCRegion*);
00033   unsigned int sleeptime;
00034   index_t curit;
00035   
00036 private:
00037   MessageReceiver(const MessageReceiver& r); //!< don't call
00038   MessageReceiver& operator=(const MessageReceiver& r); //!< don't call
00039 };
00040 
00041 /*! @file
00042  * @brief 
00043  * @author ejt (Creator)
00044  *
00045  * $Author: ejt $
00046  * $Name: tekkotsu-2_4_1 $
00047  * $Revision: 1.5 $
00048  * $State: Exp $
00049  * $Date: 2005/07/28 18:22:16 $
00050  */
00051 
00052 #endif //Aperios check
00053 
00054 #endif //INCLUDED
00055 

Tekkotsu v2.4.1
Generated Tue Aug 16 16:32:47 2005 by Doxygen 1.4.4