Vector Class Reference

#include <Vector.h>

Inheritance diagram for Vector:

BaseVector HashVector ObjectVector List of all members.

Public Member Functions

 Vector (int ilimit=8, int ithreshold=16)
virtual ~Vector ()
 Destroy the vector object.
void Exchange (Vector &other)
 Exchange the contents of two vectors.
Some & operator[] (int n) const
 Get a reference to n-th element (n must be < Length()).
Some & Get (int n) const
 Same but in function form.
void Set (int n, Some Item)
 Set a vector element.
virtual void SetLength (int n)
 Set vector length to n.
int Length () const
 Query vector length.
virtual void SetLimit (int n)
 Set vector limit to n.
int Limit () const
 Query vector limit.
void Exchange (int n1, int n2)
 Exchange two elements in array.
bool Shift (int n1, int n2)
 Shift one element to a different place (ROL and ROR).
int Find (Some which, bool reversedir=false) const
 Find a element in array and return its index (or -1 if not found).
int FindKey (ConstSome Key, int Mode=0) const
 Find a element by key (using CompareKey method).
int FindSortedKey (ConstSome Key, int Mode=0) const
Some GetByKey (ConstSome Key, int Mode=0) const
 Returns Item searched for Key.
void QuickSort (int Left, int Right, int Mode=0)
 Partially sort the array.
void QuickSort (int Mode=0)
 Same but for all elements.
int Push (Some what)
 Push a element on 'top' of vector.
Some Pop ()
 Pop a element from vector 'top'.
bool Delete (int n)
 Delete element number 'n' from vector.
bool Replace (int n, Some what)
 Replace n-th item with another (free previous value).
void DeleteAll ()
 Delete all elements.
bool Insert (int n, Some Item)
 Insert element 'Item' before element 'n'.
int InsertSorted (Some Item, int *oEqual=0, int Mode=0)
 Insert element 'Item' so that array remains sorted (assumes its already).
virtual void FreeItem (Some Item) const
 Virtual function which frees a vector element.
virtual int Compare (Some Item1, Some Item2, int Mode) const
 Compare two array elements in given Mode.
virtual int CompareKey (Some Item, ConstSome Key, int Mode) const
 Compare entry with a key; for Vector just compare (int)Key vs (int)Item.
int Float (int n, int Mode=0)
 Float a element up or down until it becomes > previous and < next element.
bool Copy (Vector &Other)
 Copy another vector to this one.

Detailed Description

Vector is an abstract class which can hold an unlimited array of unspecified (void *) data. Since this is a basic object, it does not presume anything about its elements, so FreeItem () is effectively a NOP. If you want vector elements to free automatically occupied memory upon vector destruction you should create a derived class which should provide its own FreeItem () method (see csStrVector for a example).


Constructor & Destructor Documentation

Vector::Vector ( int  ilimit = 8,
int  ithreshold = 16 
)

Initialize object to hold initially 'ilimit' elements, and increase storage by 'ithreshold' each time the upper bound is exceeded.


Member Function Documentation

int Vector::FindSortedKey ( ConstSome  Key,
int  Mode = 0 
) const

Find a element in a SORTED array by key (using CompareKey method).


The documentation for this class was generated from the following files:
Generated on Wed Aug 30 03:27:47 2006 for SWG EMU by  doxygen 1.4.7