VIMOS DRS Reference Manual  2.9.13
Functions
VimosImageArray

Functions

VimosImageArray * newImageArray (int size)
 Create an empty image array of appropriate size. More...
 
void deleteImageArray (VimosImageArray *array)
 Delete an image array object. More...
 
void destroyImageArray (VimosImageArray *array)
 Destroy an image array object. More...
 
int imageArrayIsEmpty (const VimosImageArray *array)
 Check if an image array object is empty. More...
 
int imageArrayCapacity (const VimosImageArray *array)
 Get the capacity of an image array. More...
 
int imageArraySize (const VimosImageArray *array)
 Get the number of images stored in an image array. More...
 
const VimosImage * imageArrayGet (const VimosImageArray *array, int index)
 The function retrieves an image from an image array object. More...
 
int imageArraySet (VimosImageArray *array, int index, const VimosImage *image)
 Set an element of an image array. More...
 
VimosImage * imageArrayRemove (VimosImageArray *array, int index)
 Remove an image from an image array object. More...
 
VimosImage ** imageArrayGetData (const VimosImageArray *array)
 Get reference to the array objects data. More...
 

Detailed Description

The module VimosImageArray implements a simple, fixed size array container for images.

Function Documentation

void deleteImageArray ( VimosImageArray *  array)

Delete an image array object.

Returns
Nothing.
Parameters
arrayImage array object to be deallocated.

The function deallocates the image array object array. The array object must be empty.

Note
If array is NULL nothing is done.
See Also
destroyImageArray
Author
R. Palsa
void destroyImageArray ( VimosImageArray *  array)

Destroy an image array object.

Returns
Nothing.
Parameters
arrayImage array object to be destroyed.

The function works as deleteImageArray(), but any image 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
deleteImageArray
Author
R. Palsa
int imageArrayCapacity ( const VimosImageArray *  array)

Get the capacity of an image array.

Returns
The function returns the image array's capacity.
Parameters
arrayImage array object.

The function reports the capacity of the array array, i.e. the maximum number of images which could be stored in the array.

Author
R. Palsa
const VimosImage* imageArrayGet ( const VimosImageArray *  array,
int  index 
)

The function retrieves an image from an image array object.

Returns
The function returns a handle to a stored image. If no image is associated to an array element NULL is returned.
Parameters
arrayImage array object.
indexArray element offset.

The function returns a reference to the image stored in the array array. The offset index is the usual C array offset, i.e. the first image is accessed by passing 0 as index.

See Also
imageArraySet
Author
R. Palsa
VimosImage** imageArrayGetData ( const VimosImageArray *  array)

Get reference to the array objects data.

Returns
The function returns the reference to the array data block. This function always succeeds.
Parameters
arrayImage 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 imageArrayIsEmpty ( const VimosImageArray *  array)

Check if an image array object is empty.

Returns
The function returns VM_TRUE if the array is empty, otherwise VM_FALSE is returned.
Parameters
arrayImage array object to be tested.

The function checks if any image is stored in the array.

Author
R. Palsa
VimosImage* imageArrayRemove ( VimosImageArray *  array,
int  index 
)

Remove an image from an image array object.

Returns
The function returns a handle to the removed image.
Parameters
arrayImage array object.
indexArray element offset.

The function removes the image stored at the array offset index and returns a reference to the removed image. The array element is reset to NULL. If no image was stored in the array element the function succeeds and the returned reference is NULL.

Author
R. Palsa
int imageArraySet ( VimosImageArray *  array,
int  index,
const VimosImage *  image 
)

Set an element of an image array.

Returns
The function returns EXIT_SUCCESS if no error occurred, or EXIT_FAILURE otherwise.
Parameters
arrayImage array object.
indexArray element offset.
imageImage object.

The functions stores the image image into the element with offset index of the image 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 image. If a stored image should be replaced by another image first use imageArrayRemove() to extract an image from the array object.

Note
One cannot use this function to reset an array element, i.e. one cannot pass NULL as image image.
See Also
imageArrayGet, imageArrayRemove
Author
R. Palsa
int imageArraySize ( const VimosImageArray *  array)

Get the number of images stored in an image array.

Returns
The function returns the number of stored images.
Parameters
arrayImage array object.

The function retrieves the number of images currently stored in the image array object array. The reported number is not the array objects capacity, i.e. the maximum number of images which could be stuffed into the array.

Author
R. Palsa
VimosImageArray* newImageArray ( int  size)

Create an empty image array of appropriate size.

Returns
The function returns the pointer to the allocated array object if no error occurred, or NULL otherwise.
Parameters
sizeSize of the image array.

The function allocates the memory for an image array of size elements. All array elements are initialized to to NULL.

Author
R. Palsa