1 // 2 // $Id: MessageQueue.h,v 1.2 2002/10/26 18:59:16 beveloper Exp $ 3 // 4 // This is the BMessageQueue interface for OpenBeOS. It has been created 5 // to be source and binary compatible with the BeOS version of 6 // BMessageQueue. 7 // 8 9 10 #ifndef _OPENBEOS_MESSAGEQUEUE_H 11 #define _OPENBEOS_MESSAGEQUEUE_H 12 13 14 #include <Locker.h> 15 #include <Message.h> /* For convenience */ 16 17 18 #ifdef USE_OPENBEOS_NAMESPACE 19 namespace OpenBeOS { 20 #endif 21 22 class BMessageQueue { 23 public: 24 BMessageQueue(); 25 virtual ~BMessageQueue(); 26 27 void AddMessage(BMessage *message); 28 void RemoveMessage(BMessage *message); 29 30 int32 CountMessages(void) const; 31 bool IsEmpty(void) const; 32 33 BMessage *FindMessage(int32 index) const; 34 BMessage *FindMessage(uint32 what, int32 index=0) const; 35 36 bool Lock(void); 37 void Unlock(void); 38 bool IsLocked(void); 39 40 BMessage *NextMessage(void); 41 42 private: 43 44 // Reserved space in the vtable for future changes to BMessageQueue 45 virtual void _ReservedMessageQueue1(void); 46 virtual void _ReservedMessageQueue2(void); 47 virtual void _ReservedMessageQueue3(void); 48 49 BMessageQueue(const BMessageQueue &); 50 BMessageQueue &operator=(const BMessageQueue &); 51 52 BMessage *fTheQueue; 53 BMessage *fQueueTail; 54 int32 fMessageCount; 55 BLocker fLocker; 56 57 // Reserved space for future changes to BMessageQueue 58 uint32 fReservedSpace[3]; 59 }; 60 61 #ifdef USE_OPENBEOS_NAMESPACE 62 } 63 #endif 64 65 #endif // _OPENBEOS_MESSAGEQUEUE_H 66