Functions

Simple Array
[Utilities]

Collaboration diagram for Simple Array:

Functions

Iarray * iupArrayCreate (int start_max_count, int elem_size)
void iupArrayDestroy (Iarray *iarray)
void * iupArrayGetData (Iarray *iarray)
void * iupArrayInc (Iarray *iarray)
void * iupArrayAdd (Iarray *iarray, int add_count)
void * iupArrayInsert (Iarray *iarray, int index, int insert_count)
void iupArrayRemove (Iarray *iarray, int index, int remove_count)
int iupArrayCount (Iarray *iarray)

Detailed Description

Expandable array using a simple pointer.
See iup_array.h

Function Documentation

Iarray* iupArrayCreate ( int  start_max_count,
int  elem_size 
)

Creates an array with an initial room for elements, and the element size. The array count starts at 0. And the maximum number of elements starts at the given count. The maximum number of elements is increased by the start_max_count, every time it needs more memory. Data is always initialized with zeros. Must call iupArrayInc, iupArrayAdd or iupArrayInsert to properly increase the number of elements.

void iupArrayDestroy ( Iarray *  iarray  ) 

Destroys the array.

void* iupArrayGetData ( Iarray *  iarray  ) 

Returns the pointer that contains the array.

void* iupArrayInc ( Iarray *  iarray  ) 

Increments the number of elements in the array. The array count starts at 0. If the maximum number of elements is reached, the memory allocated is increased by the initial start count. Data is always initialized with zeros. Returns the pointer that contains the array.

void* iupArrayAdd ( Iarray *  iarray,
int  add_count 
)

Increments the number of elements in the array by a given count. New space is allocated at the end of the array. If the maximum number of elements is reached, the memory allocated is increased by the given count. Data is always initialized with zeros. Returns the pointer that contains the array.

void* iupArrayInsert ( Iarray *  iarray,
int  index,
int  insert_count 
)

Increments the number of elements in the array by a given count and moves the data so the new space starts at index. If the maximum number of elements is reached, the memory allocated is increased by the given count. Data is always initialized with zeros. Returns the pointer that contains the array.

void iupArrayRemove ( Iarray *  iarray,
int  index,
int  remove_count 
)

Remove the number of elements from the array.

int iupArrayCount ( Iarray *  iarray  ) 

Returns the actual number of elements in the array.