vector class cleaned, slight work on handler

This commit is contained in:
herbglitch 2022-12-15 16:45:45 -07:00
parent cd5471c9c8
commit 55e8c44221
5 changed files with 56 additions and 57 deletions

View file

@ -12,6 +12,18 @@ extern "C" {
*/
typedef struct ARC_Handler ARC_Handler;
/**
* @brief data comparison function ptr
*
* @note this is used for comparison within vectors
*
* @param a first data struct
* @param b second data struct
*
* @return 0 when a == b
*/
typedef uint32_t (* ARC_Handler_CompareDataFn)(void *a, void *b);
/**
* @brief a function that will take iterated data
*
@ -30,9 +42,8 @@ typedef void (* ARC_Handler_CleanDataFn)(void *data);
* @brief creates ARC_Handler type
*
* @param config ARC_Handler to initialize
* @param dataSize size of type the handler will use
*/
void ARC_Handler_Create(ARC_Handler **handler, uint32_t dataSize);
void ARC_Handler_Create(ARC_Handler **handler);
/**
* @brief destroyes ARC_Handler type
@ -57,7 +68,7 @@ void ARC_Handler_Add(ARC_Handler *handler, void *data);
* @param handler ARC_Handler to remove from
* @param data data that is being removed
*/
void ARC_Handler_Remove(ARC_Handler *handler, void *data);
void ARC_Handler_Remove(ARC_Handler *handler, void *data, ARC_Handler_CompareDataFn compare);
/**
* @brief remove from handler

View file

@ -20,15 +20,14 @@ typedef struct ARC_Vector ARC_Vector;
*
* @return 0 when a == b
*/
typedef int8_t (* ARC_Vector_CompareDataFn)(void *a, void *b);
typedef int32_t (* ARC_Vector_CompareDataFn)(void *a, void *b);
/**
* @brief creates ARC_Vector type
*
* @param vector ARC_Vector to initialize
* @param dataSize size of type the vector will store
* @param vector ARC_Vector to initialize
*/
void ARC_Vector_Create(ARC_Vector **vector, uint32_t dataSize);
void ARC_Vector_Create(ARC_Vector **vector);
/**
* @brief destroyes ARC_Vector type
@ -80,4 +79,4 @@ void *ARC_Vector_Get(ARC_Vector *vector, uint32_t *index);
}
#endif
#endif //ARC_STD_VECTOR_H_
#endif //ARC_STD_VECTOR_H_