22#ifndef TITANIC_FIXED_QUEUE_H
23#define TITANIC_FIXED_QUEUE_H
25#include "common/scummsys.h"
26#include "common/array.h"
33template<
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 reserve(size_type newCapacity)
Definition: array.h:397
size_type size() const
Definition: array.h:316
void clear()
Definition: array.h:321
void push_back(const T &element)
Definition: array.h:181
void resize(size_type newSize)
Definition: array.h:412
Definition: fixed_queue.h:34
T & top()
Definition: fixed_queue.h:109
void clear()
Definition: fixed_queue.h:71
T pop()
Definition: fixed_queue.h:117
bool empty() const
Definition: fixed_queue.h:57
void compact()
Definition: fixed_queue.h:80
size_type freeSize() const
Definition: fixed_queue.h:52
size_type size() const
Definition: fixed_queue.h:47
void push(const T &v)
Definition: fixed_queue.h:92
const T & top() const
Definition: fixed_queue.h:101
const T & operator[](size_type i) const
Definition: fixed_queue.h:134
T & operator[](size_type i)
Definition: fixed_queue.h:126
bool full() const
Definition: fixed_queue.h:64
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52