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

Implementation for untyped dynamic array. More...

#include "dynamicArray.h"
#include "memManagement.h"

Go to the source code of this file.

Functions

errorCode createDynArray (DynArray *dynArray, size_t entrySize, uint16_t chunkEntries)
 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.c 352 2014-11-25 16:37:24Z kjussakov $

Definition in file dynamicArray.c.

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.