TrinityCore
LockedQueue< T, StorageType > Class Template Reference

#include <LockedQueue.h>

Public Member Functions

void add (T const &item)
 Adds an item to the queue. More...
 
void add (T &&item)
 Adds an item to the queue. More...
 
template<std::input_iterator Iterator>
void readd (Iterator begin, Iterator end)
 Adds items back to front of the queue. More...
 
bool next (T &result)
 Gets the next result in the queue, if any. More...
 
template<class Checker >
bool next (T &result, Checker &check)
 
void cancel ()
 Cancels the queue. More...
 
bool cancelled ()
 Checks if the queue is cancelled. More...
 
void pop_front ()
 ! Calls pop_front of the queue More...
 
bool empty ()
 ! Checks if we're empty or not with locks held More...
 

Private Attributes

std::mutex _lock
 Lock access to the queue. More...
 
StorageType _queue
 Storage backing the queue. More...
 
bool _canceled = false
 Cancellation flag. More...
 

Detailed Description

template<class T, typename StorageType = std::deque<T>>
class LockedQueue< T, StorageType >

Definition at line 26 of file LockedQueue.h.

Member Function Documentation

◆ add() [1/2]

template<class T , typename StorageType = std::deque<T>>
void LockedQueue< T, StorageType >::add ( T &&  item)
inline

Adds an item to the queue.

Definition at line 47 of file LockedQueue.h.

◆ add() [2/2]

template<class T , typename StorageType = std::deque<T>>
void LockedQueue< T, StorageType >::add ( T const &  item)
inline

Adds an item to the queue.

Definition at line 40 of file LockedQueue.h.

+ Here is the caller graph for this function:

◆ cancel()

template<class T , typename StorageType = std::deque<T>>
void LockedQueue< T, StorageType >::cancel ( )
inline

Cancels the queue.

Definition at line 89 of file LockedQueue.h.

◆ cancelled()

template<class T , typename StorageType = std::deque<T>>
bool LockedQueue< T, StorageType >::cancelled ( )
inline

Checks if the queue is cancelled.

Definition at line 96 of file LockedQueue.h.

◆ empty()

template<class T , typename StorageType = std::deque<T>>
bool LockedQueue< T, StorageType >::empty ( )
inline

! Checks if we're empty or not with locks held

Definition at line 110 of file LockedQueue.h.

◆ next() [1/2]

template<class T , typename StorageType = std::deque<T>>
bool LockedQueue< T, StorageType >::next ( T &  result)
inline

Gets the next result in the queue, if any.

Definition at line 62 of file LockedQueue.h.

+ Here is the caller graph for this function:

◆ next() [2/2]

template<class T , typename StorageType = std::deque<T>>
template<class Checker >
bool LockedQueue< T, StorageType >::next ( T &  result,
Checker &  check 
)
inline

Definition at line 74 of file LockedQueue.h.

◆ pop_front()

template<class T , typename StorageType = std::deque<T>>
void LockedQueue< T, StorageType >::pop_front ( )
inline

! Calls pop_front of the queue

Definition at line 103 of file LockedQueue.h.

◆ readd()

template<class T , typename StorageType = std::deque<T>>
template<std::input_iterator Iterator>
void LockedQueue< T, StorageType >::readd ( Iterator  begin,
Iterator  end 
)
inline

Adds items back to front of the queue.

Definition at line 55 of file LockedQueue.h.

+ Here is the caller graph for this function:

Member Data Documentation

◆ _canceled

template<class T , typename StorageType = std::deque<T>>
bool LockedQueue< T, StorageType >::_canceled = false
private

Cancellation flag.

Definition at line 35 of file LockedQueue.h.

◆ _lock

template<class T , typename StorageType = std::deque<T>>
std::mutex LockedQueue< T, StorageType >::_lock
private

Lock access to the queue.

Definition at line 29 of file LockedQueue.h.

◆ _queue

template<class T , typename StorageType = std::deque<T>>
StorageType LockedQueue< T, StorageType >::_queue
private

Storage backing the queue.

Definition at line 32 of file LockedQueue.h.


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