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