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. More...
 
 ~CEventQueue ()
 Object's destructor. More...
 
bool IsEmpty ()
 Checks if queue is empty. More...
 
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. More...
 

Static Public Attributes

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

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

Constructor & Destructor Documentation

CEventQueue::CEventQueue ( )

Object's constructor.

CEventQueue::~CEventQueue ( )

Object's destructor.

Member Function Documentation

bool CEventQueue::IsEmpty ( )

Checks if queue is empty.

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.

Event CEventQueue::GetEvent ( )

Removes and returns an event from queue front; if queue is empty, returns event of type EVENT_NULL.

Member Data Documentation

const int CEventQueue::MAX_EVENT_QUEUE = 100
static

Constant maximum size of queue.


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