47 #ifdef __INTEL_COMPILER
49 template<
class type >
55 template<
class type >
66 template<
class type >
76 template<
class type >
83 template<
class type >
90 idList(
int newgranularity = 16 );
95 int Num(
void )
const;
101 size_t Size(
void )
const;
109 void Resize(
int newsize );
110 void Resize(
int newsize,
int newgranularity );
111 void SetNum(
int newnum,
bool resize =
true );
117 const type *
Ptr(
void )
const;
129 void Sort(
cmp_t *compare = (
cmp_t * )&idListSortCompare<type> );
146 template<
class type >
148 assert( newgranularity > 0 );
151 granularity = newgranularity;
160 template<
class type >
171 template<
class type >
183 template<
class type >
206 template<
class type >
210 for( i = 0; i <
num; i++ ) {
218 memset( list, 0,
size *
sizeof(
type ) );
229 template<
class type >
241 template<
class type >
251 template<
class type >
253 return num *
sizeof( *list );
264 template<
class type >
276 template<
class type >
288 template<
class type >
291 if ( resize || newnum >
size ) {
304 template<
class type >
308 assert( newgranularity > 0 );
309 granularity = newgranularity;
313 newsize =
num + granularity - 1;
314 newsize -= newsize % granularity;
315 if ( newsize !=
size ) {
328 template<
class type >
340 template<
class type >
359 template<
class type >
367 if ( newsize <= 0 ) {
372 if ( newsize ==
size ) {
385 for( i = 0; i <
num; i++ ) {
386 list[
i ] = temp[
i ];
403 template<
class type >
410 assert( newgranularity > 0 );
411 granularity = newgranularity;
414 if ( newsize <= 0 ) {
427 for( i = 0; i <
num; i++ ) {
428 list[
i ] = temp[
i ];
444 template<
class type >
446 int newNum = newSize;
448 if ( newSize >
size ) {
450 if ( granularity == 0 ) {
454 newSize += granularity - 1;
455 newSize -= newSize % granularity;
469 template<
class type >
471 int newNum = newSize;
473 if ( newSize >
size ) {
475 if ( granularity == 0 ) {
479 newSize += granularity - 1;
480 newSize -= newSize % granularity;
484 for (
int i =
num;
i < newSize;
i++ ) {
502 template<
class type >
504 int newNum = newSize;
506 if ( newSize >
size ) {
508 if ( granularity == 0 ) {
512 newSize += granularity - 1;
513 newSize -= newSize % granularity;
517 for (
int i =
num;
i < newSize;
i++ ) {
518 list[
i] = (*allocator)();
532 template<
class type >
544 for( i = 0; i <
num; i++ ) {
545 list[
i ] = other.
list[
i ];
560 template<
class type >
565 return list[
index ];
576 template<
class type >
581 return list[
index ];
595 template<
class type >
611 template<
class type >
623 template<
class type >
626 Resize( granularity );
630 Resize(
size + granularity );
633 return list[
num++ ];
645 template<
class type >
648 Resize( granularity );
654 if ( granularity == 0 ) {
657 newsize =
size + granularity;
658 Resize( newsize - newsize % granularity );
678 template<
class type >
681 Resize( granularity );
687 if ( granularity == 0 ) {
690 newsize =
size + granularity;
691 Resize( newsize - newsize % granularity );
697 else if ( index >
num ) {
717 template<
class type >
720 if ( granularity == 0 ) {
723 Resize( granularity );
727 for (
int i = 0;
i <
n;
i++) {
741 template<
class type >
745 index = FindIndex( obj );
747 index = Append( obj );
760 template<
class type >
764 for( i = 0; i <
num; i++ ) {
765 if ( list[ i ] == obj ) {
781 template<
class type >
785 i = FindIndex( obj );
803 template<
class type >
807 for( i = 0; i <
num; i++ ) {
808 if ( list[ i ] ==
NULL ) {
827 template<
class type >
831 index = objptr - list;
848 template<
class type >
856 if ( ( index < 0 ) || ( index >=
num ) ) {
861 for( i = index; i <
num; i++ ) {
862 list[
i ] = list[ i + 1 ];
877 template<
class type >
881 index = FindIndex( obj );
883 return RemoveIndex( index );
897 template<
class type >
902 typedef int cmp_c(
const void *,
const void *);
904 cmp_c *vCompare = (cmp_c *)compare;
905 qsort( (
void * )list, (
size_t )
num,
sizeof(
type ), vCompare );
915 template<
class type >
920 if ( startIndex < 0 ) {
923 if ( endIndex >=
num ) {
926 if ( startIndex >= endIndex ) {
929 typedef int cmp_c(
const void *,
const void *);
931 cmp_c *vCompare = (cmp_c *)compare;
932 qsort( (
void * )( &list[startIndex] ), (
size_t )( endIndex - startIndex + 1 ),
sizeof(
type ), vCompare );
942 template<
class type >
void SortSubSection(int startIndex, int endIndex, cmp_t *compare=(cmp_t *)&idListSortCompare< type >)
assert(prefInfo.fullscreenBtn)
idList< type > & operator=(const idList< type > &other)
void SetNum(int newnum, bool resize=true)
void Swap(idList< type > &other)
void AssureSize(int newSize)
int GetGranularity(void) const
void SetGranularity(int newgranularity)
GLuint GLuint GLsizei GLenum type
void Sort(cmp_t *compare=(cmp_t *)&idListSortCompare< type >)
int cmp_t(const type *, const type *)
ID_INLINE int idListSortCompare(const type *a, const type *b)
type * Find(type const &obj) const
size_t Allocated(void) const
void DeleteContents(bool clear)
GLubyte GLubyte GLubyte a
void AssureSizeAlloc(int newSize, new_t *allocator)
ID_INLINE void idSwap(type &a, type &b)
int Insert(const type &obj, int index=0)
int Append(const type &obj)
int AddUnique(const type &obj)
bool RemoveIndex(int index)
int IndexOf(const type *obj) const
int NumAllocated(void) const
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
ID_INLINE type * idListNewElement(void)
int FindIndex(const type &obj) const
idList(int newgranularity=16)
bool Remove(const type &obj)
const type & operator[](int index) const
size_t MemoryUsed(void) const