#include <wvvector.h>
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 |
WvVectorBase::WvVectorBase | ( | int | slots = DEFAULTSIZE |
) | [protected] |
void WvVectorBase::remove | ( | int | slot | ) | [protected] |
Removes the element at the specified slot.
Definition at line 19 of file wvvector.cc.
Referenced by WvVector< T >::remove().
void WvVectorBase::insert | ( | int | slot, | |
WvLink * | elem | |||
) | [protected] |
Inserts an element at the specified slot.
Definition at line 27 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 39 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 96 of file wvvector.h.
References xcount.
bool WvVectorBase::isempty | ( | ) | const [inline] |
int WvVectorBase::get_capacity | ( | ) | const [inline] |
The number of elements that could be stored without resizing.
Definition at line 108 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 49 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 122 of file wvvector.h.
References set_capacity(), and xcount.
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(), WvVectorBase::IterBase::next(), WvVector< T >::operator[](), WvVectorBase::IterBase::prev(), qsort(), WvVector< T >::remove(), remove(), WvVectorBase::IterBase::rewind(), set_autofree(), set_capacity(), WvVectorBase::IterBase::unwind(), 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(), get_autofree(), insert(), isempty(), WvVector< T >::last(), WvVectorBase::IterBase::next(), WvVector< T >::operator[](), WvVector< T >::qsort(), qsort(), remove(), WvVector< T >::remove_last(), WvVectorBase::IterBase::rewind(), set_autofree(), set_capacity(), WvVectorBase::IterBase::unwind(), 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().