11 #ifndef __GA_TempBuffer__
12 #define __GA_TempBuffer__
27 #define GA_TEMP_BUFFER_SIZE 32
51 if (myData != myBuffer)
69 if (size > myCapacity)
79 if (mySize == myCapacity)
81 myData[mySize] =
value;
101 return myData[mySize-1];
110 return myData[mySize];
114 mySize =
SYSmin(mySize, sz);
120 for (s = d = 0; s < mySize; ++
s)
122 if (myData[s] != value)
125 myData[d] = myData[
s];
137 for (
exint i = index+1; i < mySize; ++i)
138 myData[i-1] = myData;
142 const T *
data()
const {
return myData; }
153 UTswap(myData[i0], myData[i1]);
157 void growBuffer(
GA_Size nsize=-1)
160 nsize =
SYSmax(nsize, UTbumpAlloc(myCapacity+1));
161 if (myData == myBuffer)
164 myData = (
T *)malloc(
sizeof(
T)*nsize);
165 memcpy(myData, myBuffer,
sizeof(
T)*myCapacity);
169 myData = (
T *)realloc(myData,
sizeof(
T)*nsize);
void setValue(GA_Size i, const T &value)
Set an item in the buffer to the given value.
void truncate(GA_Size sz)
GLsizei const GLfloat * value
GA_Size entries() const
How many elements in the buffer.
exint GA_Size
Defines the bit width for index and offset types in GA.
void clear()
Clear all entries.
const T & getValue(GA_Size i) const
exint removeMatchingItems(const T &value)
const T & removeLast()
Return the last entry and remove it from the list.
GA_Size getCapacity() const
Query the reserved capacity.
void removeIndex(exint index)
void reserve(GA_Size size, bool setsize=false)
Reserve storage.
void swap(GA_Size i0, GA_Size i1)
const T & operator()(GA_Size i) const
void append(const T &value)
Append an element to the array.
#define GA_TEMP_BUFFER_SIZE