1#ifndef COIN_LISTS_SBPLIST_H
2#define COIN_LISTS_SBPLIST_H
36#include <Inventor/SbBasic.h>
41 enum { DEFAULTSIZE = 4 };
56 void remove(
const int index);
66 void * get(
const int index)
const;
67 void set(
const int index,
void *
item);
71 void expand(
const int size);
75 static void invalidIndex(
const char * operation);
76 void expandindex(
const int index)
const;
77 void expandlist(
const int size)
const;
78 void grow(
const int size = -1);
83 void * builtinbuffer[DEFAULTSIZE];
91 if (this->numitems == this->itembuffersize) this->grow();
92 this->itembuffer[this->numitems++] =
item;
99 SbPList::invalidIndex(
"SbPList::removeFast(): index out of range");
101 this->itembuffer[index] = this->itembuffer[--this->numitems];
107 return this->numitems;
114 SbPList::invalidIndex(
"SbPList::truncate(): length out of range");
116 this->numitems = length;
123 if (start < 0 || (this->numitems == 0 ? start != 0 : start >= this->numitems)) {
124 SbPList::invalidIndex(
"SbPList::getArrayPtr(): index out of range");
126 return &this->itembuffer[start];
133 SbPList::invalidIndex(
"SbPList::operator[](): index out of range");
135 if (index >= this->
getLength()) this->expandindex(index);
136 return this->itembuffer[index];
142 return !(*
this ==
l);
149 SbPList::invalidIndex(
"SbPList::get(): index out of range");
151 return this->itembuffer[index];
158 SbPList::invalidIndex(
"SbPList::set(): index out of range");
160 this->itembuffer[index] =
item;
167 this->numitems = size;
173 return this->itembuffersize;
The SbList class is a template container class for lists.
Definition SbList.h:74
void truncate(const int length, const int dofit=0)
Definition SbList.h:195
int getLength(void) const
Definition SbList.h:191
int find(const Type item) const
Definition SbList.h:146
SbList< Type > & operator=(const SbList< Type > &l)
Definition SbList.h:112
void removeFast(const int index)
Definition SbList.h:182
int operator!=(const SbList< Type > &l) const
Definition SbList.h:245
int getArraySize(void) const
Definition SbList.h:266
const Type * getArrayPtr(const int start=0) const
Definition SbList.h:216
void remove(const int index)
Definition SbList.h:172
void removeItem(const Type item)
Definition SbList.h:164
int operator==(const SbList< Type > &l) const
Definition SbList.h:237
void copy(const SbList< Type > &l)
Definition SbList.h:96
void fit(void)
Definition SbList.h:117
void insert(const Type item, const int insertbefore)
Definition SbList.h:152
void append(const Type item)
Definition SbList.h:140
void expand(const int size)
Definition SbList.h:258
Type operator[](const int index) const
Definition SbList.h:223
The SbPList class is a container class for void pointers.
Definition lists/SbPList.h:40
void ** getArrayPtr(const int start=0) const
Definition lists/SbPList.h:121
void set(const int index, void *item)
Definition lists/SbPList.h:155
void expand(const int size)
Definition lists/SbPList.h:164
void * get(const int index) const
Definition lists/SbPList.h:146
int operator!=(const SbPList &l) const
Definition lists/SbPList.h:140
void append(void *item)
Definition lists/SbPList.h:89
int getLength(void) const
Definition lists/SbPList.h:105
void fit(void)
Definition SbPList.cpp:216
void removeFast(const int index)
Definition lists/SbPList.h:96
void *& operator[](const int index) const
Definition lists/SbPList.h:130
int getArraySize(void) const
Definition lists/SbPList.h:171
void truncate(const int length, const int fit=0)
Definition lists/SbPList.h:111