1 #ifndef COIN_LISTS_SBPLIST_H 2 #define COIN_LISTS_SBPLIST_H 36 #include <Inventor/SbBasic.h> 41 enum { DEFAULTSIZE = 4 };
44 SbPList(
const int sizehint = DEFAULTSIZE);
52 void append(
void * item);
53 int find(
const void * item)
const;
54 void insert(
void * item,
const int insertbefore);
55 void removeItem(
void * item);
56 void remove(
const int index);
57 void removeFast(
const int index);
58 int getLength(
void)
const;
59 void truncate(
const int length,
const int fit = 0);
61 void ** getArrayPtr(
const int start = 0)
const;
62 void *& operator[](
const int index)
const;
64 int operator==(
const SbPList & l)
const;
65 int operator!=(
const SbPList & l)
const;
66 void *
get(
const int index)
const;
67 void set(
const int index,
void * item);
71 void expand(
const int size);
72 int getArraySize(
void)
const;
75 void expandlist(
const int size)
const;
76 void grow(
const int size = -1);
81 void * builtinbuffer[DEFAULTSIZE];
89 if (this->numitems == this->itembuffersize) this->grow();
90 this->itembuffer[this->numitems++] = item;
96 #ifdef COIN_EXTRA_DEBUG 97 assert(index >= 0 && index < this->numitems);
98 #endif // COIN_EXTRA_DEBUG 99 this->itembuffer[index] = this->itembuffer[--this->numitems];
105 return this->numitems;
111 #ifdef COIN_EXTRA_DEBUG 112 assert(length <= this->numitems);
113 #endif // COIN_EXTRA_DEBUG 114 this->numitems = length;
115 if (dofit) this->
fit();
121 #ifdef COIN_EXTRA_DEBUG 122 assert(start >= 0 && start < this->numitems);
123 #endif // COIN_EXTRA_DEBUG 124 return &this->itembuffer[start];
130 #ifdef COIN_EXTRA_DEBUG 132 #endif // COIN_EXTRA_DEBUG 133 if (index >= this->
getLength()) this->expandlist(index + 1);
134 return this->itembuffer[index];
140 return !(*
this == l);
146 return this->itembuffer[index];
152 this->itembuffer[index] = item;
159 this->numitems = size;
165 return this->itembuffersize;
169 #endif // !COIN_LISTS_SBPLIST_H void fit(void)
Definition: SbPList.cpp:199
void removeFast(const int index)
Definition: lists/SbPList.h:94
void ** getArrayPtr(const int start=0) const
Definition: lists/SbPList.h:119
void * get(const int index) const
Definition: lists/SbPList.h:144
The SbPList class is a container class for void pointers.
Definition: lists/SbPList.h:40
void append(void *item)
Definition: lists/SbPList.h:87
int operator!=(const SbPList &l) const
Definition: lists/SbPList.h:138
void *& operator[](const int index) const
Definition: lists/SbPList.h:128
void set(const int index, void *item)
Definition: lists/SbPList.h:150
void expand(const int size)
Definition: lists/SbPList.h:156
void truncate(const int length, const int fit=0)
Definition: lists/SbPList.h:109
int getLength(void) const
Definition: lists/SbPList.h:103
int getArraySize(void) const
Definition: lists/SbPList.h:163