Mountain  1.0.0
Simple C++ 2D Game Framework
Mountain::TsQueue< T > Class Template Reference

Thread-Safe Queue. More...

#include <ts_queue.hpp>

Public Member Functions

 TsQueue ()=default
 Default constructs a TsQueue.
 
 ~TsQueue ()=default
 Default destructs the TsQueue.
 
TFront ()
 Gets a reference to the front item in the queue. More...
 
const TFront () const
 Gets a reference to the front item in the queue. More...
 
TBack ()
 Gets a reference to the back item in the queue. More...
 
const TBack () const
 Gets a reference to the back item in the queue. More...
 
void Push (const T &item)
 Pushes a new item on the back of the queue by copying it. More...
 
void Push (T &&item)
 Pushes a new item on the back of the queue by moving it. More...
 
bool Empty ()
 Checks if the queue is empty. More...
 
size_t Count ()
 Get the number of items in the queue. More...
 
T Pop ()
 Pops the item on the front of the queue. More...
 
void Clear ()
 Clears the queue.
 

Detailed Description

template<typename T>
class Mountain::TsQueue< T >

Thread-Safe Queue.

Template Parameters
TThe type of data to store.
See also
std::queue

Definition at line 17 of file ts_queue.hpp.

Member Function Documentation

◆ Back() [1/2]

template<typename T>
T& Mountain::TsQueue< T >::Back ( )

Gets a reference to the back item in the queue.

Returns
Item

◆ Back() [2/2]

template<typename T>
const T& Mountain::TsQueue< T >::Back ( ) const

Gets a reference to the back item in the queue.

Returns
Item

◆ Count()

template<typename T>
size_t Mountain::TsQueue< T >::Count ( )

Get the number of items in the queue.

Returns
Count

◆ Empty()

template<typename T>
bool Mountain::TsQueue< T >::Empty ( )

Checks if the queue is empty.

Returns
Empty

◆ Front() [1/2]

template<typename T>
T& Mountain::TsQueue< T >::Front ( )

Gets a reference to the front item in the queue.

Returns
Item

◆ Front() [2/2]

template<typename T>
const T& Mountain::TsQueue< T >::Front ( ) const

Gets a reference to the front item in the queue.

Returns
Item

◆ Pop()

template<typename T>
T Mountain::TsQueue< T >::Pop ( )

Pops the item on the front of the queue.

Returns
Item

◆ Push() [1/2]

template<typename T>
void Mountain::TsQueue< T >::Push ( const T item)

Pushes a new item on the back of the queue by copying it.

Parameters
itemItem

◆ Push() [2/2]

template<typename T>
void Mountain::TsQueue< T >::Push ( T &&  item)

Pushes a new item on the back of the queue by moving it.

Parameters
itemItem

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