30#include <Inventor/STL/vector>
32#define PO_ARRAY_HEADER(className,valueType) \
48 className(
int init_size,
int extend=10); \
54 const valueType*
get()
const; \
57 valueType
get(
int index)
const; \
60 int find(valueType val)
const; \
63 void set(
int index, valueType val); \
66 int add(valueType val); \
69 int add(
int num_val,
const valueType* val); \
85 const valueType&
operator[](
int index)
const; \
92 {
return !(array_1 == array_2); } \
118 valueType *m_array; \
119 int m_allocatedSize; \
122 valueType *resize(
int sz); \
128inline const valueType* \
129className::get()
const {
return m_array;} \
133className::get(
int index)
const {
return m_array[index];} \
137className::find(valueType val)
const { \
138 for (
int i=0; i<=m_lastInd; i++)
if (m_array[i]==val)
return i; \
145className::set(
int index, valueType val) \
147 if ( index >= m_allocatedSize )
resize(index+1); \
148 m_array[index] = val; \
149 if ( index > m_lastInd ) m_lastInd = index; \
155className::add(valueType val) \
158 if ( m_lastInd >= m_allocatedSize )
resize(m_lastInd+1); \
159 m_array[m_lastInd] = val; \
166className::operator+=(valueType val) \
173inline const valueType& \
176 return m_array[index]; \
185 if (index > m_lastInd) m_lastInd = index; \
186 return m_array[index]; \
192className::getCapacity()
const {
return m_allocatedSize;} \
197className::getNum()
const {
return m_lastInd+1;} \
203className::empty() {m_lastInd = -1;}
virtual void resize(const size_t newSize)
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> CPUBufferObject ...
int add(valueType val)
Inserts valueType value at the end of the array.
void setCapacity(int capacity, int extend)
set the capacity and allocate this capacity if necessary
int getNum() const
Gets the number of values in the array.
const valueType * get() const
Gets the adress of the internal array.
void increasingSort()
Sorts array by increasing order.
void empty()
After empty, the array appears like no valueType value has been previously inserted.
int getCapacity() const
Gets the allocated size of the array.
friend int operator==(const className &array_1, const className &array_2)
Equality comparison operator.
className & operator=(const className &other_array)
Copy from other_array.
friend int operator!=(const className &array_1, const className &array_2)
Inequality comparison operator.
int find(valueType val) const
Finds the first index in the array of a given valueType value (-1 if not found).
className & operator=(const std::vector< valueType > &other_array)
Copy from an STL vector.
void decreasingSort()
Sorts array by decreasing order.
void operator+=(const className &other_array)
Appends other_array to the end of the array.
int add(int num_val, const valueType *val)
Inserts a list of valueType values at the end of the array.
void set(int index, valueType val)
Inserts valueType value at a specified position in the array.
valueType & operator[](int index)