Loading...
Searching...
No Matches
CEventQueue Class Reference

Global event queue. More...

`#include <src/common/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.
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

std::mutex | 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::CEventQueue | ( |  | ) |

Object's constructor.

## ~CEventQueue()

CEventQueue::~CEventQueue | ( |  | ) |

Object's destructor.

## Member Function Documentation

## IsEmpty()

bool CEventQueue::IsEmpty | ( |  | ) |

Checks if queue is empty.

## AddEvent()

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`.

## GetEvent()

Event CEventQueue::GetEvent | ( |  | ) |

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

## Member Data Documentation

## MAX_EVENT_QUEUE

const int CEventQueue::MAX_EVENT_QUEUE = 100

static

Constant maximum size of queue.

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

- src/common/event.h
- src/common/event.cpp