#include <vector.h>
Data Fields | |
void * | array |
The contiguous array of items. | |
DestructorOp | destructOp |
The function used to deinitialize items in the vector prior to deallocation. | |
unsigned int | items |
The number of items present in the vector. | |
unsigned int | itemSize |
The size of the item type stored in the vector in bytes. | |
LessThanOp | lessOp |
The function used to compare items in the vector for sorting operations. | |
unsigned int | minSize |
The minimum number of items that the vector will hold. | |
unsigned int | size |
The allocated size of the vector in terms of the number of elements that can be stored. | |
Related Functions | |
(Note that these are not member functions.) | |
HEAP_CHILD_INDEX(i) | |
Computes the index of the first child item in a binary heap given the parent's index. | |
HEAP_PARENT_INDEX(i) | |
Computes the index of the parent item in a binary heap given the child's index. | |
void * | VectorAdd (Vector *vec) |
Adds an item to the end of the Vector and returns a pointer to the new, uninitialized item. | |
void | VectorClear (Vector *vec) |
Destroys the contents of a Vector, but not the Vector. | |
Bool | VectorCopy (Vector *target, Vector *source) |
Copies the contents of a Vector into a new vector. | |
void | VectorDestroy (Vector *vec) |
Destroys the contents of a Vector and deallocates its array. | |
VectorFirst(vec) | |
A convienience macro for getting the first item in a Vector. | |
void | VectorHeapPop (Vector *vec) |
Removes the first item in the Vector and maintains heap order. | |
void * | VectorHeapPush (Vector *vec, void *item) |
Copies the given item into the Vector and places it in heap order. | |
void | VectorHeapSort (Vector *vec) |
Uses the heap sort algorithm to sort the items in the Vector. | |
Bool | VectorInit (Vector *vec, unsigned int initSize) |
Initializes a Vector by setting some initial values and allocating space for the array. | |
VectorInsert(vec, index) | |
Inserts an uninitalized item within the given vector. | |
void * | VectorInsertMany (Vector *vec, unsigned int index, unsigned int count) |
Makes room for multiple items in the Vector. | |
VectorItem(vec, index) | |
A convienience macro for getting some item in a Vector. | |
VectorLast(vec) | |
A convienience macro for getting the last item in a Vector. | |
void | VectorMakeHeap (Vector *vec) |
Reorders the items in a Vector into heap order. | |
void | VectorPop (Vector *vec) |
Removes the item at the end of a Vector. | |
void * | VectorPush (Vector *vec, void *item) |
Copies the given item to the end of the Vector and returns a pointer to the item within the Vector. | |
VectorRemove(vec, index) | |
Removes an item from a Vector. | |
void | VectorRemoveMany (Vector *vec, unsigned int index, unsigned int count) |
Removes multiple items from a Vector. | |
Bool | VectorReserve (Vector *vec, unsigned int size) |
Reserves space for a given number of items. |
This structure holds information describing a vector and the data contained within.
Definition at line 89 of file vector.h.
void* Vector_t::array |
The contiguous array of items.
With the exception of VectorInit(), all vector functions assume array points to valid allocated space.
Definition at line 105 of file vector.h.
Referenced by _AATreeRemove(), AATreeAdd(), AATreeFind(), BufferFree(), ComputeAverages(), ComputeStdDeviation(), CopyAreaData(), HeapMoveDown(), InitGameConfig(), MakeBuffers(), MessageFree(), RemoveBadSamples(), Resize(), StartLoadConfig(), VectorAdd(), VectorClear(), VectorCopy(), VectorDestroy(), VectorHeapPop(), VectorHeapPush(), VectorHeapSort(), VectorInit(), VectorInsertMany(), VectorMakeHeap(), VectorPop(), VectorPush(), and VectorRemoveMany().
The function used to deinitialize items in the vector prior to deallocation.
If set to NULL, no such function will be called.
Definition at line 99 of file vector.h.
Referenced by CancelAllMessages(), ClientSync(), MessageInit(), MessageUninit(), VectorClear(), VectorDestroy(), VectorHeapPop(), VectorPop(), and VectorRemoveMany().
unsigned int Vector_t::items |
The number of items present in the vector.
Definition at line 116 of file vector.h.
Referenced by _AATreeRemove(), AATreeFind(), BufferFree(), ClientSync(), ComputeAverages(), ComputeStdDeviation(), CopyAreaData(), GetNumOutgoingMessages(), GetSamples(), HeapMoveDown(), MakeAreaBuffers(), MakeBuffers(), MessageFree(), MessageNew(), ServiceGameConfig(), StartLoadConfig(), VectorAdd(), VectorClear(), VectorCopy(), VectorDestroy(), VectorHeapPop(), VectorHeapPush(), VectorHeapSort(), VectorInit(), VectorInsertMany(), VectorMakeHeap(), VectorPop(), VectorPush(), and VectorRemoveMany().
unsigned int Vector_t::itemSize |
The size of the item type stored in the vector in bytes.
This should be the same value returned by the sizeof operator.
Definition at line 111 of file vector.h.
Referenced by ClientSync(), HeapMoveDown(), MessageInit(), Resize(), StartLoadConfig(), VectorAdd(), VectorClear(), VectorCopy(), VectorDestroy(), VectorHeapPop(), VectorHeapPush(), VectorHeapSort(), VectorInit(), VectorInsertMany(), VectorMakeHeap(), VectorPop(), VectorPush(), and VectorRemoveMany().
The function used to compare items in the vector for sorting operations.
It may be set to NULL if the sorting functions are not used.
Definition at line 94 of file vector.h.
Referenced by HeapMoveDown(), MessageInit(), and VectorHeapPush().
unsigned int Vector_t::minSize |
The minimum number of items that the vector will hold.
Definition at line 127 of file vector.h.
Referenced by ClientSync(), InitGameConfig(), MessageInit(), and VectorInit().
unsigned int Vector_t::size |
The allocated size of the vector in terms of the number of elements that can be stored.
Definition at line 122 of file vector.h.
Referenced by Resize(), VectorAdd(), VectorCopy(), VectorHeapPush(), VectorInit(), VectorInsertMany(), VectorPush(), and VectorReserve().