Colobot
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.
 
bool IsEmpty ()
 Checks if queue is empty.
 
bool AddEvent (Event &&event)
 Adds an event to the queue. More...
 
Event GetEvent ()
 Removes and returns an event from queue front; if queue is empty, returns event of type EVENT_NULL.
 

Static Public Attributes

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

Protected Attributes

CSDLMutexWrapper m_mutex
 
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.

This class is thread-safe

Member Function Documentation

bool CEventQueue::AddEvent ( 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.


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