You.i Engine
CYIConcurrentDeque< YI_DATA > Class Template Reference

Detailed Description

template<typename YI_DATA>
class CYIConcurrentDeque< YI_DATA >

A simple, thread safe deque.

The deque is templated so that any data type can be used with it.

#include <utility/YiConcurrentDeque.h>

Public Member Functions

 CYIConcurrentDeque ()
 
 CYIConcurrentDeque (const CYIConcurrentDeque< YI_DATA > &other)
 
CYIConcurrentDequeoperator= (const CYIConcurrentDeque< YI_DATA > &rhs)
 
void PushFront (const YI_DATA &rData)
 
void PushBack (const YI_DATA &rData)
 
void WaitEmpty ()
 
bool Empty () const
 
bool TryPopFront (YI_DATA &rValue)
 
bool TryPopBack (YI_DATA &rValue)
 
bool WaitAndPopFront (YI_DATA &rValue)
 
bool WaitAndPopFront (YI_DATA &rValue, uint64_t timeoutMs)
 
bool WaitAndPopBack (YI_DATA &rValue)
 
void StopWaiting ()
 
size_t GetSize () const
 

Constructor & Destructor Documentation

◆ CYIConcurrentDeque() [1/2]

template<typename YI_DATA>
CYIConcurrentDeque< YI_DATA >::CYIConcurrentDeque ( )
inline

◆ CYIConcurrentDeque() [2/2]

template<typename YI_DATA>
CYIConcurrentDeque< YI_DATA >::CYIConcurrentDeque ( const CYIConcurrentDeque< YI_DATA > &  other)
inline

Member Function Documentation

◆ Empty()

template<typename YI_DATA>
bool CYIConcurrentDeque< YI_DATA >::Empty ( ) const
inline

Checks if the queue is empty.

◆ GetSize()

template<typename YI_DATA>
size_t CYIConcurrentDeque< YI_DATA >::GetSize ( ) const
inline

Returns the current number of items in the queue.

◆ operator=()

template<typename YI_DATA>
CYIConcurrentDeque& CYIConcurrentDeque< YI_DATA >::operator= ( const CYIConcurrentDeque< YI_DATA > &  rhs)
inline

◆ PushBack()

template<typename YI_DATA>
void CYIConcurrentDeque< YI_DATA >::PushBack ( const YI_DATA &  rData)
inline
See also
PushFront()

◆ PushFront()

template<typename YI_DATA>
void CYIConcurrentDeque< YI_DATA >::PushFront ( const YI_DATA &  rData)
inline

Add a new piece of data to the front of the deque.

◆ StopWaiting()

template<typename YI_DATA>
void CYIConcurrentDeque< YI_DATA >::StopWaiting ( )
inline

Wakes the queue, if it is waiting for a message to arrive.

See also
WaitAndPopFront()
WaitAndPopBack()

◆ TryPopBack()

template<typename YI_DATA>
bool CYIConcurrentDeque< YI_DATA >::TryPopBack ( YI_DATA &  rValue)
inline
See also
TryPopFront()

◆ TryPopFront()

template<typename YI_DATA>
bool CYIConcurrentDeque< YI_DATA >::TryPopFront ( YI_DATA &  rValue)
inline

Attempt to remove an element from the queue, unless the queue is empty or a mutext lock cannot be obtained.

◆ WaitAndPopBack()

template<typename YI_DATA>
bool CYIConcurrentDeque< YI_DATA >::WaitAndPopBack ( YI_DATA &  rValue)
inline

◆ WaitAndPopFront() [1/2]

template<typename YI_DATA>
bool CYIConcurrentDeque< YI_DATA >::WaitAndPopFront ( YI_DATA &  rValue)
inline

Wait for the queue to become available, and then remove the element at the front of the queue. If the waiting is interrupted via StopWaiting(), returns false with no valid rValue. User should check the return code before reading rValue.

◆ WaitAndPopFront() [2/2]

template<typename YI_DATA>
bool CYIConcurrentDeque< YI_DATA >::WaitAndPopFront ( YI_DATA &  rValue,
uint64_t  timeoutMs 
)
inline

Wait for the queue to become available, and then remove the element at the front of the queue. If the waiting is interrupted via StopWaiting(), returns false with no valid rValue. If timeoutMs milliseconds ellapse without an item becoming available, false is returned. User should check the return code before reading rValue.

◆ WaitEmpty()

template<typename YI_DATA>
void CYIConcurrentDeque< YI_DATA >::WaitEmpty ( )
inline

Returns when the queue is empty.


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