Panda3D
|
00001 // Filename: eventQueue.h 00002 // Created by: drose (08Feb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef EVENTQUEUE_H 00016 #define EVENTQUEUE_H 00017 00018 #include "pandabase.h" 00019 00020 #include "event.h" 00021 #include "pt_Event.h" 00022 #include "lightMutex.h" 00023 #include "pdeque.h" 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : EventQueue 00027 // Description : A queue of pending events. As events are thrown, 00028 // they are added to this queue; eventually, they will 00029 // be extracted out again by an EventHandler and 00030 // processed. 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDA_EVENT EventQueue { 00033 PUBLISHED: 00034 EventQueue(); 00035 ~EventQueue(); 00036 00037 void queue_event(CPT_Event event); 00038 void clear(); 00039 00040 bool is_queue_empty() const; 00041 bool is_queue_full() const; 00042 CPT_Event dequeue_event(); 00043 00044 INLINE static EventQueue *get_global_event_queue(); 00045 00046 private: 00047 static void make_global_event_queue(); 00048 static EventQueue *_global_event_queue; 00049 00050 typedef pdeque<CPT_Event> Events; 00051 Events _queue; 00052 00053 LightMutex _lock; 00054 }; 00055 00056 #include "eventQueue.I" 00057 00058 #endif