19 #ifndef DETOURALLOCATOR_H
20 #define DETOURALLOCATOR_H
22 #include <AtomsUtils/Globals.h>
61 ATOMSUTILS_EXPORT
void dtFree(
void* ptr);
63 void dtMemCpy(
void* dst,
void* src,
int size);
70 inline T* operator=(T* p);
84 inline operator T*() {
return ptr; }
85 inline T* get() {
return ptr; }
111 inline void push(
int item) {
resize(m_size+1); m_data[m_size-1] = item; }
115 inline int pop() {
if (m_size > 0) m_size--;
return m_data[m_size]; }
120 inline const int&
operator[](
int i)
const {
return m_data[i]; }
128 inline int size()
const {
return m_size; }
130 inline int* getData()
const {
return m_data; }
134 bool contains(
int v)
const
136 for (
int i = 0; i < m_size; i++)
168 inline void push(T item) {
resize(m_size+1); m_data[m_size-1] = item; }
172 inline T
pop() {
if (m_size > 0) m_size--;
return m_data[m_size]; }
177 inline const T&
operator[](
int i)
const {
return m_data[i]; }
185 inline int size()
const {
return m_size; }
193 if (!m_cap) m_cap = n;
194 while (m_cap < n) m_cap += 32;
196 if (m_size && newData) dtMemCpy(newData, m_data, m_size*
sizeof(T));
A simple dynamic array of integers.
Definition: DetourAlloc.h:147
void push(T item)
Definition: DetourAlloc.h:168
void resize(int n)
Definition: DetourAlloc.h:189
T & operator[](int i)
Definition: DetourAlloc.h:182
dtChunkArray(int n)
Definition: DetourAlloc.h:159
T pop()
Definition: DetourAlloc.h:172
dtChunkArray()
Constructs an instance with an initial array size of zero.
Definition: DetourAlloc.h:155
const T & operator[](int i) const
Definition: DetourAlloc.h:177
int size() const
The current size of the integer array.
Definition: DetourAlloc.h:185
A simple dynamic array of integers.
Definition: DetourAlloc.h:90
int size() const
The current size of the integer array.
Definition: DetourAlloc.h:128
int pop()
Definition: DetourAlloc.h:115
int & operator[](int i)
Definition: DetourAlloc.h:125
dtIntArray(int n)
Definition: DetourAlloc.h:102
const int & operator[](int i) const
Definition: DetourAlloc.h:120
dtIntArray()
Constructs an instance with an initial array size of zero.
Definition: DetourAlloc.h:98
void push(int item)
Definition: DetourAlloc.h:111
Definition: DetourAlloc.h:68
dtScopedDelete(T *p)
Definition: DetourAlloc.h:79
dtScopedDelete()
Constructs an instance with a null pointer.
Definition: DetourAlloc.h:74
AtomsCore namespace.
Definition: Base64.h:13
ATOMSUTILS_EXPORT void * dtAlloc(int size, dtAllocHint hint)
dtAllocHint
Definition: DetourAlloc.h:29
@ DT_ALLOC_TEMP
Memory used temporarily within a function.
Definition: DetourAlloc.h:31
@ DT_ALLOC_PERM
Memory persist after a function call.
Definition: DetourAlloc.h:30
void() dtFreeFunc(void *ptr)
Definition: DetourAlloc.h:44
ATOMSUTILS_EXPORT void dtFree(void *ptr)
ATOMSUTILS_EXPORT void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc)
void *() dtAllocFunc(int size, dtAllocHint hint)
A memory allocation function.
Definition: DetourAlloc.h:39