diff options
author | Chia-I Wu <[email protected]> | 2010-06-30 16:08:52 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-06-30 18:32:48 +0800 |
commit | 106466783f986f532d3ee7af3a70f693c610ea04 (patch) | |
tree | 4deae5c66747d1ced1812891b220eaa0e303b895 /src/egl/main/eglarray.h | |
parent | 2d8e70fcd57b23786e3f4196f35440ed1861a98b (diff) |
egl: Add dynamic array.
Dynamic arrays will be used to store configs and screens of a display.
Diffstat (limited to 'src/egl/main/eglarray.h')
-rw-r--r-- | src/egl/main/eglarray.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/egl/main/eglarray.h b/src/egl/main/eglarray.h new file mode 100644 index 00000000000..80bdb0e3eef --- /dev/null +++ b/src/egl/main/eglarray.h @@ -0,0 +1,53 @@ +#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); + + +void * +_eglFindArray(_EGLArray *array, void *elem); + + +void ** +_eglFilterArray(_EGLArray *array, 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 */ |