4#include <Foundation/Communication/Message.h>
5#include <Foundation/Containers/Deque.h>
6#include <Foundation/Threading/Lock.h>
7#include <Foundation/Threading/Mutex.h>
16template <
typename MetaDataType>
22 PL_DECLARE_POD_TYPE();
25 MetaDataType m_MetaData;
26 mutable plUInt64 m_uiMessageHash = 0;
80 template <
typename Comparer>
81 void Sort(
const Comparer& comparer);
95template <
typename MetaDataType,
typename AllocatorWrapper = plDefaultAllocatorWrapper>
109#include <Foundation/Communication/Implementation/MessageQueue_inl.h>
Base class for all memory allocators.
Definition Allocator.h:23
Base class for all message types. Each message type has it's own id which is used to dispatch message...
Definition Message.h:22
Implementation of a message queue on top of a deque.
Definition MessageQueue.h:18
void operator=(const plMessageQueueBase &rhs)
Assignment operator.
Definition MessageQueue_inl.h:22
bool TryDequeue(plMessage *&out_pMessage, MetaDataType &out_metaData)
Dequeues the first element if the queue is not empty and returns true. Returns false if the queue is ...
Definition MessageQueue_inl.h:84
void Compact()
Tries to compact the array to avoid wasting memory.The resulting capacity is at least 'GetCount' (no ...
Definition MessageQueue_inl.h:64
bool IsEmpty() const
Returns true, if the queue does not contain any elements.
Definition MessageQueue_inl.h:46
void Dequeue()
Removes the first element from the queue. Not thread safe.
Definition MessageQueue_inl.h:125
void Clear()
Destructs all elements and sets the count to zero. Does not deallocate any data.
Definition MessageQueue_inl.h:52
~plMessageQueueBase()
Destructor.
Definition MessageQueue_inl.h:16
void Enqueue(plMessage *pMessage, const MetaDataType &metaData)
Enqueues the given message and meta-data. This method is thread safe.
Definition MessageQueue_inl.h:70
void Lock()
Acquires an exclusive lock on the queue. Do not use this method directly but use plLock instead.
Definition MessageQueue_inl.h:138
plUInt32 GetCount() const
Returns the number of active elements in the queue.
Definition MessageQueue_inl.h:40
bool TryPeek(plMessage *&out_pMessage, MetaDataType &out_metaData)
Gives the first element if the queue is not empty and returns true. Returns false if the queue is emp...
Definition MessageQueue_inl.h:102
Entry & operator[](plUInt32 uiIndex)
Returns the element at the given index. Not thread safe.
Definition MessageQueue_inl.h:28
void Reserve(plUInt32 uiCount)
Expands the queue so it can at least store the given capacity.
Definition MessageQueue_inl.h:58
void Unlock()
Releases a lock that has been previously acquired. Do not use this method directly but use plLock ins...
Definition MessageQueue_inl.h:144
plMessageQueueBase(plAllocator *pAllocator)
No memory is allocated during construction.
Definition MessageQueue_inl.h:3
Entry & Peek()
Returns the first element in the queue. Not thread safe.
Definition MessageQueue_inl.h:119
void Sort(const Comparer &comparer)
Sort with explicit comparer. Not thread safe.
Definition MessageQueue.h:97
Provides a simple mechanism for mutual exclusion to prevent multiple threads from accessing a shared ...
Definition Mutex.h:13
Definition MessageQueue.h:21