30 #ifdef CONTAINER_STATS 42 #ifdef CONTAINER_STATS 55 #ifdef CONTAINER_STATS 69 #ifdef CONTAINER_STATS 84 #ifdef CONTAINER_STATS 86 mUsedRam-=GetUsedRam();
99 #ifdef CONTAINER_STATS 100 mUsedRam-=mMaxNbEntries*
sizeof(
udword);
103 mCurNbEntries = mMaxNbEntries = 0;
116 #ifdef CONTAINER_STATS 118 mUsedRam-=mMaxNbEntries*
sizeof(
udword);
122 mMaxNbEntries = mMaxNbEntries ?
udword(
float(mMaxNbEntries)*mGrowthFactor) : 2;
123 if(mMaxNbEntries<mCurNbEntries + needed) mMaxNbEntries = mCurNbEntries + needed;
126 udword* NewEntries =
new udword[mMaxNbEntries];
129 #ifdef CONTAINER_STATS 131 mUsedRam+=mMaxNbEntries*
sizeof(
udword);
135 if(mCurNbEntries)
CopyMemory(NewEntries, mEntries, mCurNbEntries*
sizeof(udword));
141 mEntries = NewEntries;
159 if(!nb)
return false;
165 mEntries =
new udword[mMaxNbEntries];
168 #ifdef CONTAINER_STATS 170 mUsedRam+=mMaxNbEntries*
sizeof(
udword);
183 #ifdef CONTAINER_STATS 185 mUsedRam-=mMaxNbEntries*
sizeof(
udword);
189 mMaxNbEntries = mCurNbEntries;
190 if(!mMaxNbEntries)
return false;
193 udword* NewEntries =
new udword[mMaxNbEntries];
196 #ifdef CONTAINER_STATS 198 mUsedRam+=mMaxNbEntries*
sizeof(
udword);
202 CopyMemory(NewEntries, mEntries, mCurNbEntries*
sizeof(udword));
208 mEntries = NewEntries;
227 for(udword
i=0;
i<mCurNbEntries;
i++)
229 if(mEntries[
i]==entry)
231 if(location) *location =
i;
249 for(udword
i=0;
i<mCurNbEntries;
i++)
251 if(mEntries[
i]==entry)
272 for(udword
i=0;
i<mCurNbEntries;
i++)
274 if(mEntries[
i]==entry)
279 for(udword j=
i;j<mCurNbEntries;j++)
281 mEntries[j] = mEntries[j+1];
303 if(Location==mCurNbEntries) Location = find_mode==
FIND_WRAP ? 0 : mCurNbEntries-1;
304 entry = mEntries[Location];
323 if(Location==0xffffffff) Location = find_mode==
FIND_WRAP ? mCurNbEntries-1 : 0;
324 entry = mEntries[Location];
337 return sizeof(
Container) + mMaxNbEntries *
sizeof(udword);
#define null
our own NULL pointer
udword GetUsedRam() const
bool Resize(udword needed=1)
#define DELETEARRAY(x)
Deletes an array.
inline_ bool Contains(const Point &p) const
unsigned int udword
sizeof(udword) must be 4
static udword mUsedRam
Amount of bytes used by containers in the system.
bool Contains(udword entry, udword *location=null) const
bool DeleteKeepingOrder(udword entry)
png_infop int int location
inline_ void CopyMemory(void *dest, const void *src, udword size)
Container & FindNext(udword &entry, FindMode find_mode=FIND_CLAMP)
static udword mNbContainers
Number of containers around.
Container & FindPrev(udword &entry, FindMode find_mode=FIND_CLAMP)
bool Delete(udword entry)