1 #ifndef COIN_LISTS_SBPLIST_H
2 #define COIN_LISTS_SBPLIST_H
27 #include <Inventor/SbBasic.h>
32 enum { DEFAULTSIZE = 4 };
35 SbPList(
const int sizehint = DEFAULTSIZE);
43 void append(
void * item);
44 int find(
void * item)
const;
45 void insert(
void * item,
const int insertbefore);
46 void removeItem(
void * item);
47 void remove(
const int index);
48 void removeFast(
const int index);
49 int getLength(
void)
const;
50 void truncate(
const int length,
const int fit = 0);
52 void ** getArrayPtr(
const int start = 0)
const;
53 void *& operator[](
const int index)
const;
55 int operator==(
const SbPList & l)
const;
56 int operator!=(
const SbPList & l)
const;
57 void *
get(
const int index)
const;
58 void set(
const int index,
void * item);
62 void expand(
const int size);
63 int getArraySize(
void)
const;
66 void expandlist(
const int size)
const;
67 void grow(
const int size = -1);
72 void * builtinbuffer[DEFAULTSIZE];
80 if (this->numitems == this->itembuffersize) this->grow();
81 this->itembuffer[this->numitems++] = item;
87 #ifdef COIN_EXTRA_DEBUG
88 assert(index >= 0 && index < this->numitems);
89 #endif // COIN_EXTRA_DEBUG
90 this->itembuffer[index] = this->itembuffer[--this->numitems];
96 return this->numitems;
102 #ifdef COIN_EXTRA_DEBUG
103 assert(length <= this->numitems);
104 #endif // COIN_EXTRA_DEBUG
105 this->numitems = length;
106 if (dofit) this->
fit();
112 #ifdef COIN_EXTRA_DEBUG
113 assert(start >= 0 && start < this->numitems);
114 #endif // COIN_EXTRA_DEBUG
115 return &this->itembuffer[start];
121 #ifdef COIN_EXTRA_DEBUG
123 #endif // COIN_EXTRA_DEBUG
124 if (index >= this->
getLength()) this->expandlist(index + 1);
125 return this->itembuffer[index];
131 return !(*
this == l);
137 return this->itembuffer[index];
143 this->itembuffer[index] = item;
150 this->numitems = size;
156 return this->itembuffersize;
160 #endif // !COIN_LISTS_SBPLIST_H