summaryrefslogtreecommitdiff
path: root/src/egl/main/eglarray.h
blob: a88189a62524e921e0020ed4a36c8d66baf33aaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef EGLARRAY_INCLUDED
#define EGLARRAY_INCLUDED


#include "egltypedefs.h"


typedef EGLBoolean (*_EGLArrayForEach)(void *elem, void *foreach_data);


struct _egl_array {
   const char *Name;
   EGLint MaxSize;

   void **Elements;
   EGLint Size;
};


extern _EGLArray *
_eglCreateArray(const char *name, EGLint init_size);


PUBLIC void
_eglDestroyArray(_EGLArray *array, void (*free_cb)(void *));


extern void
_eglAppendArray(_EGLArray *array, void *elem);


extern void
_eglEraseArray(_EGLArray *array, EGLint i, void (*free_cb)(void *));


void *
_eglFindArray(_EGLArray *array, void *elem);


PUBLIC EGLint
_eglFilterArray(_EGLArray *array, void **data, EGLint size,
                _EGLArrayForEach filter, void *filter_data);


EGLint
_eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size,
                 _EGLArrayForEach flatten);


static INLINE EGLint
_eglGetArraySize(_EGLArray *array)
{
   return (array) ? array->Size : 0;
}


#endif /* EGLARRAY_INCLUDED */