Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csVector Class Reference

csVector is an abstract class which can hold an unlimited array of unspecified (void*) data. More...

#include <csvector.h>

Inheritance diagram for csVector:

csBasicVector csConstraintVector csHintManager csObjVector csPolygonArray csRestrictedAccessVector csRGBVector csSegmentArray csSkin csStrVector csWSTexVector List of all members.

Public Methods

 csVector (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.

virtual ~csVector ()
 Destroy the vector object.

int FindKey (csConstSome Key, int Mode=0) const
 Find a element by key (using CompareKey method).

int FindSortedKey (csConstSome Key, int Mode=0) const
 Find a element in a SORTED array by key (using CompareKey method).

void QuickSort (int Left, int Right, int Mode=0)
 Partially sort the array.

void QuickSort (int Mode=0)
 Same but for all elements.

bool Delete (int n, bool FreeIt=true)
 Delete element number 'n' from vector.

bool Delete (csSome Item, bool FreeIt=true)
 Delete the given element from vector.

bool Replace (int n, csSome what, bool FreePrevious=true)
 Replace n-th item with another (free previous value).

void DeleteAll (bool FreeThem=true)
 Delete all elements.

int InsertSorted (csSome Item, int *oEqual=NULL, int Mode=0)
 Insert element 'Item' so that array remains sorted (assumes its already).

virtual bool FreeItem (csSome Item)
 Virtual function which frees a vector element; returns success status.

virtual int Compare (csSome Item1, csSome Item2, int Mode) const
 Compare two array elements in given Mode.

virtual int CompareKey (csSome Item, csConstSome Key, int Mode) const
 Compare entry with a key; for csVector just compare (int)Key vs (int)Item.


Detailed Description

csVector 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 no-op. 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).

Note that FreeItem() returns a boolean value which is the success status. This is used in Delete() and DeleteAll() to decide whenever an element can be really deleted - if the element has a good reason to stay 'sticky' it can return false from FreeItem().


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000