#include <wvvector.h>
Inheritance diagram for WvVector< T >:
Definition at line 246 of file wvvector.h.
Public Types | |
typedef int(* | comparison_type_fn_t )(const T *, const T *) |
Runs the C qsort() routine over the vector, as long as the vector is big enough. | |
Public Member Functions | |
WvVector () | |
Creates an empty vector. | |
WvVector (int slots) | |
Creates an empty vector, but initialises a new number of default slots. | |
~WvVector () | |
Destroys the vector and all of its contents. | |
T * | operator[] (int slot) |
Dereferences a particular slot of the vector. | |
void | zap (bool destroy=true) |
Removes all elements from the vector. | |
T * | first () |
Returns the first element. | |
T * | last () |
Returns the last element. | |
void | remove (int slot, bool destroy=true) |
Removes a particular slot from the vector. | |
void | remove_last (bool destroy=true) |
Removes the last element. | |
void | insert (int slot, T *elem, bool autofree) |
Insert an element into a slot, and shifts the others to the right. | |
void | prepend (T *elem, bool autofree) |
Prepends an element to the start of the vector. | |
void | append (T *elem, bool autofree) |
Appends an element to the end of the vector. | |
void | qsort (comparison_type_fn_t comparator) |
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 | |
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. | |
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 | Iter |
A simple iterator that walks through all elements in the list. More... |
|
Runs the C qsort() routine over the vector, as long as the vector is big enough. It uses comparator like qsort() does to figure out the order of the operators. Definition at line 341 of file wvvector.h. |
|
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 WvVectorBase::xcount, WvVectorBase::xseq, and WvVectorBase::xslots. Referenced by WvVectorBase::append(), WvVectorBase::compact(), WvVectorBase::insert(), and WvVectorBase::WvVectorBase(). |
|
the minimum number of slots to allocate Definition at line 26 of file wvvector.h. |
|
the controlled sequence Definition at line 29 of file wvvector.h. Referenced by WvVectorBase::append(), WvVectorBase::get_autofree(), WvVectorBase::insert(), WvVectorBase::IterBase::next(), WvVector< T >::operator[](), WvVectorBase::IterBase::prev(), WvVectorBase::qsort(), WvVector< T >::remove(), WvVectorBase::remove(), WvVectorBase::IterBase::rewind(), WvVectorBase::set_autofree(), WvVectorBase::set_capacity(), WvVectorBase::IterBase::unwind(), and WvVectorBase::~WvVectorBase(). |
|
the number of elements in the sequence Definition at line 30 of file wvvector.h. Referenced by WvVectorBase::append(), WvVectorBase::compact(), WvVectorBase::count(), WvVectorBase::get_autofree(), WvVectorBase::insert(), WvVectorBase::isempty(), WvVector< T >::last(), WvVectorBase::IterBase::next(), WvVector< T >::operator[](), WvVector< T >::qsort(), WvVectorBase::qsort(), WvVectorBase::remove(), WvVector< T >::remove_last(), WvVectorBase::IterBase::rewind(), WvVectorBase::set_autofree(), WvVectorBase::set_capacity(), WvVectorBase::IterBase::unwind(), and WvVector< T >::zap(). |
|
the capacity of the array Definition at line 31 of file wvvector.h. Referenced by WvVectorBase::append(), WvVectorBase::get_capacity(), WvVectorBase::insert(), and WvVectorBase::set_capacity(). |