From 43642630c7cc8a96009a6cb7edbaa895c41f63c0 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 8 Feb 2016 20:57:52 +0100 Subject: Dep/CascLib: Update to ladislav-zezula/CascLib@919a2d670cb749c501ee15887a88e9b9a538961b --- dep/CascLib/src/common/DynamicArray.h | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 dep/CascLib/src/common/DynamicArray.h (limited to 'dep/CascLib/src/common/DynamicArray.h') diff --git a/dep/CascLib/src/common/DynamicArray.h b/dep/CascLib/src/common/DynamicArray.h new file mode 100644 index 00000000000..11cefacdcc4 --- /dev/null +++ b/dep/CascLib/src/common/DynamicArray.h @@ -0,0 +1,37 @@ +/*****************************************************************************/ +/* DynamicArray.h Copyright (c) Ladislav Zezula 2015 */ +/*---------------------------------------------------------------------------*/ +/* Common array implementation */ +/*---------------------------------------------------------------------------*/ +/* Date Ver Who Comment */ +/* -------- ---- --- ------- */ +/* 30.10.15 1.00 Lad The first version of DynamicArray.h */ +/*****************************************************************************/ + +#ifndef __DYNAMIC_ARRAY_H__ +#define __DYNAMIC_ARRAY_H__ + +//----------------------------------------------------------------------------- +// Structures + +typedef struct _DYNAMIC_ARRAY +{ + char * ItemArray; // Pointer to items + size_t ItemCountMax; // Current number of items + size_t ItemCount; // Total size of the buffer + size_t ItemSize; // Size of the single item + +} DYNAMIC_ARRAY, *PDYNAMIC_ARRAY; + +//----------------------------------------------------------------------------- +// Functions for managing the array + +int Array_Create_(PDYNAMIC_ARRAY pArray, size_t ItemSize, size_t ItemCountMax); +void * Array_Insert(PDYNAMIC_ARRAY pArray, const void * NewItems, size_t NewItemCount); +void * Array_ItemAt(PDYNAMIC_ARRAY pArray, size_t ItemIndex); +size_t Array_IndexOf(PDYNAMIC_ARRAY pArray, const void * ArrayPtr); +void Array_Free(PDYNAMIC_ARRAY pArray); + +#define Array_Create(pArray, type, ItemCountMax) Array_Create_(pArray, sizeof(type), ItemCountMax) + +#endif // __DYNAMIC_ARRAY__ -- cgit v1.2.3