Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

VectorOfPointer Class Reference

VectorOfPointer is a dynamic array of void* pointers. More...

#include <tables.h>

List of all members.

Public Types

enum  EGrowthRate { GROWTH_RATE = 4 }
 The chunk size by which the array is grown. More...


Public Methods

 VectorOfPointer (int32_t initialSize = 0)
 Creates a vector that contains elements of pointers to objects. More...

 VectorOfPointer (const VectorOfPointer& that)
 Copy constructor.

 ~VectorOfPointer ()
 Destructor.

const VectorOfPointer& operator= (const VectorOfPointer& that)
 Assignment operator.

UBool operator== (const VectorOfPointer& that)
 Equality operators.

UBool operator!= (const VectorOfPointer& that)
void* operator[] (int32_t index) const
 Gets a read-only reference to the element at the specified index. More...

void* at (int32_t index) const
void*& operator[] (int32_t index)
 Gets a non-const reference to the element at the specified index. More...

void*& at (int32_t index)
void atPut ( int32_t index, const void*& value)
 Sets the element at the specified index to a different value. More...

void atInsert ( int32_t index, const void*& value)
 Inserts a value at the specified index, sliding the rest of the elements in the array over to make room. More...

int32_t size (void) const
 Returns the number of elements in the vector. More...

UBool isBogus (void) const
 Checks if this vector object is valid. More...


Detailed Description

VectorOfPointer is a dynamic array of void* pointers.

This is a vector class that is designed to be used with pointer types and which implements owning semantics. That is, once a value is placed an element of the vector, the vector is considered to own it and is responsible for disposing it. This will happen both when the element is changed using atPut() or through an PointerTo****, and when the vector itself is disposed.

WARNING: The caller must be careful to avoid holding onto any dangling references after the vector is disposed, and the caller must also be careful not to put the same value into more than one element in the vector (unless the value is NULL).

As with VectorOf***>, the vector grows as necessary to accommodate all elements, the size is one plus the index of the highest element that's been set, and any elements below the highest element that aren't explicitly initialized are initialized to NULL.

Definition at line 221 of file tables.h.


Member Enumeration Documentation

enum VectorOfPointer::EGrowthRate
 

The chunk size by which the array is grown.

This probably shouldn't be in the API

Enumeration values:
GROWTH_RATE  

Definition at line 227 of file tables.h.


Constructor & Destructor Documentation

VectorOfPointer::VectorOfPointer ( int32_t initialSize = 0 )
 

Creates a vector that contains elements of pointers to objects.

Parameters:
initialSize   the initial size of the vector object.

VectorOfPointer::VectorOfPointer ( const VectorOfPointer & that )
 

Copy constructor.

VectorOfPointer::~VectorOfPointer ( )
 

Destructor.


Member Function Documentation

void *& VectorOfPointer::at ( int32_t index ) [inline]
 

Definition at line 1125 of file tables.h.

void * VectorOfPointer::at ( int32_t index ) const [inline]
 

Definition at line 1119 of file tables.h.

void VectorOfPointer::atInsert ( int32_t index,
const void *& value )
 

Inserts a value at the specified index, sliding the rest of the elements in the array over to make room.

Parameters:
index   the specified index.
value   the value.

void VectorOfPointer::atPut ( int32_t index,
const void *& value )
 

Sets the element at the specified index to a different value.

Parameters:
index   the specified index.
value   the new value.

UBool VectorOfPointer::isBogus ( void ) const
 

Checks if this vector object is valid.

Returns:
TRUE if the vector object is valid, FALSE otherwise.

UBool VectorOfPointer::operator!= ( const VectorOfPointer & that )
 

const VectorOfPointer & VectorOfPointer::operator= ( const VectorOfPointer & that )
 

Assignment operator.

UBool VectorOfPointer::operator== ( const VectorOfPointer & that )
 

Equality operators.

void *& VectorOfPointer::operator[] ( int32_t index )
 

Gets a non-const reference to the element at the specified index.

This does range-checking; access to elements beyond the end of the array will cause the array to grow.

void * VectorOfPointer::operator[] ( int32_t index ) const [inline]
 

Gets a read-only reference to the element at the specified index.

This does not do range-checking; an invalid index may cause a crash.

Returns:
the accessed element.

Definition at line 1112 of file tables.h.

int32_t VectorOfPointer::size ( void ) const [inline]
 

Returns the number of elements in the vector.

Returns:
the size of vector.

Definition at line 1131 of file tables.h.


The documentation for this class was generated from the following file:
Generated at Tue Dec 5 17:56:35 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000