ArrayList API functions


Detailed Description

Collection of elements.


Data Structures

struct  ArrayList

Functions

PORTABLE_API
ESR_ReturnCode 
ArrayListCreate (ArrayList **self)
PORTABLE_API
ESR_ReturnCode 
ArrayListCreateWithCapacity (ArrayList **self, size_t minCapacity)
PORTABLE_API
ESR_ReturnCode 
ArrayListAdd (ArrayList *self, void *element)
PORTABLE_API
ESR_ReturnCode 
ArrayListInsertAt (ArrayList *self, size_t index, void *element)
PORTABLE_API
ESR_ReturnCode 
ArrayListRemove (ArrayList *self, void *element)
PORTABLE_API
ESR_ReturnCode 
ArrayListRemoveAtIndex (ArrayList *self, size_t index)
PORTABLE_API
ESR_ReturnCode 
ArrayListRemoveAll (ArrayList *self)
PORTABLE_API
ESR_ReturnCode 
ArrayListContains (ArrayList *self, void *element, ESR_BOOL *exists)
PORTABLE_API
ESR_ReturnCode 
ArrayListGetSize (ArrayList *self, size_t *size)
PORTABLE_API
ESR_ReturnCode 
ArrayListGet (ArrayList *self, size_t index, void **element)
PORTABLE_API
ESR_ReturnCode 
ArrayListSet (ArrayList *self, size_t index, void *element)
PORTABLE_API
ESR_ReturnCode 
ArrayListClone (ArrayList *self, ArrayList *clone)
PORTABLE_API
ESR_ReturnCode 
ArrayListDestroy (ArrayList *self)


Function Documentation

PORTABLE_API ESR_ReturnCode ArrayListAdd ( ArrayList self,
void *  element 
)

Adds element to list.

Parameters:
self ArrayList handle
element Element to be added
Returns:
ESR_INVALID_ARGUMENT if self is null; ESR_OUT_OF_MEMORY is system is out of memory

PORTABLE_API ESR_ReturnCode ArrayListClone ( ArrayList self,
ArrayList clone 
)

Returns a clone of the ArrayList.

Parameters:
self ArrayList handle
clone [out] Clone of the ArrayList (created externally, populated internally)
Returns:
ESR_INVALID_ARGUMENT if self is null; ESR_ARGUMENT_OUT_OF_BOUNDS if index (used internally) is out of bounds ESR_OUT_OF_MEMORY is system is out of memory

PORTABLE_API ESR_ReturnCode ArrayListContains ( ArrayList self,
void *  element,
ESR_BOOL *  exists 
)

Indicates if element is contained within the list.

Parameters:
self ArrayList handle
element Element to check for
exists True if element was found
Returns:
ESR_INVALID_ARGUMENT if self is null

PORTABLE_API ESR_ReturnCode ArrayListCreate ( ArrayList **  self  ) 

Creates a new ArrayList.

Parameters:
self ArrayList handle
Returns:
ESR_INVALID_ARGUMENT if self or the value it points to are null; ESR_OUT_OF_MEMORY is system is out of memory

PORTABLE_API ESR_ReturnCode ArrayListCreateWithCapacity ( ArrayList **  self,
size_t  minCapacity 
)

Creates a new ArrayList with minimum capacity.

Parameters:
self ArrayList handle
minCapacity Minimum capacity of the array.
Returns:
ESR_INVALID_ARGUMENT if self or the value it points to are null; ESR_OUT_OF_MEMORY is system is out of memory

PORTABLE_API ESR_ReturnCode ArrayListDestroy ( ArrayList self  ) 

Destroys an ArrayList.

Parameters:
self ArrayList handle
Returns:
ESR_INVALID_ARGUMENT if self is null

PORTABLE_API ESR_ReturnCode ArrayListGet ( ArrayList self,
size_t  index,
void **  element 
)

Returns the element at the specified index.

Parameters:
self ArrayList handle
index Element index
element Element being returned
Returns:
ESR_INVALID_ARGUMENT if self is null; ESR_ARGUMENT_OUT_OF_BOUNDS if index is out of bounds

PORTABLE_API ESR_ReturnCode ArrayListGetSize ( ArrayList self,
size_t *  size 
)

Returns array size.

Parameters:
self ArrayList handle
size Returned size
Returns:
ESR_INVALID_ARGUMENT if self is null

PORTABLE_API ESR_ReturnCode ArrayListInsertAt ( ArrayList self,
size_t  index,
void *  element 
)

Inserts an element in the the list at the specified location. This causes all elements above or at the specified location to be shifted by one.

Parameters:
self ArrayList handle
index The index where to insert the element.
element The element to insert.
Returns:
ESR_SUCCESS if success or anaother value indicating the nature of the error. In particular, it returns ESR_ARGUMENT_OUT_OF_BOUNDS if index is less than 0 or greater than the array's size.

PORTABLE_API ESR_ReturnCode ArrayListRemove ( ArrayList self,
void *  element 
)

Removes element from list.

Parameters:
self ArrayList handle
element Element to be removed
Returns:
ESR_INVALID_ARGUMENT if self is null; ESR_OUT_OF_MEMORY is system is out of memory

PORTABLE_API ESR_ReturnCode ArrayListRemoveAll ( ArrayList self  ) 

Removes all elements from list.

Parameters:
self ArrayList handle
Returns:
ESR_INVALID_ARGUMENT if self is null

PORTABLE_API ESR_ReturnCode ArrayListRemoveAtIndex ( ArrayList self,
size_t  index 
)

Removes element from list at specified index.

Parameters:
self ArrayList handle
index Index of element to be removed
Returns:
ESR_INVALID_ARGUMENT if self is null; ESR_OUT_OF_MEMORY is system is out of memory; ESR_ARGUMENT_OUT_OF_BOUNDS if index is out of bounds

PORTABLE_API ESR_ReturnCode ArrayListSet ( ArrayList self,
size_t  index,
void *  element 
)

Sets the element at the specified index.

NOTE: Does *not* deallocate the element being overwritten.

Parameters:
self ArrayList handle
index Element index
element Element's new value
Returns:
ESR_INVALID_ARGUMENT if self is null; ESR_ARGUMENT_OUT_OF_BOUNDS if index is out of bounds


Generated on Thu May 1 15:37:26 2008 for SREC by  doxygen 1.5.3