49 ptrsSize = pl.ptrsSize;
50 ptrs =
new Type[ptrsSize];
52 for(
int i = 0; i < nPtrs; i++)
63 if(nPtrs + 1 > ptrsSize) expand(nPtrs + 1);
64 ptrs[nPtrs++] = value;
68 int find(
const Type &value)
const {
69 for(
int i = 0; i < nPtrs; i++)
77 void insert(
const Type &value,
int addBefore) {
80 if(addBefore > nPtrs) grow(addBefore);
86 for(
int i = nPtrs - 1; i > addBefore; --i)
87 ptrs[i] = ptrs[i - 1];
90 ptrs[addBefore] = value;
96 for(
int i = which; i < nPtrs - 1; i++)
97 ptrs[i] = ptrs[i + 1];
118 for(
int i = 0; i < nPtrs; i++)
119 ptrs[i] = pl.ptrs[i];
123 copy(pl);
return *
this;
128 if(i >= nPtrs) grow(i);
134 return pl.nPtrs == nPtrs ? compare(pl) : FALSE;
137 return pl.nPtrs == nPtrs ? ! compare(pl) : TRUE;
146 void set(
int i,
void *j) {
154 int compare(
const SbList &pl)
const {
155 for(
int i = 0; i < nPtrs; i++)
156 if((*
this)[i] != pl[i])
169 void grow(
int max)
const {
174 if(newSize <= oldSize)
175 SoDebugError::post(
"(internal) SbList::grow",
"newSize <= oldSize!");
181 me->setSize(newSize);
183 for(
int i = oldSize; i < newSize; i++)
189 void setSize(
int size) {
190 if(size > ptrsSize) expand(size);
196 void expand(
int size) {
200 while(size > ptrsSize) {
203 int oldPtrsSize = ptrsSize;
205 if(ptrsSize < oldPtrsSize)
206 SoDebugError::post(
"SbList::expand",
"Attempt to expand list beyond capacity;\n A core dump is likely");
212 Type *newPtrs =
new Type[ptrsSize];
214 if(ptrs !=
nullptr) {
215 for(
int i = 0; i < nPtrs; i++)
216 newPtrs[i] = ptrs[i];
This contains the definition of the SbList generic pointer list class; an SbList is a list of (void *...
SbList & operator=(const SbList &pl)
void append(const Type &value)
Type & operator[](int i) const
int operator==(const SbList &pl) const
void copy(const SbList &pl)
int find(const Type &value) const
int operator!=(const SbList &pl) const
void insert(const Type &value, int addBefore)