19 #ifndef LUNCHBOX_MTQUEUE_H
20 #define LUNCHBOX_MTQUEUE_H
22 #include <lunchbox/condition.h>
23 #include <lunchbox/debug.h>
41 template<
typename T,
size_t S = ULONG_MAX >
class MTQueue
50 MTQueue(
size_t maxSize = S ) : _maxSize( maxSize ) {}
65 const T&
operator[](
const size_t index )
const;
68 bool isEmpty()
const {
return _queue.empty(); }
71 size_t getSize()
const {
return _queue.size(); }
92 size_t waitSize(
const size_t minSize )
const;
111 bool timedPop(
const unsigned timeout, T& element );
134 const size_t minimum = 1,
135 const size_t maximum = S );
159 void tryPop(
const size_t num, std::vector< T >& result );
190 bool getBack( T& result )
const;
193 void push(
const T& element );
196 void push(
const std::vector< T >& elements );
202 void pushFront(
const std::vector< T >& elements );
206 void push_back(
const T& element ) {
push( element ); }
207 bool empty()
const {
return isEmpty(); }
211 std::deque< T > _queue;
212 mutable Condition _cond;
217 #include "mtQueue.ipp"
219 #endif //LUNCHBOX_MTQUEUE_H