Bienvenue sur le site de la LibLapin.
Jetez un coup d'oeil en bas de la page pour choisir votre niveau de documentation en fonction de votre niveau avec la LibLapin.
Pour l'instant, c'est réglé sur 'Manuel complet'. Si c'est votre première fois avec la LibLapin, il vaudrait mieux choisir 'Débutant'.
De même, n'oubliez pas de préciser une version de la bibliothèque.
List
The list module header is lapin/container/list.h.
Description
  A linked list node. It is double linked list so you can get both neighboors.
Attributes
-
void *data:
  The data stored inside the node.
-
t_bunny_node * const next:
  The next node. NULL if the current one is the last.
-
t_bunny_node * const prev:
  The prev node. NULL if the current one is the first.
INDEX
Description
  The main structure of the list container.
Attributes
-
const size_t length:
  How many nodes inside the current list.
-
t_bunny_node * const front:
  The first node of the list. NULL if the list is empty.
-
t_bunny_node * const back:
  The last node of the list. NULL if the list is empty.
INDEX
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "allocator" label.
INDEX
Description
  Delete the sent list and all nodes. Returns how many of them there was.
Return value
Returns how many element there was inside the list.
INDEX
Description
  Returns the size of the sent list.
Return value
Returns how many element there is inside the list.
INDEX
Description
  Returns if the sent list is empty.
Return value
Returns true if the list is empty, else false.
INDEX
Description
  Returns the first element of the list if there is one.
Parameters
-
t_bunny_list *list:
  The list to extract an element from.
-
type:
  The type of elements stored inside the list, the type of the
data you are going to fetch.
Return value
Return the first element of the sent list or NULL if it is empty.
INDEX
Description
  Returns the last element of the list if there is one.
Parameters
-
t_bunny_list *list:
  The list to extract an element from.
-
type:
  The type of elements stored inside the list, the type of the
data you are going to fetch.
Return value
Return the last element of the sent list or NULL if it is empty.
INDEX
Description
  Add the sent data at first element of list, making the previous
first element the second one.
Parameters
-
t_bunny_list *list:
  The list to enlarge.
-
data:
  A data to any type to push at the front of the list.
Return value
Return true if everything went well.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "container" label.
INDEX
Description
  Add the sent data at last element of list.
Parameters
-
t_bunny_list *list:
  The list to enlarge.
-
data:
  A data to any type to push at the end of the list.
Return value
Return true if everything went well.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "container" label.
INDEX
Description
  Remove the first node of the list and return its data.
Return value
Return the value that was on front. NULL if the list was empty.
Error values and logs
On error, $Vbunny_errno is set to:
-
BE_CONTAINER_IS_EMPTY:
The list is empty.
Logs written by this function are tagged with the "container" label.
INDEX
Description
  Remove the last node of the list and return its data.
Return value
Return the value that was on back. NULL if the list was empty.
Error values and logs
On error, $Vbunny_errno is set to:
-
BE_CONTAINER_IS_EMPTY:
The list is empty.
Logs written by this function are tagged with the "container" label.
INDEX
Description
  Empty the sent list.
INDEX
Description
  Generate a new list with elements accepted by filter_function.
Parameters
-
t_bunny_list *list:
  The list to filter.
-
bool (*filter_function)(const void *listed, void *param):
  A function that will receive an element from the list and the third
parameter of bunny_list_filter. It must return true to add the received
element to the generated list, false to not include it.
-
void *void:
  An arbitrary to send to filter_function as second parameter.
Return value
Return the generated list. NULL on error.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "container" label.
INDEX
Description
  Sort the sent list thanks to the comparator function sort_function.
Parameters
-
t_bunny_list *list:
  The list to filter.
-
int (*sort_function)(const void *a, const void *$b,
void *param):
  A function that will receive two elements from the list and the third
parameter of bunny_list_sort. It must return an integer, positive if a
is greater than b, negative if b is greater than a or zero
if they are equal.
-
void *void:
  An arbitrary to send to sort_function as second parameter.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "container" label.
INDEX
Description
  Return the data inside the sent node with the correct type.
Parameters
-
const t_bunny_node *node:
  The node to fetch the data from.
-
type:
  The type of the data to fetch.
Return value
The fetched data
INDEX
Description
  Return the first node of the sent list.
Return value
Return the first node of the sent list or NULL if it is empty.
INDEX
Description
  Return the last node of the sent list, so you can browse it in reverse order.
Return value
Return the last node of the sent list or NULL if it is empty.
INDEX
Description
  Return the next node of the sent one.
Return value
Return the next node of the sent one or NULL if it is the last one.
INDEX
Description
  Return the previous node of the sent one.
Return value
Return the previous node of the sent one or NULL if it is the first one.
INDEX
Description
  Generate a vector a copy of all elements inside the list.
Parameters
-
t_bunny_list *list:
  The list to transform.
-
type:
  The type of the vector and of the data inside the list.
Return value
Return the newly created vector or NULL on error.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "container" label.
INDEX
Description
  Call function with every nodes of list as first parameter,
one after the other. Send param as second parameter.
Parameters
-
t_bunny_list *list:
  The list that got the elements you want to be computed by
bunny_list_foreach.
-
void (*function)(void *data, void *param):
  The function to call with every nodes of the sent list.
-
void *param:
  The parameter sent to function as the second one.
INDEX
Description
  Call function with every data of list as first parameter throught
threads from pool, one after the other. Send param as second parameter.
Return value
-
On complete success, the function returns true.
-
On failure, it returns false. Failire indicates all
datas were not treated by threads, some of them may have been
treated by the main thread because of a thread pool memory exhaustion.
Elements are always all computed.
INDEX
Description
  This macro generate the code for the content of a for loop that browse
from the beginning to the end of the sent list.
INDEX
Description
  This macro generate the code for the content of a for loop that browse
from the end to the beginning of the sent list.
INDEX