Public Member Functions | Protected Member Functions | Protected Attributes

PtrVector Class Reference

Search for all occurrences

Detailed Description

class PtrVector

Description:
This class is available in release 4.0 and later only.

This class represents a variable length array of pointers which can be stored and manipulated.
Data Members:
protected:

int size;

The size of the array.

int nused;

The number of elements used.

void** data;

The variable length data.
protected:

#include <ptrvec.h>

Inheritance diagram for PtrVector:
Inheritance graph
[legend]

List of all members.

Public Member Functions

UtilExport void  reshape (int i)
UtilExport void  setLength (int i)
UtilExport void  clear ()
void  shrink ()
int  length () const
int  capacity () const

Protected Member Functions

  PtrVector ()
UtilExport  ~PtrVector ()
UtilExport  PtrVector (const PtrVector &v)
UtilExport PtrVector operator= (const PtrVector &v)
UtilExport void  append (void *ptr, int extra)
UtilExport void  insertAt (void *ptr, int at, int extra)
UtilExport void *  remove (int i)
UtilExport void *  removeLast ()
void *  operator[] (int i) const
void *&  operator[] (int i)

Protected Attributes

int  size
int  nused
void **  data

Constructor & Destructor Documentation

PtrVector ( ) [inline, protected]
Remarks:
Constructor.
Default Implementation:
{ size = nused = 0; data = NULL; }
{ size = nused = 0; data = NULL; }
UtilExport ~PtrVector ( ) [protected]
Remarks:
Destructor.
UtilExport PtrVector ( const PtrVector v ) [protected]
Remarks:
Constructor.
Parameters:
const PtrVector& v

Reference to the PtrVector class to initialize with.

Member Function Documentation

UtilExport PtrVector& operator= ( const PtrVector v ) [protected]
Remarks:
Assignment operator.
Parameters:
const PtrVector& v

The reference to the PtrVector to assign.
UtilExport void append ( void *  ptr,
int  extra 
) [protected]
Remarks:
This method allows you to append data to the array.
Parameters:
void *ptr

A pointer to the data to add.

int extra

The extra space you wish to reserve. This will reshape the size of the array to nused + extra.
UtilExport void insertAt ( void *  ptr,
int  at,
int  extra 
) [protected]
Remarks:
This method allows you to insert data at a specified location.
Parameters:
void *ptr

A pointer to the data to add.

int at

The index in the array you wish to insert at.

int extra

The extra space you wish to reserve. This will reshape the size of the array to nused + extra.
UtilExport void* remove ( int  i ) [protected]
Remarks:
This method allows you to remove an element from the array.
Parameters:
int i

The index of the element in the array you wish to remove.
Returns:
A pointer to the next element in the array.

Reimplemented in PtrVec< T >.

UtilExport void* removeLast ( ) [protected]
Remarks:
This method allows you to remove the last element in the array.
Returns:
A pointer to the new last element in the array.

Reimplemented in PtrVec< T >.

void* operator[] ( int  i ) const [inline, protected]
Remarks:
Indexing operator.
Returns:
The pointer to the data being referenced by the index.
Default Implementation:
{ return data[i]; }

Reimplemented in PtrVec< T >.

{ return data[i]; }     
void*& operator[] ( int  i ) [inline, protected]
Remarks:
Indexing operator.
Default Implementation:
{ return data[i]; }

Reimplemented in PtrVec< T >.

{ return data[i]; }     
UtilExport void reshape ( int  i )
Remarks:
This method allows you set the capacity of the array.
Parameters:
int i

The capacity to set.
UtilExport void setLength ( int  i )
Remarks:
This method allows you to set the length and capacity if necessary.
Parameters:
int i

The length to set.
UtilExport void clear ( )
Remarks:
This method allows you to delete the entire ptr array, but not the objects.
void shrink ( ) [inline]
Remarks:
This method will shrink the array to its used capacity.
Default Implementation:
{ reshape(nused); }
{ reshape(nused); }
int length ( ) const [inline]
Remarks:
This method returns the length of the array.
Default Implementation:
{ return nused; }
{ return nused; }
int capacity ( ) const [inline]
Remarks:
This method returns the capacity of the array.
Default Implementation:
{ return size; }
{ return size; }

Member Data Documentation

int size [protected]
int nused [protected]
void** data [protected]

PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector
PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector PtrVector