31 static void Combine(T & a_existing,
const T & a_new)
42 template <
class ItemType,
class Funcs = cQueueFuncs<ItemType> >
74 Funcs::Combine(*itr, a_Item);
155 if ((*itr) == a_Item)
167 template <
class Predicate>
173 if (a_Predicate(*itr))
RAII for cCriticalSection - locks the CS on creation, unlocks on destruction.
Temporary RAII unlock for a cCSLock.
void Wait(void)
Waits until the event has been set.
void Set(void)
Sets the event - releases one thread that has been waiting in Wait().
This empty struct allows for the callback functions to be inlined.
static void Delete(T)
Called when an Item is deleted from the queue without being returned.
static void Combine(T &a_existing, const T &a_new)
Called when an Item is inserted with EnqueueItemIfNotPresent and there is another equal value already...
size_t Size(void)
Returns the size at time of being called.
cEvent m_evtRemoved
Event that is signalled when an item is removed (both dequeued or erased)
cCriticalSection m_CS
Mutex that protects access to the queue contents.
cEvent m_evtAdded
Event that is signalled when an item is added.
void EnqueueItemIfNotPresent(ItemType a_Item)
Enqueues an item in the queue if not already present (as determined by operator ==).
void EnqueueItem(ItemType a_Item)
Enqueues an item to the queue, may block if other threads are accessing the queue.
void Clear(void)
Removes all Items from the Queue, calling Delete on each of them.
std::list< ItemType > QueueType
QueueType m_Contents
The contents of the queue.
void RemoveIf(Predicate a_Predicate)
Removes all items for which the predicate returns true.
QueueType::iterator iterator
void BlockTillEmpty(void)
Blocks until the queue is empty.
bool Remove(ItemType a_Item)
Removes the item from the queue.
ItemType DequeueItem(void)
Dequeues an item from the queue, blocking until an item is available.
bool TryDequeueItem(ItemType &item)
Dequeues an item from the queue if any are present.