33 (*vector)->
data = (
void **)malloc(
sizeof(
void *));
34 (*vector)->currentCapacity = 1;
35 (*vector)->currentSize = 0;
39 if(compareDataFn != NULL){
40 (*vector)->compareDataFn = *compareDataFn;
44 (*vector)->destroyDataFn = NULL;
45 if(destroyDataFn != NULL){
47 *((*vector)->destroyDataFn) = *destroyDataFn;
71 ARC_DEBUG_LOG_ERROR(
"ARC_Vector_Add(vector, data), vector at max capacity tried adding another value");
96 for(uint32_t index = 0; index < vector->
currentSize; index++){
98 void *dataB = vector->
data[index];
111 ARC_DEBUG_LOG_ERROR(
"ARC_Vector_Add(vector, data), vector at max capacity tried adding another value");
123 vector->
data[index] = vector->
data[index + 1];
158 return vector->
data[index];
#define ARC_DEBUG_LOG_ERROR_WITH_VARIABLES(STR,...)
#define ARC_ERRNO_OVERFLOW
#define ARC_DEBUG_LOG_ERROR(STR)
ARC_Vector_DestroyDataFn * destroyDataFn
ARC_Vector_CompareDataFn compareDataFn
uint32_t ARC_Vector_GetSize(ARC_Vector *vector)
gets the current size of an ARC_Vector as an unsigned 32 bit integer
void * ARC_Vector_Get(ARC_Vector *vector, uint32_t index)
gets an item from an ARC_Vector at a position index
void ARC_Vector_Add(ARC_Vector *vector, void *data)
adds an item to an ARC_Vector
void ARC_Vector_Remove(ARC_Vector *vector, void *data)
removes an item from a matching item in an ARC_Vector
void ARC_Vector_Destroy(ARC_Vector *vector)
destroys an ARC_Vector
void ARC_Vector_RemoveIndex(ARC_Vector *vector, uint32_t index)
removes an item from an ARC_Vector at an index
void ARC_Vector_Clear(ARC_Vector *vector)
clears all items from a vector
void ARC_Vector_Create(ARC_Vector **vector, ARC_Vector_CompareDataFn *compareDataFn, ARC_Vector_DestroyDataFn *destroyDataFn)
creates an ARC_Vector which is an "expandable" array
ARC_Bool ARC_Vector_CompareDataDefaultFn(void *dataA, void *dataB)
void(* ARC_Vector_DestroyDataFn)(void *data)
a callback that cleans up memory when it is removed from the vector
ARC_Bool(* ARC_Vector_CompareDataFn)(void *dataA, void *dataB)
a callback that allows the user to define a way to check the data stored in a vector for a match