eventqueue.h

Go to the documentation of this file.
00001 /* MAINTAINER: Petko */
00002 
00003 #ifndef _EVENTQUEUE_H
00004 #define _EVENTQUEUE_H
00005 
00006 #include "event.h"
00007 #include "log.h"
00008 #include <queue>
00009 
00013 class EventQueue
00014 {
00015 
00016 public:
00017         
00018         EventQueue(){};
00019         ~EventQueue()
00020         {
00021                 cleanUp();
00022         }
00023 
00028         void push( Event * newevent )
00029         {
00030                 assertL( newevent != 0 );
00031                 mQueue.push( newevent );
00032         }
00033         
00038         Event * pop()
00039         {
00040                 if ( mQueue.empty() )
00041                         return 0;
00042                 else
00043                 {
00044                         Event * retval = mQueue.front();
00045                         mQueue.pop();
00046                         return retval;
00047                 }
00048         }
00049 
00052         void cleanUp()
00053         {
00054                 while ( !mQueue.empty() )
00055                 {
00056                         delete pop();
00057                 }
00058         }
00059 
00060 private:
00061         
00062         std::queue< Event* > mQueue;
00063 
00066         EventQueue( const EventQueue & eq )
00067         {
00068                 DIE( "Attempt to copy event queue!" );
00069         }
00070 
00071 };
00072 
00073 #endif // _EVENTQUEUE_H

Generated on Wed Apr 12 13:55:28 2006 for bjs by  doxygen 1.4.5