|
GLG Toolkit, C / C++ API Library
Version 4.6
|
This group contains Simple Array functions that allow to use a dynamic array functionality without the Intermediate and Extended APIs. More...
This group contains Simple Array functions that allow to use a dynamic array functionality without the Intermediate and Extended APIs.
A Simple Array is a GLG dynamic array object that can be used to hold a variable number of elements, but, unlike a Container, cannot be added to the drawing to draw its elements.
The Simple Array functions have the same functionality as the corresponding Container Functions of the Intermediate and Extended APIs, but can be used when only the Standard API is available.
These functions work only with with a Simple Arraycreated by GlgArrayCreate and can't be used to add or delete objects from the drawing. The Simple Array functions can't be used in place of the corresponding Container Functions of the Intermediate and Extended APIs for accessing GLG Container objects.
Functions | |
| GlgBoolean | GlgArrayAddAt (GlgObject object, GlgAnyType elem, GlgLong add_index) |
| Insert an element at the specified position in the Simple Array. More... | |
| GlgBoolean | GlgArrayAddToBottom (GlgObject object, GlgAnyType elem) |
| Add an element at the end of the Simple Array. More... | |
| GlgBoolean | GlgArrayAddToTop (GlgObject object, GlgAnyType elem) |
| Add an element at the beginning of the Simple Array. More... | |
| GlgObject | GlgArrayCreate (GlgLong init_size, GlgLong increment) |
| Creates a Simple Array object. More... | |
| GlgBoolean | GlgArrayDeleteAt (GlgObject object, GlgLong delete_index) |
| Deletes an element at the specified position in the Simple Array. More... | |
| GlgBoolean | GlgArrayDeleteFirst (GlgObject object) |
| Deletes the first element of the Simple Array. More... | |
| GlgBoolean | GlgArrayDeleteLast (GlgObject object) |
| Deletes the last element of the Simple Array. More... | |
| void | GlgArrayFlush (GlgObject object, GlgLong size) |
| Set the size of a Simple Array. More... | |
| GlgAnyType | GlgArrayGetElement (GlgObject object, GlgLong index) |
| Returns the element at the specified position in a Simple Array. More... | |
| GlgLong | GlgArrayGetIndex (GlgObject object, GlgAnyType elem) |
| Returns the index of the first occurrence of an element in the Simple Array. More... | |
| GlgLong | GlgArrayGetSize (GlgObject object) |
| Queries the size of a Simple Array. More... | |
| GlgBoolean | GlgArraySetElement (GlgObject object, GlgLong elem_index, GlgAnyType elem) |
| Sets the value of an element at the specified position in a Simple Array. More... | |
| GlgBoolean GlgArrayAddAt | ( | GlgObject | object, |
| GlgAnyType | elem, | ||
| GlgLong | add_index | ||
| ) |
Insert an element at the specified position in the Simple Array.
| object | Simple Array object. |
| elem | The element to add. |
| add_index | The position at which the new element will be inserted. |
All elements at and below the insertion point will be shifted down inside the array.
| GlgBoolean GlgArrayAddToBottom | ( | GlgObject | object, |
| GlgAnyType | elem | ||
| ) |
Add an element at the end of the Simple Array.
| object | Simple Array object. |
| elem | The element to add. |
| GlgBoolean GlgArrayAddToTop | ( | GlgObject | object, |
| GlgAnyType | elem | ||
| ) |
Add an element at the beginning of the Simple Array.
| object | Simple Array object. |
| elem | The element to add. |
Creates a Simple Array object.
| init_size | Initial size of the dynamic array. A default size is used if the parameter value is 0. |
| increment | Size increment used to increase the size of the array. A default increment is used if the parameter value is 0. |
The created dynamic array has elements of GlgAnyType that can hold either GlgLong elements or pointers. The array is created with the initial size specified by the initial_size parameter. When new elements are added to the array, it will increase its size using the specified size increment.
| GlgBoolean GlgArrayDeleteAt | ( | GlgObject | object, |
| GlgLong | delete_index | ||
| ) |
Deletes an element at the specified position in the Simple Array.
| object | Simple Array object. |
| delete_index | The index of the element to delete. |
All elements below the deleted element will be shifted up inside the array.
| GlgBoolean GlgArrayDeleteFirst | ( | GlgObject | object | ) |
Deletes the first element of the Simple Array.
| object | Simple Array object. |
All remaining array elements will be shifted up inside the array.
| GlgBoolean GlgArrayDeleteLast | ( | GlgObject | object | ) |
Deletes the last element of the Simple Array.
| object | Simple Array object. |
Set the size of a Simple Array.
| object | Simple Array object. |
| size | The new size. |
This function sets the array size to the requested size. If the new size is less than the current array size, extra elements are removed. If the new size is greater than the current size, the function adds elements by making a copy of the last element in the array.
It is the responsibility of an application to free any associated memory (if any) when elements are deleted from the array.
| GlgAnyType GlgArrayGetElement | ( | GlgObject | object, |
| GlgLong | index | ||
| ) |
Returns the element at the specified position in a Simple Array.
| object | Simple Array object. |
| index | Element position inside the array. |
If the specified index is invalid, an error message is generated and NULL is returned.
| GlgLong GlgArrayGetIndex | ( | GlgObject | object, |
| GlgAnyType | elem | ||
| ) |
Returns the index of the first occurrence of an element in the Simple Array.
| object | Simple Array object. |
| elem | The element to search for. |
| GlgBoolean GlgArraySetElement | ( | GlgObject | object, |
| GlgLong | elem_index, | ||
| GlgAnyType | elem | ||
| ) |
Sets the value of an element at the specified position in a Simple Array.
| object | Simple Array object. |
| elem_index | The index of the array element whose value to set. |
| elem | The new element value. |