C Tool Box 0.1.0
Loading...
Searching...
No Matches
ctb_Queue.h
Go to the documentation of this file.
1/**
2 * @file
3 */
4#ifndef CTB_QUEUE_H
5#define CTB_QUEUE_H
6
7/**
8 * @brief Queue type
9 */
10typedef struct ctb_Queue ctb_Queue_t;
11
12#include "ctb_DList.h"
13#include <stdbool.h>
14
15/**
16 * @brief Queue data structure
17 */
18struct ctb_Queue {
19 ctb_DList_t list;
20};
21
22/**
23 * @brief Initializes a queue
24 *
25 * @param self Pointer to a queue
26 * @return Pointer to the initialized queue
27 */
29
30/**
31 * @brief Checks if the queue is empty
32 *
33 * @param self Pointer to a queue
34 * @return True if the queue is empty, false otherwise
35 */
36bool ctb_Queue_isEmpty(ctb_Queue_t * const self);
37
38/**
39 * @brief Adds a node at the end of the queue
40 *
41 * @param self Pointer to a queue
42 * @param node Pointer to the node to add
43 */
45 ctb_Queue_t * const self, ctb_DNode_t * const node
46);
47
48/**
49 * @brief Removes and returns the first node from the queue
50 *
51 * @param self Pointer to a queue
52 * @return Pointer to the first node in the queue
53 */
55
56/**
57 * @brief Clears the queue
58 *
59 * @param self Pointer to a queue
60 */
61void ctb_Queue_clear(ctb_Queue_t * const self);
62
63#endif // CTB_QUEUE_H
void ctb_Queue_enqueue(ctb_Queue_t *const self, ctb_DNode_t *const node)
Adds a node at the end of the queue.
Definition ctb_Queue.c:15
ctb_Queue_t * ctb_Queue_init(ctb_Queue_t *const self)
Initializes a queue.
Definition ctb_Queue.c:4
bool ctb_Queue_isEmpty(ctb_Queue_t *const self)
Checks if the queue is empty.
Definition ctb_Queue.c:10
ctb_DNode_t * ctb_Queue_dequeue(ctb_Queue_t *const self)
Removes and returns the first node from the queue.
Definition ctb_Queue.c:22
void ctb_Queue_clear(ctb_Queue_t *const self)
Clears the queue.
Definition ctb_Queue.c:27
Doubly linked list data structure.
Definition ctb_DList.h:20
Doubly linked node data structure.
Definition ctb_DNode.h:15
Queue data structure.
Definition ctb_Queue.h:18