WvVectorBase Class Reference

#include <wvvector.h>

Inheritance diagram for WvVectorBase:
[legend]

List of all members.


Detailed Description

The untyped vector base type.

See also:
WvVector

Definition at line 20 of file wvvector.h.


Public Member Functions

int count () const
 Returns the number of elements actually stored in the vector.
bool isempty () const
 Returns true if the vector is empty.
int get_capacity () const
 The number of elements that could be stored without resizing.
void set_capacity (int newslots)
 Adjusts the capacity of the vector.
void compact ()
 Compacts the vector to minimize its footprint.

Protected Types

typedef int(* comparison_type_t )(const void *, const void *)

Protected Member Functions

 WvVectorBase (int slots=DEFAULTSIZE)
 Creates an empty vector.
 ~WvVectorBase ()
 Default WvVectorBase destructor.
void remove (int slot)
 Removes the element at the specified slot.
void insert (int slot, WvLink *elem)
 Inserts an element at the specified slot.
void prepend (WvLink *elem)
 Prepend an element onto the front of the vector.
void append (WvLink *elem)
 Appends an element onto the tail of the vector.
bool get_autofree (int slot)
 Gets autofree for the specified slot.
void set_autofree (int slot, bool autofree)
 Sets autofree for the specified slot.
void qsort (comparison_type_t comparator)

Static Protected Member Functions

static int wrapcomparator (const void *_a, const void *_b)

Protected Attributes

WvLink ** xseq
int xcount
int xslots

Static Protected Attributes

static const int DEFAULTSIZE = 4

Friends

class IterBase

Classes

class  IterBase

Constructor & Destructor Documentation

WvVectorBase::WvVectorBase ( int  slots = DEFAULTSIZE  )  [protected]

Creates an empty vector.

Definition at line 12 of file wvvector.cc.

References set_capacity().


Member Function Documentation

void WvVectorBase::remove ( int  slot  )  [protected]

Removes the element at the specified slot.

Definition at line 18 of file wvvector.cc.

References xcount, and xseq.

Referenced by WvVector< T >::remove().

void WvVectorBase::insert ( int  slot,
WvLink elem 
) [protected]

Inserts an element at the specified slot.

Definition at line 26 of file wvvector.cc.

References set_capacity(), xcount, xseq, and xslots.

Referenced by WvVector< T >::insert(), and prepend().

void WvVectorBase::prepend ( WvLink elem  )  [inline, protected]

Prepend an element onto the front of the vector.

Definition at line 50 of file wvvector.h.

References insert().

Referenced by WvVector< T >::prepend().

void WvVectorBase::append ( WvLink elem  )  [protected]

Appends an element onto the tail of the vector.

Definition at line 41 of file wvvector.cc.

References set_capacity(), xcount, xseq, and xslots.

Referenced by WvVector< T >::append().

bool WvVectorBase::get_autofree ( int  slot  )  [inline, protected]

Gets autofree for the specified slot.

Definition at line 59 of file wvvector.h.

References WvLink::get_autofree(), xcount, and xseq.

void WvVectorBase::set_autofree ( int  slot,
bool  autofree 
) [inline, protected]

Sets autofree for the specified slot.

Definition at line 67 of file wvvector.h.

References WvLink::set_autofree(), xcount, and xseq.

int WvVectorBase::count (  )  const [inline]

Returns the number of elements actually stored in the vector.

Definition at line 98 of file wvvector.h.

References xcount.

bool WvVectorBase::isempty (  )  const [inline]

Returns true if the vector is empty.

Definition at line 104 of file wvvector.h.

References xcount.

int WvVectorBase::get_capacity (  )  const [inline]

The number of elements that could be stored without resizing.

Definition at line 110 of file wvvector.h.

References xslots.

void WvVectorBase::set_capacity ( int  newslots  ) 

Adjusts the capacity of the vector.

If the new capacity is greater than the old one, extends the array size without actually filling in any elements.

Definition at line 53 of file wvvector.cc.

References xcount, xseq, and xslots.

Referenced by append(), compact(), insert(), and WvVectorBase().

void WvVectorBase::compact (  )  [inline]

Compacts the vector to minimize its footprint.

Definition at line 124 of file wvvector.h.

References set_capacity(), and xcount.


Member Data Documentation

const int WvVectorBase::DEFAULTSIZE = 4 [static, protected]

the minimum number of slots to allocate

Definition at line 26 of file wvvector.h.

WvLink** WvVectorBase::xseq [protected]

the controlled sequence

Definition at line 29 of file wvvector.h.

Referenced by append(), get_autofree(), insert(), WvVector< T >::operator[](), WvVector< T >::remove(), remove(), set_autofree(), set_capacity(), and ~WvVectorBase().

int WvVectorBase::xcount [protected]

the number of elements in the sequence

Definition at line 30 of file wvvector.h.

Referenced by append(), compact(), count(), WvVector< T >::first(), get_autofree(), insert(), isempty(), WvVector< T >::last(), WvVector< T >::operator[](), WvVector< T >::remove(), remove(), WvVector< T >::remove_last(), set_autofree(), set_capacity(), and WvVector< T >::zap().

int WvVectorBase::xslots [protected]

the capacity of the array

Definition at line 31 of file wvvector.h.

Referenced by append(), get_capacity(), insert(), and set_capacity().


The documentation for this class was generated from the following files:
Generated on Thu Jan 24 16:51:07 2008 for WvStreams by  doxygen 1.5.4