Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/event/eventQueue.h

Go to the documentation of this file.
00001 // Filename: eventQueue.h
00002 // Created by:  drose (08Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef EVENTQUEUE_H
00020 #define EVENTQUEUE_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include "event.h"
00025 #include "pt_Event.h"
00026 
00027 #include <circBuffer.h>
00028 
00029 #ifdef OLD_HAVE_IPC
00030 #include <ipc_mutex.h>
00031 #endif
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //       Class : EventQueue
00035 // Description : A queue of pending events.  As events are thrown,
00036 //               they are added to this queue; eventually, they will
00037 //               be extracted out again by an EventHandler and
00038 //               processed.
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDAEXPRESS EventQueue {
00041 public:
00042   enum { max_events = 500 };
00043 
00044 PUBLISHED:
00045   EventQueue();
00046   ~EventQueue();
00047 
00048   void queue_event(CPT_Event event);
00049   void clear();
00050 
00051   bool is_queue_empty() const;
00052   bool is_queue_full() const;
00053   CPT_Event dequeue_event();
00054 
00055   INLINE static EventQueue *
00056   get_global_event_queue();
00057 
00058 protected:
00059   CircBuffer<CPT_Event, max_events> _queue;
00060 
00061   static void make_global_event_queue();
00062   static EventQueue *_global_event_queue;
00063 
00064 #ifdef OLD_HAVE_IPC
00065   mutex _lock;
00066 #endif
00067 };
00068 
00069 #include "eventQueue.I"
00070 
00071 #endif

Generated on Fri May 2 00:38:17 2003 for Panda by doxygen1.3