Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

EventQueue.cpp

Go to the documentation of this file.
00001 #include "EventQueue.h"
00002 
00003 //EventNode
00004 
00005 EventNode::EventNode(){
00006         this->next = NULL;
00007         this->item = NULL;
00008         this->type = 0;
00009 }
00010 
00011 
00012 void EventNode::insert(void *item, int type){
00013         if(!this->isEmpty())
00014                 this->next->insert(item, type);
00015         else{
00016                 this->item = item;
00017                 this->next = new EventNode();
00018                 this->type = type;
00019         }
00020 }
00021 
00022 
00023 int EventNode::getType(){
00024         return(this->type);
00025 }
00026 
00027 
00028 void *EventNode::getItem(){
00029         return(this->item);
00030 }
00031 
00032 
00033 EventNode *EventNode::getNextNode(){
00034         return(this->next);
00035 }
00036 
00037 
00038 bool EventNode::isEmpty(){
00039         return(this->item == NULL);
00040 }
00041 
00042 
00043 //EventQueue
00044 
00045 EventQueue::EventQueue(){
00046         this->first = new EventNode();
00047 }
00048 
00049 
00050 bool EventQueue::isEventPending(){
00051         return(!this->first->isEmpty());
00052 }
00053 
00054 
00055 void EventQueue::addLast(GE *event){
00056         this->first->insert((void *)event, event->getType());
00057 }
00058 
00059 
00060 int EventQueue::getType(){
00061         return(this->first->getType());
00062 }
00063 
00064 
00065 void *EventQueue::getNextEvent(){
00066         if(first->isEmpty())
00067                 return(NULL);
00068         void *ret = first->getItem();
00069         first = first->getNextNode();
00070         return(ret);
00071 }

Generated on Sun Jun 5 15:47:03 2005 for Defacto by  doxygen 1.4.3