53 int getSize (
void)
const {
return m_size; }
60 void clear (
void) { m_items.
clear(); m_size = 0; m_free = -1; }
75 T&
addLast (
const T& item) { T& slot =
addLast(); slot = item;
return slot; }
87 void freeItem (
int idx);
103 for (
int i = 0; i <
size; i++)
106 m_items[i].value = ptr[i];
107 m_items[i].prev = i - 1;
108 m_items[i].next = i + 1;
123 m_items = other.m_items;
124 m_size = other.m_size;
125 m_first = other.m_first;
126 m_last = other.m_last;
127 m_free = other.m_free;
135 FW_ASSERT(start >= 0 && start <= end && end <= getSize());
138 for (
int i = 0; i < start; i++)
139 src = m_items[src].next;
141 T* dst = res.
add(
NULL, end - start);
142 for (
int i = start; i < end; i++)
144 *dst++ = m_items[src].value;
145 src = m_items[src].next;
153 FW_ASSERT(start >= 0 && start <= end && end <= getSize());
156 getRange(res, start, end);
164 int idx = allocItem();
169 m_items[idx].next = m_first;
170 m_items[m_first].prev = idx;
173 return m_items[idx].value;
180 int idx = allocItem();
185 m_items[idx].prev = m_last;
186 m_items[m_last].next = idx;
189 return m_items[idx].value;
198 m_first = m_items[idx].next;
200 return m_items[idx].value;
209 m_last = m_items[idx].prev;
211 return m_items[idx].value;
218 if (m_size != other.m_size)
222 int idxB = other.m_first;
223 for (
int i = 0; i < m_size; i++)
225 if (m_items[idxA].
value != other.m_items[idxB].value)
227 idxA = m_items[idxA].next;
228 idxB = other.m_items[idxB].next;
239 m_free = m_items[idx].next;
251 template <
class T>
void Deque<T>::freeItem(
int idx)
253 m_items[idx].next = m_free;
Deque(const Array< T > &other)
Deque(const Deque< T > &other)
bool operator==(const Deque< T > &other) const
T & addFirst(const T &item)
const T & getFirst(void) const
Array< T > getAll(void) const
void setCapacity(int capacity)
Deque< T > & operator=(const Deque< T > &other)
bool operator!=(const Deque< T > &other) const
T & addLast(const T &item)
void setCapacity(S numElements)
void getAll(Array< T > &res) const
Deque(const T *ptr, int size)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value
void getRange(Array< T > &res, int start, int end) const
void set(const T *ptr, int size)
void set(const Array< T > &other)
const T & getLast(void) const
const T * getPtr(S32idx=0) const
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr size