#include <wvvector.h>
Inherited by WvVector< T >.
Collaboration diagram for WvVectorBase:
Definition at line 17 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 | capacity () const |
The number of elements that could be stored without resizing. | |
void | setcapacity (int newslots) |
Adjusts the capacity of the vector. | |
void | compact () |
Compacts the vector to minimize its footprint. | |
Protected Member Functions | |
WvVectorBase (bool _auto_free) | |
Creates an empty vector. | |
int | growcapacity (int minslots) |
Computes the number of slots needed to grow to at least minslots. | |
int | shrinkcapacity (int maxslots) |
Computes the number of slots needed to shrink down to maxslots. | |
void | moveelems (void *dst, void *src, int nelems) |
A shorthand for memmove() with size adjustment. | |
void | remove (int slot) |
Removes the element at the specified slot. | |
void | insert (int slot, void *elem) |
Inserts an element at the specified slot. | |
void | append (void *elem) |
Appends an element onto the tail of the vector. | |
Protected Attributes | |
void ** | xseq |
int | xcount |
int | xslots |
bool | auto_free |
Static Protected Attributes | |
const int | MINALLOC = 4 |
|
Creates an empty vector.
Definition at line 11 of file wvvector.cc. |
|
Appends an element onto the tail of the vector.
Definition at line 56 of file wvvector.cc. References growcapacity(), setcapacity(), xcount, and xseq. Referenced by WvVector< T >::append(). |
|
The number of elements that could be stored without resizing.
Definition at line 60 of file wvvector.h. References xslots. |
|
Compacts the vector to minimize its footprint.
Definition at line 72 of file wvvector.h. References count(), and setcapacity(). |
|
Returns the number of elements actually stored in the vector.
Definition at line 52 of file wvvector.h. References xcount. Referenced by compact(). |
|
Computes the number of slots needed to grow to at least minslots.
Definition at line 19 of file wvvector.cc. |
|
Inserts an element at the specified slot.
Definition at line 47 of file wvvector.cc. References growcapacity(), moveelems(), setcapacity(), xcount, and xseq. Referenced by WvVector< T >::insert(). |
|
Returns true if the vector is empty.
Definition at line 56 of file wvvector.h. References xcount. |
|
A shorthand for memmove() with size adjustment.
Definition at line 38 of file wvvector.h. Referenced by insert(), remove(), and setcapacity(). |
|
Removes the element at the specified slot.
Definition at line 39 of file wvvector.cc. References moveelems(), setcapacity(), shrinkcapacity(), xcount, and xseq. Referenced by WvVector< T >::remove(). |
|
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 64 of file wvvector.cc. References moveelems(), xcount, xseq, and xslots. |
|
Computes the number of slots needed to shrink down to maxslots.
Definition at line 29 of file wvvector.cc. References xslots. Referenced by remove(). |
|
whether to auto-delete the elements when removed Definition at line 26 of file wvvector.h. Referenced by WvVectorBase(). |
|
the minimum number of slots to allocate Definition at line 20 of file wvvector.h. Referenced by growcapacity(). |
|
the number of elements in the sequence Definition at line 24 of file wvvector.h. Referenced by append(), count(), insert(), isempty(), remove(), setcapacity(), and WvVectorBase(). |
|
the controlled sequence Definition at line 23 of file wvvector.h. Referenced by append(), insert(), remove(), setcapacity(), and WvVectorBase(). |
|
the capacity of the array Definition at line 25 of file wvvector.h. Referenced by capacity(), growcapacity(), setcapacity(), shrinkcapacity(), and WvVectorBase(). |