2023-08-23 21:14:12 -04:00
|
|
|
#ifndef VECTOR_H
|
|
|
|
#define VECTOR_H
|
|
|
|
|
2023-08-28 15:58:20 -04:00
|
|
|
#include <stddef.h>
|
2023-08-23 19:29:23 -04:00
|
|
|
|
|
|
|
// TODO: Handle error warnings?
|
|
|
|
// TODO: Implement more useful functions?
|
|
|
|
|
|
|
|
typedef struct {
|
2023-08-25 13:44:07 -04:00
|
|
|
char * data;
|
|
|
|
size_t element_size;
|
2023-08-23 19:29:23 -04:00
|
|
|
size_t element_count;
|
|
|
|
} vector_t;
|
|
|
|
|
2023-08-25 13:44:07 -04:00
|
|
|
extern void vector_init(vector_t * vector,
|
|
|
|
size_t element_size,
|
2023-08-23 19:29:23 -04:00
|
|
|
size_t element_count);
|
|
|
|
|
|
|
|
extern void vector_push(vector_t * vector,
|
2023-08-25 13:44:07 -04:00
|
|
|
void * data);
|
2023-08-23 19:29:23 -04:00
|
|
|
|
|
|
|
extern void vector_pop(vector_t * vector);
|
|
|
|
|
2023-08-25 13:44:07 -04:00
|
|
|
extern void * vector_get(const vector_t * const vector,
|
2023-08-23 21:14:12 -04:00
|
|
|
const size_t element);
|
2023-08-23 19:29:23 -04:00
|
|
|
|
2023-08-25 13:44:07 -04:00
|
|
|
extern void vector_set(vector_t * vector,
|
|
|
|
void * data,
|
2023-08-23 19:29:23 -04:00
|
|
|
size_t element);
|
|
|
|
|
|
|
|
extern void vector_free(vector_t * vector);
|
2023-08-25 13:44:07 -04:00
|
|
|
|
2023-08-23 21:14:12 -04:00
|
|
|
#endif
|