Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
dimeArray< T > Class Template Reference

The dimeArray class is internal / private. More...

#include <dime/util/Array.h>

Public Member Functions

 dimeArray (const int initsize=4)
 
void append (const T &value)
 
void append (const dimeArray< T > &array)
 
void prepend (const dimeArray< T > &array)
 
void insertElem (const int idx, const T &value)
 
void setElem (const int index, const T &value)
 
getElem (const int index) const
 
void getElem (const int index, T &elem) const
 
getLastElem () const
 
void getLastElem (T &elem) const
 
T & operator[] (const int index)
 
operator[] (const int index) const
 
void removeElem (const int index)
 
void removeElemFast (const int index)
 
void reverse ()
 
void setCount (const int count)
 
void makeEmpty (const int initsize=4)
 
void freeMemory ()
 
int count () const
 
int allocSize () const
 
T * arrayPointer ()
 
const T * constArrayPointer () const
 
void shrinkToFit ()
 

Detailed Description

template<class T>
class dimeArray< T >

The dimeArray class is internal / private.

The dimeArray class is a container class for a growable array. Whenever the allocated space for the array becomes too small, the array is moved to a memory block that is twice as large. This class is dangerous to use, because it does not check for bounds and other things for efficiency reasons. Inspect the source code - don't assume anything...

Member Function Documentation

◆ removeElem()

template<class T >
void dimeArray< T >::removeElem ( const int  index)
inline

This method removes an element from the array, moving all subsequent elements one position up.

◆ removeElemFast()

template<class T >
void dimeArray< T >::removeElemFast ( const int  index)
inline

This method removes an element from the array, and moves the last element into its place at the same index. The order of the elements is distorted, in other words.

◆ setCount()

template<class T >
void dimeArray< T >::setCount ( const int  count)
inline

This method sets the logical size of the array to count without changing the size of the array. Do not increase the array size with this function! This method is useful for reusing an array that will grow to approximately the same size each time it is used.

◆ makeEmpty()

template<class T >
void dimeArray< T >::makeEmpty ( const int  initsize = 4)
inline

This method makes the logical array empty, and deallocates the memory used by it, only allocating space for a small array of size initsize.

◆ freeMemory()

template<class T >
void dimeArray< T >::freeMemory ( )
inline

This method frees all the memory used by the class. The dimeArray class is probably unusable afterwards.

◆ count()

template<class T >
int dimeArray< T >::count ( ) const
inline

This method returns the number of elements in the array.

◆ allocSize()

template<class T >
int dimeArray< T >::allocSize ( ) const
inline

This method returns the size allocated for the array.

◆ arrayPointer()

template<class T >
T * dimeArray< T >::arrayPointer ( )
inline

This method returns a pointer to the allocated array.

◆ constArrayPointer()

template<class T >
const T * dimeArray< T >::constArrayPointer ( ) const
inline

This method returns a pointer to the allocated array.

◆ shrinkToFit()

template<class T >
void dimeArray< T >::shrinkToFit ( )
inline

This method moves the array into a memory block exactly the same size of the array. This will free up any overhead caused by the array doubling mechanism.


The documentation for this class was generated from the following files: