22 #ifndef TITANIC_FIXED_QUEUE_H 23 #define TITANIC_FIXED_QUEUE_H 25 #include "common/scummsys.h" 26 #include "common/array.h" 33 template<
class T, u
int MAX_SIZE = 10>
35 typedef uint size_type;
47 size_type
size()
const {
return _data.
size() - _topIndex; }
81 if (_data.
size() == MAX_SIZE && _topIndex > 0) {
82 if (_topIndex < MAX_SIZE)
83 Common::copy(&_data[_topIndex], &_data[0] + MAX_SIZE, &_data[0]);
93 assert(
size() < MAX_SIZE);
103 return _data[_topIndex];
111 return _data[_topIndex];
128 return _data[_topIndex + i];
136 return _data[_topIndex + i];
void push(const T &v)
Definition: fixed_queue.h:92
void clear()
Definition: fixed_queue.h:71
void clear()
Definition: array.h:320
size_type freeSize() const
Definition: fixed_queue.h:52
const T & operator[](size_type i) const
Definition: fixed_queue.h:134
bool full() const
Definition: fixed_queue.h:64
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
size_type size() const
Definition: fixed_queue.h:47
void push_back(const T &element)
Definition: array.h:180
T & top()
Definition: fixed_queue.h:109
void reserve(size_type newCapacity)
Definition: array.h:396
T & operator[](size_type i)
Definition: fixed_queue.h:126
const T & top() const
Definition: fixed_queue.h:101
size_type size() const
Definition: array.h:315
bool empty() const
Definition: fixed_queue.h:57
void resize(size_type newSize)
Definition: array.h:411
Definition: fixed_queue.h:34
T pop()
Definition: fixed_queue.h:117
void compact()
Definition: fixed_queue.h:80