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.

LibLapin's logo

LibLapin

Queue





The queue module header is lapin/container/queue.h.
typedef struct s_bunny_queue
{
     const size_t length;
     const void * const * const front;

} t‌_‌b‌u‌n‌n‌y‌_‌q‌u‌e‌u‌e;

Description

     This structure is the main data of the Queue container.

Attributes

  • const size_t length:
         The amount of elements in the Queue container.
  • const void * const * const * top:
         A pointer to the front data stored inside the queue. It is NULL if there is none.


INDEX


Description

     Create an Queue.

Return value

  • The function returns the address of the created Queue. Return NULL on error.

Error values and logs

On error, $Vb‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o is set to:


  • ENOMEM:
    Out of memory.


INDEX


Description

     Delete the sent queue. Do not delete elements that was stored.

Parameters

  • t_bunny_aqueue *queue:
         The queue to delete.

Return value

  • The function returns the amount of element that was stored inside it before being destroyed.

Logs

Logs written by this function are tagged with the "container" label.



INDEX


Description

     Return the amount of elements inside the Queue container.

Parameters


Return value

  • This function returns the amount of elements inside the Queue container.


INDEX


Description

     Return if the sent Queue container is empty.

Parameters


Return value

  • This function returns true if the sent Queue is empty.


INDEX


Description

     Return the element that is at the front of the sent Queue.

Parameters


Return value

  • This function returns the front element of the sent Queue or NULL if there is none.


INDEX


Description

     Push at the end of the Queue the sent data.

Parameters


Return value

  • This function return true if the sent data was added inside the queue.

Error values and logs

On error, b‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o is set to:


  • ENOMEM:

    Out of memory.


Logs written by this function are tagged with the "container" label.


Additional informations

This macro wraps a call to a real function, which is:

bool _b‌u‌n‌n‌y‌_‌q‌u‌e‌u‌e‌_‌p‌u‌s‌h(t‌_‌b‌u‌n‌n‌y‌_‌q‌u‌e‌u‌e *queue, void *data);



INDEX


Description

     Remove the front element from the sent Queue.

Parameters


Return value

  • This function return the popped value or NULL if there was none.

Error values and logs

On error, b‌u‌n‌n‌y‌_‌e‌r‌r‌n‌o is set to:


  • E_CONTAINER_IS_EMPTY:

    The queue you tried to pop is empty.


Logs written by this function are tagged with the "container" label.


Additional informations

This macro wraps a call to a real function, which is:

void *_b‌u‌n‌n‌y‌_‌q‌u‌e‌u‌e‌_‌p‌o‌p(t‌_‌b‌u‌n‌n‌y‌_‌q‌u‌e‌u‌e *queue);




INDEX