Initial commit
[minnow.git] / src / aquarium / simplearray.h
blobc9d399c11095269dda9828739ef2a5c39e687470
1 #ifndef SIMPLEARRAY_H_
2 #define SIMPLEARRAY_H_
4 typedef struct {
5 void* contents;
6 unsigned int elemSize;
7 unsigned int currentSize;
8 unsigned int bufferSize;
9 } SimpleArray;
11 #define STORAGE_VAR(x) ((void*)&(x))
12 #define INDEX_AT(c,x,y) (*((y*)(c.contents + (x) * c.elemSize)))
13 #define DEFAULT_SIMPLEARRAY_SIZE 4
15 void initialize_simplearray(SimpleArray *container, unsigned int size);
16 void push_onto_simplearray(SimpleArray *container, void *value);
17 void pop_off_simplearray(SimpleArray *container);
18 void insert_into_simplearray(SimpleArray *container, void* value, unsigned int pos);
19 void delete_from_simplearray(SimpleArray *container, unsigned int pos);
20 void delete_from_simplearray_range(SimpleArray *container, unsigned int pos, unsigned int amount);
23 #endif /* SIMPLEARRAY_H_ */