PtrVector Class Reference

#include <ptrvec.h>

Class Description

class PtrVector

Description:
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:
+ Inheritance diagram for PtrVector:

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 PtrVectoroperator= (const PtrVector &v)
 
UtilExport void append (void *ptr, int extra)
 
UtilExport void insertAt (void *ptr, int at, int extra)
 
UtilExport voidremove (int i)
 
UtilExport voidremoveLast ()
 
voidoperator[] (int i) const
 
void *& operator[] (int i)
 

Protected Attributes

int size
 
int nused
 
void ** data
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 

Constructor & Destructor Documentation

PtrVector ( )
inlineprotected
Remarks
Constructor.
Default Implementation:
{ size = nused = 0; data = NULL; }
37 { size = nused = 0; data = NULL; }
void ** data
Definition: ptrvec.h:33
#define NULL
Definition: autoptr.h:18
int size
Definition: ptrvec.h:31
int nused
Definition: ptrvec.h:32
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 removed element.
UtilExport void* removeLast ( )
protected
Remarks
This method allows you to remove the last element in the array.
Returns
A pointer to the removed element.
void* operator[] ( int  i) const
inlineprotected
Remarks
Indexing operator.
Returns
The pointer to the data being referenced by the index.
Default Implementation:
{ return data[i]; }
84 { return data[i]; }
void ** data
Definition: ptrvec.h:33
void*& operator[] ( int  i)
inlineprotected
Remarks
Indexing operator.
Default Implementation:
{ return data[i]; }

89 { return data[i]; }
void ** data
Definition: ptrvec.h:33
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); }
108 { reshape(nused); }
UtilExport void reshape(int i)
int nused
Definition: ptrvec.h:32
int length ( ) const
inline
Remarks
This method returns the length of the array.
Default Implementation:
{ return nused; }
112 { return nused; }
int nused
Definition: ptrvec.h:32
int capacity ( ) const
inline
Remarks
This method returns the capacity of the array.
Default Implementation:
{ return size; }
116 { return size; }
int size
Definition: ptrvec.h:31

Member Data Documentation

int size
protected
int nused
protected
void** data
protected