XBinder  Version 2.6.x
Functions
rtxArrayList.h File Reference

ArrayList functions. More...

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.

Functions

EXTERNRT void rtxArrayListInit (OSRTArrayList *pArrayList, OSSIZE capacity)
 This function initializes an array list structure. More...
 
EXTERNRT OSRTArrayList * rtxNewArrayList (OSCTXT *pctxt, OSSIZE capacity)
 This function creates a new array list to hold the initial capacity of elements. More...
 
EXTERNRT void rtxFreeArrayList (OSCTXT *pctxt, OSRTArrayList *pArrayList)
 This function frees all dynamic memory held by the array list. More...
 
EXTERNRT int rtxArrayListAdd (OSCTXT *pctxt, OSRTArrayList *pArrayList, void *pdata, OSSIZE *pindex)
 This function adds an element to an array list. More...
 
EXTERNRT void rtxArrayListRemove (OSCTXT *pctxt, OSRTArrayList *pArrayList, void *pdata)
 This function removes an element from an array list. More...
 
EXTERNRT void rtxArrayListRemoveIndexed (OSCTXT *pctxt, OSRTArrayList *pArrayList, OSSIZE idx)
 This function removes the element at the given index from the array list. More...
 
EXTERNRT int rtxArrayListInsert (OSCTXT *pctxt, OSRTArrayList *pArrayList, void *pdata, OSSIZE idx)
 This function inserts an element at the given position in the array list. More...
 
EXTERNRT int rtxArrayListReplace (OSRTArrayList *pArrayList, void *pdata, OSSIZE idx)
 This function replaces (overwrites) the element at the given position in the array list with the new element. More...
 
EXTERNRT void * rtxArrayListGetIndexed (const OSRTArrayList *pArrayList, OSSIZE idx)
 This function gets the indexed data item from the array list. More...
 
EXTERNRT int rtxArrayListIndexOf (OSRTArrayList *pArrayList, void *pdata)
 This function returns the index of the given data item in the list. More...
 
EXTERNRT int rtxArrayListInitIter (OSRTArrayListIter *piter, const OSRTArrayList *pArrayList, OSSIZE startIndex)
 This function initializes an array list iterator with the given start index. More...
 
EXTERNRT OSBOOL rtxArrayListHasNextItem (OSRTArrayListIter *piter)
 This function determines if another element exists at the next sequential position in the array list. More...
 
EXTERNRT void * rtxArrayListNextItem (OSRTArrayListIter *piter)
 This function gets the next item from the array list. More...
 

Detailed Description

ArrayList functions.

Definition in file rtxArrayList.h.

Function Documentation

◆ rtxArrayListAdd()

EXTERNRT int rtxArrayListAdd ( OSCTXT pctxt,
OSRTArrayList *  pArrayList,
void *  pdata,
OSSIZE *  pindex 
)

This function adds an element to an array list.

Parameters
pctxtPointer to a context structure.
pArrayListPointer to array list structure to initialize.
pdataPointer to data item to add.
pindexPointer to index variable to receive index at which entry was added.
Returns
Zero if item was successfully added; a negative status code if error.

◆ rtxArrayListGetIndexed()

EXTERNRT void* rtxArrayListGetIndexed ( const OSRTArrayList *  pArrayList,
OSSIZE  idx 
)

This function gets the indexed data item from the array list.

Parameters
pArrayListPointer to array list structure to initialize.
idxIndex of location where item should be inserted.
Returns
Pointer to indexed data item or NULL if index is greater than max index in list.

◆ rtxArrayListHasNextItem()

EXTERNRT OSBOOL rtxArrayListHasNextItem ( OSRTArrayListIter *  piter)

This function determines if another element exists at the next sequential position in the array list.

Parameters
piterPointer to array list iterator structure.
Returns
True if another element exists; false otherwise.

◆ rtxArrayListIndexOf()

EXTERNRT int rtxArrayListIndexOf ( OSRTArrayList *  pArrayList,
void *  pdata 
)

This function returns the index of the given data item in the list.

The 'equals' callback function is used to do comparisons.

Parameters
pArrayListPointer to array list structure to initialize.
pdataPointer to data item to find in list.
Returns
Index of item in list or -1 if not found.

◆ rtxArrayListInit()

EXTERNRT void rtxArrayListInit ( OSRTArrayList *  pArrayList,
OSSIZE  capacity 
)

This function initializes an array list structure.

Parameters
pArrayListPointer to array list structure to initialize.
capacityInitial capacity of the array or zero to use default.

◆ rtxArrayListInitIter()

EXTERNRT int rtxArrayListInitIter ( OSRTArrayListIter *  piter,
const OSRTArrayList *  pArrayList,
OSSIZE  startIndex 
)

This function initializes an array list iterator with the given start index.

Parameters
piterPointer to array list iterator structure.
pArrayListPointer to array list structure.
startIndexIndex from which iteration is to start.
Returns
Zero if successfully initialized or RTERR_OUTOFBND if start index is beyond the current size of the array list.

◆ rtxArrayListInsert()

EXTERNRT int rtxArrayListInsert ( OSCTXT pctxt,
OSRTArrayList *  pArrayList,
void *  pdata,
OSSIZE  idx 
)

This function inserts an element at the given position in the array list.

Parameters
pctxtPointer to a context structure.
pArrayListPointer to array list structure to initialize.
pdataPointer to data item to insert.
idxIndex of location where item should be inserted.
Returns
Zero if item was successfully added; a negative status code if error.

◆ rtxArrayListNextItem()

EXTERNRT void* rtxArrayListNextItem ( OSRTArrayListIter *  piter)

This function gets the next item from the array list.

Parameters
piterPointer to array list iterator structure.
Returns
Pointer to next item or null if beyond the end of the array.

◆ rtxArrayListRemove()

EXTERNRT void rtxArrayListRemove ( OSCTXT pctxt,
OSRTArrayList *  pArrayList,
void *  pdata 
)

This function removes an element from an array list.

Parameters
pctxtPointer to a context structure.
pArrayListPointer to array list structure to initialize.
pdataPointer to data item to remove.

◆ rtxArrayListRemoveIndexed()

EXTERNRT void rtxArrayListRemoveIndexed ( OSCTXT pctxt,
OSRTArrayList *  pArrayList,
OSSIZE  idx 
)

This function removes the element at the given index from the array list.

Parameters
pctxtPointer to a context structure.
pArrayListPointer to array list structure to initialize.
idxIndex of item to remove. -1 indicates tail item should be removed.

◆ rtxArrayListReplace()

EXTERNRT int rtxArrayListReplace ( OSRTArrayList *  pArrayList,
void *  pdata,
OSSIZE  idx 
)

This function replaces (overwrites) the element at the given position in the array list with the new element.

Parameters
pArrayListPointer to array list structure to initialize.
pdataPointer to data item to insert.
idxIndex of location where item should be inserted.
Returns
Zero if item was successfully added; a negative status code if error.

◆ rtxFreeArrayList()

EXTERNRT void rtxFreeArrayList ( OSCTXT pctxt,
OSRTArrayList *  pArrayList 
)

This function frees all dynamic memory held by the array list.

It does not free the array list structure itself, just the internal data array.

Parameters
pctxtPointer to a context structure.
pArrayListPointer to array list structure.

◆ rtxNewArrayList()

EXTERNRT OSRTArrayList* rtxNewArrayList ( OSCTXT pctxt,
OSSIZE  capacity 
)

This function creates a new array list to hold the initial capacity of elements.

Parameters
pctxtPointer to a context structure.
capacityInitial capacity of the array or zero to use default.
Returns
Allocated array list structure or NULL if insufficient dynamic memory is available to hold the structure.