1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2024-11-10 06:18:06 +01:00
libcproject/lib/queue.h

52 lines
783 B
C
Raw Normal View History

#ifndef __LIBCPROJECT_QUEUE__
#define __LIBCPROJECT_QUEUE__
2023-01-05 19:28:05 +01:00
2023-01-07 19:38:01 +01:00
#include <stdio.h>
2023-01-05 19:28:05 +01:00
#include <stdlib.h>
2023-06-25 15:07:34 +02:00
#include "types.h"
/**
* @brief Queue structure => FIFO (First In First Out).
* @since v1.0.0
*/
2023-01-05 19:28:05 +01:00
struct queue {
struct queue_node *first;
size_t length;
};
/**
* @brief Queue node structure.
* @since v1.0.0
*/
2023-01-05 19:28:05 +01:00
struct queue_node {
void *data;
struct queue_node *next;
};
/**
* @brief Queue initialization.
* @since v1.0.0
*/
2023-01-05 19:28:05 +01:00
struct queue *queue_initialization();
/**
* @brief Push data to queue.
* @since v1.0.0
*/
2023-01-05 19:28:05 +01:00
void queue_push(struct queue *queue, void *data);
/**
* @brief Pop data from queue.
* @since v1.0.0
*/
2023-01-05 19:28:05 +01:00
void *queue_pop(struct queue *queue);
2023-08-03 22:57:32 +02:00
/**
* @brief Frees the queue.
* @since v2.1.0
*/
void queue_free(struct queue *queue);
2023-01-05 19:28:05 +01:00
#endif