Panda3D
eventQueue.h
1 // Filename: eventQueue.h
2 // Created by: drose (08Feb99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef EVENTQUEUE_H
16 #define EVENTQUEUE_H
17 
18 #include "pandabase.h"
19 
20 #include "event.h"
21 #include "pt_Event.h"
22 #include "lightMutex.h"
23 #include "pdeque.h"
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : EventQueue
27 // Description : A queue of pending events. As events are thrown,
28 // they are added to this queue; eventually, they will
29 // be extracted out again by an EventHandler and
30 // processed.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDA_EVENT EventQueue {
33 PUBLISHED:
34  EventQueue();
35  ~EventQueue();
36 
37  void queue_event(CPT_Event event);
38  void clear();
39 
40  bool is_queue_empty() const;
41  bool is_queue_full() const;
42  CPT_Event dequeue_event();
43 
44  INLINE static EventQueue *get_global_event_queue();
45 
46 private:
47  static void make_global_event_queue();
48  static EventQueue *_global_event_queue;
49 
50  typedef pdeque<CPT_Event> Events;
51  Events _queue;
52 
53  LightMutex _lock;
54 };
55 
56 #include "eventQueue.I"
57 
58 #endif
A queue of pending events.
Definition: eventQueue.h:32
A ConstPointerTo is similar to a PointerTo, except it keeps a const pointer to the thing...
Definition: pointerTo.h:144
This is a standard, non-reentrant mutex, similar to the Mutex class.
Definition: lightMutex.h:45