Table Arrays


Functions

VimosTableArray * newTableArray (int size)
 Create an empty table array of appropriate size.
void deleteTableArray (VimosTableArray *array)
 Delete an table array object.
void destroyTableArray (VimosTableArray *array)
 Destroy an table array object.
int tblArrayIsEmpty (const VimosTableArray *array)
 Check if an table array object is empty.
int tblArrayCapacity (const VimosTableArray *array)
 Get the capacity of an table array.
int tblArraySize (const VimosTableArray *array)
 Get the number of tables stored in an table array.
const VimosTable * tblArrayGet (const VimosTableArray *array, int index)
 The function retrieves an table from an table array object.
int tblArraySet (VimosTableArray *array, int index, const VimosTable *table)
 Set an element of an table array.
VimosTable * tblArrayRemove (VimosTableArray *array, int index)
 Remove an table from an table array object.
VimosTable ** tblArrayGetData (const VimosTableArray *array)
 Get reference to the array objects data.

Detailed Description

The module VimosTableArray implements a simple, fixed size array container for tables.

Function Documentation

void deleteTableArray ( VimosTableArray *  array  ) 

Delete an table array object.

Returns:
Nothing.
Parameters:
array Table array object to be deallocated.
The function deallocates the table array object array. The array object must be empty.

Note:
If array is NULL nothing is done.
See also:
destroyTableArray
Author:
R. Palsa

void destroyTableArray ( VimosTableArray *  array  ) 

Destroy an table array object.

Returns:
Nothing.
Parameters:
array Table array object to be destroyed.
The function works as deleteTableArray(), but any table which is stored in the array is deallocated prior to the deallocation of the array object array.

Note:
If array is NULL nothing is done.
See also:
deleteTableArray
Author:
R. Palsa

VimosTableArray* newTableArray ( int  size  ) 

Create an empty table array of appropriate size.

Returns:
The function returns the pointer to the allocated array object if no error occurred, or NULL otherwise.
Parameters:
size Size of the table array.
The function allocates the memory for an table array of size elements. All array elements are initialized to to NULL.

Author:
R. Palsa

int tblArrayCapacity ( const VimosTableArray *  array  ) 

Get the capacity of an table array.

Returns:
The function returns the table array's capacity.
Parameters:
array Table array object.
The function reports the capacity of the array array, i.e. the maximum number of tables which could be stored in the array.

Author:
R. Palsa

const VimosTable* tblArrayGet ( const VimosTableArray *  array,
int  index 
)

The function retrieves an table from an table array object.

Returns:
The function returns a handle to a stored table. If no table is associated to an array element NULL is returned.
Parameters:
array Table array object.
index Array element offset.
The function returns a reference to the table stored in the array array. The offset index is the usual C array offset, i.e. the first table is accessed by passing 0 as index.

See also:
tblArraySet
Author:
R. Palsa

VimosTable** tblArrayGetData ( const VimosTableArray *  array  ) 

Get reference to the array objects data.

Returns:
The function returns the reference to the array data block. This function always succeeds.
Parameters:
array Table array object.
The function returns a handle of the the array's data block.

Note:
This function should be used with care.
Author:
R. Palsa

int tblArrayIsEmpty ( const VimosTableArray *  array  ) 

Check if an table array object is empty.

Returns:
The function returns VM_TRUE if the array is empty, otherwise VM_FALSE is returned.
Parameters:
array Table array object to be tested.
The function checks if any table is stored in the array.

Author:
R. Palsa

VimosTable* tblArrayRemove ( VimosTableArray *  array,
int  index 
)

Remove an table from an table array object.

Returns:
The function returns a handle to the removed table.
Parameters:
array Table array object.
index Array element offset.
The function removes the table stored at the array offset index and returns a reference to the removed table. The array element is reset to NULL. If no table was stored in the array element the function succeeds and the returned reference is NULL.

Author:
R. Palsa

int tblArraySet ( VimosTableArray *  array,
int  index,
const VimosTable *  table 
)

Set an element of an table array.

Returns:
The function returns EXIT_SUCCESS if no error occurred, or EXIT_FAILURE otherwise.
Parameters:
array Table array object.
index Array element offset.
table Table object.
The functions stores the table table into the element with offset index of the table array object array. To be successfull index must be equal or larger than 0, smaller than the array's capacity and the array element must not already reference another table. If a stored table should be replaced by another table first use tableArrayRemove() to extract an table from the array object.

Note:
One cannot use this function to reset an array element, i.e. one cannot pass NULL as table table.
See also:
tblArrayGet, tblArrayRemove
Author:
R. Palsa

int tblArraySize ( const VimosTableArray *  array  ) 

Get the number of tables stored in an table array.

Returns:
The function returns the number of stored tables.
Parameters:
array Table array object.
The function retrieves the number of tables currently stored in the table array object array. The reported number is not the array objects capacity, i.e. the maximum number of tables which could be stuffed into the array.

Author:
R. Palsa


Generated on Mon Mar 14 15:55:43 2011 for VIMOS DRS Reference Manual by  doxygen 1.4.7