50 if(newDataBuffer == NULL) {
#define EXIT_ILLEGAL_INDEX_FAILURE
Exit code for requests with illegal indexes.
#define EXIT_ALLOC_FAILURE
Exit code when dynamic memory allocation fails.
#define EXIT_POP_FAILURE
Exit code when popping from a vector fails.
data_type * data
Contiguous memory segment with in data is stored.
size_t size
Field for determining the amount of elements actually stored in memory.
size_t capacity
Field for determining the amount of possible elements that can be stored in memory without resizing t...
void resize(vector *const vector, const size_t newCapacity)
Resizes the capacity of the vector with the new capacity specified. If vector's data's block allocati...
void freeVector(vector *const vector)
Frees the memory used from the vector structure.
void pushFront(vector *const vector, const data_type element)
Pushes an element at the front of the vector. If necessary, the vector is resized automatically.
data_type popBack(vector *const vector)
Pops the element at the back of the vector. If necessary, the vector is resized automatically....
data_type at(vector *vector, size_t index)
Access at the element in the given index of the vector. If the index is greater or equal to the vecto...
vector * buildVector()
Builds a vector structure initializing its fields. If vector's allocation or data's block allocation ...
void pushBack(vector *const vector, const data_type element)
Pushes an element at the back of the vector.
data_type popFront(vector *const vector)
Pops the element at the back of the vector. If necessary, the vector is resized automatically....
Definition of vector structure and related functions.
#define MIN_CAPACITY
Defines the minimum allocated memory for the vector. If data_type is char, this is 2B of data.
char data_type
The type of data wrapped in the vector structure. For convenience char has been choosen so it can wra...
#define RESIZE_COEFFICIENT
Defines the multiplicative coefficient for which the vector has to be resized.