Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
CEventQueue Class Reference

Global event queue. More...

#include <event.h>

Public Member Functions

 CEventQueue ()
 Object's constructor.
 ~CEventQueue ()
 Object's destructor.
void Flush ()
 Empties the FIFO of events.
bool AddEvent (const Event &event)
 Adds an event to the queue.
bool GetEvent (Event &event)
 Removes and returns an event from queue front.

Static Public Attributes

static const int MAX_EVENT_QUEUE = 100
 Constant maximum size of queue.

Protected Attributes

Event m_fifo [MAX_EVENT_QUEUE]
int m_head
int m_tail
int m_total

Detailed Description

Global event queue.

Provides an interface to a global FIFO queue with events (both system- and user-generated). The queue has a fixed maximum size but it should not be a problem.

Member Function Documentation

bool CEventQueue::AddEvent ( const Event event)

Adds an event to the queue.

If the maximum size of queue has been reached, returns false. Else, adds the event to the queue and returns true.

bool CEventQueue::GetEvent ( Event event)

Removes and returns an event from queue front.

If the queue is empty, returns false. Else, gets the event from the front, puts it into event and returns true.


The documentation for this class was generated from the following files: