Tramway SDK
Public Member Functions | Protected Attributes | List of all members
tram::Queue< T > Class Template Reference

#include <queue.h>

Public Member Functions

 Queue ()=delete
 
 Queue (const Queue &)=delete
 
 Queue (Queue &&)=delete
 
 Queue (const char *name, size_t count)
 
template<typename... Args>
void push (Args &&... args)
 Thread safe. More...
 
void pop ()
 
T & front ()
 
T & back ()
 
bool try_pop (T &value)
 Thread safe. More...
 
size_t size ()
 
void lock ()
 
void unlock ()
 

Protected Attributes

const char * name
 
size_t csize
 
size_t count
 
T * first
 
T * last
 
T * memory_start
 
T * memory_end
 
std::atomic< bool > spinlock = {false}
 

Constructor & Destructor Documentation

◆ Queue() [1/4]

template<typename T >
tram::Queue< T >::Queue ( )
delete

◆ Queue() [2/4]

template<typename T >
tram::Queue< T >::Queue ( const Queue< T > &  )
delete

◆ Queue() [3/4]

template<typename T >
tram::Queue< T >::Queue ( Queue< T > &&  )
delete

◆ Queue() [4/4]

template<typename T >
tram::Queue< T >::Queue ( const char *  name,
size_t  count 
)
inline

Member Function Documentation

◆ back()

template<typename T >
T & tram::Queue< T >::back ( )
inline

◆ front()

template<typename T >
T & tram::Queue< T >::front ( )
inline

◆ lock()

template<typename T >
void tram::Queue< T >::lock ( )
inline

◆ pop()

template<typename T >
void tram::Queue< T >::pop ( )
inline

◆ push()

template<typename T >
template<typename... Args>
void tram::Queue< T >::push ( Args &&...  args)
inline

Thread safe.

◆ size()

template<typename T >
size_t tram::Queue< T >::size ( )
inline

◆ try_pop()

template<typename T >
bool tram::Queue< T >::try_pop ( T &  value)
inline

Thread safe.

Copies front of the queue into value.

Returns
True if there was an element into the front of the queue and it was copied into value. Otherwise false.

◆ unlock()

template<typename T >
void tram::Queue< T >::unlock ( )
inline

Member Data Documentation

◆ count

template<typename T >
size_t tram::Queue< T >::count
protected

◆ csize

template<typename T >
size_t tram::Queue< T >::csize
protected

◆ first

template<typename T >
T* tram::Queue< T >::first
protected

◆ last

template<typename T >
T* tram::Queue< T >::last
protected

◆ memory_end

template<typename T >
T* tram::Queue< T >::memory_end
protected

◆ memory_start

template<typename T >
T* tram::Queue< T >::memory_start
protected

◆ name

template<typename T >
const char* tram::Queue< T >::name
protected

◆ spinlock

template<typename T >
std::atomic<bool> tram::Queue< T >::spinlock = {false}
protected

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