1 krisbash 1.1 #ifndef _omi_base_ptrarray_h
2 #define _omi_base_ptrarray_h
3
4 #include <stddef.h>
5 #include <MI.h>
6 #include <common.h>
7
8 #if defined(__cplusplus)
9 extern "C"
10 {
11 #endif
12
13 typedef struct _PtrArray
14 {
15 /* Array of poitners */
16 void** data;
17
18 /* Current size of this array */
19 size_t size;
20
21 /* Current capacity (will double when exhausted) */
22 krisbash 1.1 size_t capacity;
23
24 /* Destroys individual items upon destruction (may be null) */
25 void (MI_MAIN_CALL *destructor)(void*);
26 }
27 PtrArray;
28
29 int PtrArray_Construct(
30 PtrArray* self,
31 size_t capacity,
32 void (MI_MAIN_CALL *destructor)(void*));
33
34 void PtrArray_Destruct(
35 PtrArray* self);
36
37 int PtrArray_Append(
38 _Inout_ PtrArray* self,
39 void* element);
40
41 #if defined(__cplusplus)
42 }
43 krisbash 1.1 #endif
44
45 #endif /* _omi_base_ptrarray_h */
|