exip  Alpha 0.5.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
dynamicArray.h File Reference

Declarations for untyped dynamic array. More...

#include "procTypes.h"

Go to the source code of this file.

Macros

#define DYN_ARRAY_SIZE   (sizeof(DynArray) + sizeof(void*) + sizeof(Index))
 The size of a basic DynArray-derived structure: More...
 
#define DEFAULT_NUMBER_CHUNK_ENTRIES   5
 When the chunkEntries == 0 this will be used to create the new array and later extend it. More...
 

Functions

errorCode createDynArray (DynArray *dynArray, size_t entrySize, uint16_t chunkSize)
 Creates fresh empty Untyped Dynamic Array This operation includes allocation of memory for DEFAULT_VALUE_ROWS_NUMBER number of value rows. More...
 
errorCode addEmptyDynEntry (DynArray *dynArray, void **entry, Index *entryID)
 Add new empty entry into the dynamic array The pointer to the entry is passed back to be filled in. More...
 
errorCode addDynEntry (DynArray *dynArray, void *entry, Index *entryID)
 Add new entry into the dynamic array NOTE that the new entry is shallow copied! More...
 
errorCode delDynEntry (DynArray *dynArray, Index entryID)
 Removes an entry from the dynamic array with index elID. More...
 
void destroyDynArray (DynArray *dynArray)
 Destroy a Dynamic Array This operation frees the allocated memory. More...
 

Detailed Description

Date
Jan 25, 2011
Author
Rumen Kyusakov
Version
0.5
[Revision] $Id: dynamicArray.h 352 2014-11-25 16:37:24Z kjussakov $

Definition in file dynamicArray.h.

Macro Definition Documentation

#define DEFAULT_NUMBER_CHUNK_ENTRIES   5

Definition at line 40 of file dynamicArray.h.

#define DYN_ARRAY_SIZE   (sizeof(DynArray) + sizeof(void*) + sizeof(Index))
struct [DerivedStructType]
{
[DerivedStructEntryType]* base;
Index count;
};

Definition at line 35 of file dynamicArray.h.

Function Documentation

errorCode addDynEntry ( DynArray dynArray,
void *  entry,
Index entryID 
)
Parameters
[in,out]dynArrayUntyped Dynamic Array
[in]entrythe inserted entry
[out]entryIDthe ID of the entry inserted
Returns
Error handling code

Definition at line 78 of file dynamicArray.c.

errorCode addEmptyDynEntry ( DynArray dynArray,
void **  entry,
Index entryID 
)
Parameters
[in,out]dynArrayUntyped Dynamic Array
[out]entrythe empty inserted entry to be filled in
[out]entryIDthe ID of the entry inserted
Returns
Error handling code

Definition at line 38 of file dynamicArray.c.

errorCode createDynArray ( DynArray dynArray,
size_t  entrySize,
uint16_t  chunkSize 
)

For every created array, destroyDynArray() must be invoked to release the allocated memory.

Parameters
[in,out]dynArrayUntyped Dynamic Array
[in]entrySizeThe size of a single array entry in bytes
[in]chunkSizeInitial number of entries and the number of entries to be added each expansion time
Returns
Error handling code

Definition at line 21 of file dynamicArray.c.

errorCode delDynEntry ( DynArray dynArray,
Index  entryID 
)
Parameters
[in,out]dynArrayUntyped Dynamic Array
[in]entryIDthe ID of the entry to be deleted
Returns
Error handling code - EXIP_NULL_POINTER_REF if dArray is NULL; EXIP_OUT_OF_BOUND_BUFFER if the index is bigger than the array size or the array size is 0

Definition at line 89 of file dynamicArray.c.

void destroyDynArray ( DynArray dynArray)
Parameters
[in,out]dynArrayUntyped Dynamic Array to be freed

Definition at line 118 of file dynamicArray.c.