Panda3D
Loading...
Searching...
No Matches
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 */
29class EXPCL_PANDA_EVENT EventQueue {
30PUBLISHED:
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
43private:
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
bool is_queue_full() const
void clear()
Empties all events on the queue, throwing them on the floor.
static EventQueue * get_global_event_queue()
Returns a pointer to the one global EventQueue object.
Definition eventQueue.I:19
This is a standard, non-reentrant mutex, similar to the Mutex class.
Definition lightMutex.h:41
This is our own Panda specialization on the default STL deque.
Definition pdeque.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.