#include "vector.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
Include dependency graph for vector.c:
Go to the source code of this file.
Defines | |
#define | Enlarge(vec, inc) |
Unconditionally enlarges a vector by at least doubling its size, or more if inc is greater than the current vector size. | |
#define | Shrink(vec) |
Conditionally reduces the size of a vector if only 1/4 of the items in the vector are used. | |
Functions | |
void | GenericPointerFree (void *item) |
A generic destructor for use with vectors of pointers. | |
static void | HeapMoveDown (Vector *vec, unsigned int index, void *temp) |
Takes an item in the vector that is not in heap order and moves it down in the array to restore heap order. | |
static Bool | Resize (Vector *vec, unsigned int newSize) |
Changes the size of a vector's array. | |
void * | VectorAdd (Vector *vec) |
void | VectorClear (Vector *vec) |
Bool | VectorCopy (Vector *target, Vector *source) |
void | VectorDestroy (Vector *vec) |
void | VectorHeapPop (Vector *vec) |
void * | VectorHeapPush (Vector *vec, void *item) |
void | VectorHeapSort (Vector *vec) |
Bool | VectorInit (Vector *vec, unsigned int initSize) |
void * | VectorInsertMany (Vector *vec, unsigned int index, unsigned int count) |
void | VectorMakeHeap (Vector *vec) |
void | VectorPop (Vector *vec) |
void * | VectorPush (Vector *vec, void *item) |
void | VectorRemoveMany (Vector *vec, unsigned int index, unsigned int count) |
Bool | VectorReserve (Vector *vec, unsigned int size) |
Copyright (C) 2007 Jeff Jackowski
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Or visit their website at: http://www.gnu.org/
Definition in file vector.c.
void* VectorAdd | ( | Vector * | vec | ) | [related] |
Definition at line 212 of file vector.c.
References Vector_t::array, Vector_t::items, Vector_t::itemSize, Resize(), and Vector_t::size.
Here is the call graph for this function:
void VectorClear | ( | Vector * | vec | ) | [related] |
Definition at line 194 of file vector.c.
References Vector_t::array, Vector_t::destructOp, Vector_t::items, Vector_t::itemSize, and Shrink.
Definition at line 177 of file vector.c.
References Vector_t::array, FALSE, Vector_t::items, Vector_t::itemSize, Vector_t::size, and TRUE.
void VectorDestroy | ( | Vector * | vec | ) | [related] |
Definition at line 155 of file vector.c.
References Vector_t::array, Vector_t::destructOp, Vector_t::items, and Vector_t::itemSize.
void VectorHeapPop | ( | Vector * | vec | ) | [related] |
Definition at line 283 of file vector.c.
References Vector_t::array, Vector_t::destructOp, HeapMoveDown(), Vector_t::items, Vector_t::itemSize, and Shrink.
Here is the call graph for this function:
void* VectorHeapPush | ( | Vector * | vec, | |
void * | item | |||
) | [related] |
Definition at line 242 of file vector.c.
References Vector_t::array, Vector_t::HEAP_PARENT_INDEX, Vector_t::items, Vector_t::itemSize, Vector_t::lessOp, Resize(), and Vector_t::size.
Here is the call graph for this function:
void VectorHeapSort | ( | Vector * | vec | ) | [related] |
Definition at line 300 of file vector.c.
References Vector_t::array, HeapMoveDown(), Vector_t::items, items, Vector_t::itemSize, and Vector_t::VectorMakeHeap().
Here is the call graph for this function:
Definition at line 133 of file vector.c.
References Vector_t::array, FALSE, Vector_t::items, Vector_t::itemSize, Vector_t::minSize, Vector_t::size, and TRUE.
void* VectorInsertMany | ( | Vector * | vec, | |
unsigned int | index, | |||
unsigned int | count | |||
) | [related] |
Definition at line 331 of file vector.c.
References Vector_t::array, Enlarge, items, Vector_t::items, Vector_t::itemSize, and Vector_t::size.
void VectorMakeHeap | ( | Vector * | vec | ) | [related] |
Definition at line 389 of file vector.c.
References Vector_t::array, HeapMoveDown(), Vector_t::items, and Vector_t::itemSize.
Here is the call graph for this function:
void VectorPop | ( | Vector * | vec | ) | [related] |
Definition at line 269 of file vector.c.
References Vector_t::array, Vector_t::destructOp, Vector_t::items, Vector_t::itemSize, and Shrink.
void* VectorPush | ( | Vector * | vec, | |
void * | item | |||
) | [related] |
Definition at line 225 of file vector.c.
References Vector_t::array, Vector_t::items, Vector_t::itemSize, Resize(), and Vector_t::size.
Here is the call graph for this function:
void VectorRemoveMany | ( | Vector * | vec, | |
unsigned int | index, | |||
unsigned int | count | |||
) | [related] |
Definition at line 359 of file vector.c.
References Vector_t::array, Vector_t::destructOp, Vector_t::items, items, Vector_t::itemSize, and Shrink.
Definition at line 412 of file vector.c.
References Resize(), Vector_t::size, and TRUE.
Here is the call graph for this function: