LibCapy - list

Generic list class.

Macros:

Iterator for generic list structure. Declaration macro for an iterator structure named 'name' ## Iterator, associated to a list named 'name' containing elements of type 'type'

Create an iterator on a generic list

Input argument(s):

list: the generic list on which to iterate
type: the type of iterator

Output and side effect(s):

Return the iterator

Allocate memory and create an iterator on a generic list

Input argument(s):

list: the generic list on which to iterate
type: the type of iterator

Output and side effect(s):

Return the iterator

Free the memory used by an iterator.

Input argument(s):

that: the iterator to free

Free the memory used by a pointer to an iterator and reset '*that' to NULL

Input argument(s):

that: a pointer to the iterator to free

Reset the iterator

Output and side effect(s):

Return the first element of the iteration

Move the iterator to the previous element

Output and side effect(s):

Return the previous element of the iteration

Move the iterator to the next element

Output and side effect(s):

Return the next element of the iteration

Check if the iterator is on a valid element

Output and side effect(s):

Return true if the iterator is on a valid element, else false

Get the current element of the iteration

Output and side effect(s):

Return a pointer to the current element

Set the type of the iterator and reset it

Input argument(s):

type: the new type of the iterator

Return true if the iterator is on the first element of the iteration

Output and side effect(s):

Return true or false

Return true if the iterator is on the last element of the iteration

Output and side effect(s):

Return true or false

Move the iterator to the last element of the iteration

Definition macro calling all the submacros at once for an iterator on an array structure named 'name', containing elements of type 'type'

Generic double linked list structure. Declaration macro for a list structure named 'name', containing elements of type 'type'

Definition macro and submacros for a list named 'name', containing elements of type 'type' Create a list containing elements of type 'type'

Output and side effect(s):

Return a list

Allocate memory for a new array and create it

Output and side effect(s):

Return an array containing 'size_' elements of type 'type'

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a list.

Input argument(s):

that: the list to free

Free the memory used by a pointer to a list and reset '*that' to NULL

Input argument(s):

that: a pointer to the list to free

Get the size of a list Output Return the size of the list

Push an element to the head of a list

Input argument(s):

val: the element's value

Exception(s):

May raise CapyExc_MallocFailed.

Add an element to the tail of a list

Input argument(s):

val: the element's value

Exception(s):

May raise CapyExc_MallocFailed.

Remove an element from the head of a list

Output and side effect(s):

Return the removed element's value

Remove an element from the tail of a list

Output and side effect(s):

Return the removed element's value

Get the value of the element in the list at the given position

Output and side effect(s):

Return the element's value

Get a pointer to the value of the element in the list at the given position

Output and side effect(s):

Return the pointer to the element's value

Empty the list by removing all its elements

Get the value of the element at the head of the list

Output and side effect(s):

Return the element's value

Get the value of the element at the tail of the list

Output and side effect(s):

Return the element's value

Get a pointer to the value of the element at the head of the list

Output and side effect(s):

Return the pointer to the element's value

Get a pointer to the value of the element at the tail of the list

Output and side effect(s):

Return the pointer to the element's value

Check if a list is empty

Output and side effect(s):

Return true if the list is empty, else false

Initialise the iterator of the list, must be called after the creation of the list when it is created with Create(), Alloc() automatically initialise the iterator.

Definition macro calling all the submacros at once for a list structure named 'name', containing elements of type 'type'

Enumerations:

Enumeration for the types of iterator on generic list

Typedefs:

None.

Functions:

None.

2021-11-08
in LibCapy,
59 views
Copyright 2021-2024 Baillehache Pascal