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.
Map
The map module header is lapin/container/map.h.
Description
$ This function pointer type is part of the
t_bunny_map structure
and is useful to compare two
keys in order to search or sort
items in the map container.
If this pointer is not set, then keys will be compared as size_t.
Parameters
-
void *a:
  The element to compare with b.
-
void *b:
  The element to compare with a.
-
void *param:
  An arbitrary parameter defined as param in t_bunny_map.
Return value
Return a positive integer if a is greater tha b. Equal to zero
if they are equal. Negative if b is greater than a.
INDEX
Parameters
-
void *a:
  The element to duplicate.
-
void *param:
  An arbitrary parameter defined as param in t_bunny_map.
Return value
a's duplicata or NULL on error.
INDEX
Parameters
-
void *a:
  The element to free.
-
void *param:
  An arbitrary parameter defined as param in t_bunny_map.
INDEX
Attributes
-
const void * const data:
  A data store inside this current node.
-
const void * const key:
  The key of the current node.
-
size_t nbr_children:
  How many nodes are under this one, directly or indirectly.
-
struct s_bunny_map * const up:
  The parent of the current node. If NULL, it means
the current node is a root node.
-
struct s_bunny_map * const right:
  A node that contains greater keys than the current one.
-
struct s_bunny_map * const left:
  A node that contains lower keys than the current one.
-
const t_bunny_map_cmp cmp:
  A function pointer to compare keys. If NULL, the default value,
keys are compared like size_t.
-
const t_bunny_map_dup dup:
  A function pointer to duplicate keys. If NULL, the default value,
keys fields are copied directly from parameters. (Making, possibily, a shallow
copy)
-
const t_bunny_map_del del:
  A function pointer to delete keys. If NULL, the default value,
keys are not deleted. This function pointer should be set to a valid
function if you set a function to the dup field.
-
const void * const param:
  An arbitrary value that will be sent to cmp, dup and
del as last parameter.
INDEX
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "container" label.
INDEX
Description
  Delete the sent map. Returns how many elements there was inside.
Return value
This functions returns how many elements there was inside the map.
INDEX
Description
  Clear the content the sent map node. Returns how many elements there was inside.
Return value
This functions returns how many elements there was inside the map.
INDEX
Description
  Returns how many elements there is in the map.
Return value
This functions returns how many elements there is in the map.
INDEX
Description
  Returns if the map is empty.
Return value
This functions returns if the map is empty.
INDEX
Description
  Retrieve a node from the sent map associated with key,
create it or not if it does not exist.
Parameters
-
t_bunny_map *map:
  The map to browse and eventually edit.
-
void *key:
  The key associated to the node you want to fetch or create.
-
bool create:
  If true and the node associated to key does not exists, create it.
Return value
-
On success, the function returns the address of the found or created node.
-
On failure, it returns NULL.
Error values and logs
On error, $Vbunny_errno is set to:
Logs written by this function are tagged with the "container" label.
INDEX
Description
  Get the data inside the sent map node, which is of type type.
Parameters
-
t_bunny_map *map:
  The map node in which there is the data you want.
-
type:
  The type of the data you want to get.
Return value
It returns the data inside the sent map node, of type type.
INDEX
Description
  Get the data inside the sent map at key, which is of type type.
Parameters
-
t_bunny_map *map:
  The map node in which there is the data you want.
-
key:
  The key of the element you want to get.
-
type:
  The type of the data you want to get, any type is possible.
Return value
It returns the data inside the sent map at key, of type type.
INDEX
Description
  Set data inside the sent map at key, which is of type type.
Parameters
-
t_bunny_map *map:
  The map node in which there is the data you want.
-
key:
  The key of the element you want to set.
-
data:
  The data you want to set.
-
type:
  The type of the data you want to set, any type is possible.
Return value
It returns the data inside the sent map at key, of type type.
INDEX
Description
  Call function with every nodes of map as first parameter,
one after the other. Send param as second parameter.
INDEX
Description
  Call function with every nodes of map 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