Merge pull request 'v4.0.4-rc' (#7) from release/v4.0.4-rc into main
Reviewed-on: #7
This commit is contained in:
commit
8140187d22
@ -18,6 +18,8 @@
|
||||
#ifndef GLACIERDATA_H_
|
||||
#define GLACIERDATA_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/*
|
||||
* create_node
|
||||
*
|
||||
@ -58,7 +60,7 @@ void add_child(struct node *parent, struct node *child);
|
||||
/*
|
||||
* print_tree
|
||||
*
|
||||
* DESCRIPTION: Print_tree prints a dependency tree specified at its root node
|
||||
* DESCRIPTION: Print_tree prints a dependency tree specified at its root node.
|
||||
* PARAMETERS:
|
||||
* struct node *root -> The tree to print
|
||||
* int level -> The number of levels to descend
|
||||
@ -74,6 +76,16 @@ void print_tree(struct node *root, int level);
|
||||
|
||||
/**************************************************************************************************************/
|
||||
|
||||
/*
|
||||
* queue
|
||||
*
|
||||
* DESCRIPTION: Queue is a type definition for the queue data structure.
|
||||
*/
|
||||
|
||||
typedef struct queue;
|
||||
|
||||
/**************************************************************************************************************/
|
||||
|
||||
/*
|
||||
* init_queue
|
||||
*
|
||||
@ -95,7 +107,7 @@ void init_queue(queue *q);
|
||||
/*
|
||||
* queue_is_empty
|
||||
*
|
||||
* DESCRIPTION: Queue_is_empty checks if queue *q is empty
|
||||
* DESCRIPTION: Queue_is_empty checks if queue *q is empty.
|
||||
* PARAMETERS:
|
||||
* queue *q -> The queue to check
|
||||
* RETURN VALUES:
|
||||
@ -116,7 +128,7 @@ bool queue_is_empty(queue *q);
|
||||
/*
|
||||
* queue_is_full
|
||||
*
|
||||
* DESCRIPTION: Queue_is_full checks if queue *q is full
|
||||
* DESCRIPTION: Queue_is_full checks if queue *q is full.
|
||||
* PARAMETERS:
|
||||
* queue *q -> The queue to check
|
||||
* RETURN VALUES:
|
||||
@ -137,20 +149,80 @@ bool queue_is_full(queue *q);
|
||||
/*
|
||||
* enqueue
|
||||
*
|
||||
* DESCRIPTION: Enqueue enqueues an element at the back of the queue
|
||||
* DESCRIPTION: Enqueue enqueues an element at the back of the queue.
|
||||
* PARAMETERS:
|
||||
* queue *q -> The queue to enqueue to
|
||||
* int value ->
|
||||
* int value -> The value of the element to enqueue
|
||||
* RETURN VALUES:
|
||||
* true on full, false on not full
|
||||
* None.
|
||||
* CAVEATS:
|
||||
* None.
|
||||
* EXAMPLE:
|
||||
* if (queue_is_full(q)) {
|
||||
* printf("Queue is full\n");
|
||||
* return;
|
||||
* if (! queue_is_full(q)) {
|
||||
* enqueue(q, 15);
|
||||
* }
|
||||
*/
|
||||
|
||||
void enqueue(queue *q, int value);
|
||||
|
||||
/**************************************************************************************************************/
|
||||
|
||||
/*
|
||||
* dequeue
|
||||
*
|
||||
* DESCRIPTION: Dequeue dequeues an element at the front of the queue.
|
||||
* PARAMETERS:
|
||||
* queue *q -> The queue to dequeue to
|
||||
* RETURN VALUES:
|
||||
* None.
|
||||
* CAVEATS:
|
||||
* None.
|
||||
* EXAMPLE:
|
||||
* if (! queue_is_empty(q)) {
|
||||
* dequeue(q);
|
||||
* }
|
||||
*/
|
||||
|
||||
void dequeue(queue *q);
|
||||
|
||||
/**************************************************************************************************************/
|
||||
|
||||
/*
|
||||
* peek
|
||||
*
|
||||
* DESCRIPTION: Peek displays the first element in a specified queue.
|
||||
* PARAMETERS:
|
||||
* queue *q -> The queue to peek at
|
||||
* RETURN VALUES:
|
||||
* -1 on queue is empty, element value (!= -1) on success
|
||||
* CAVEATS:
|
||||
* None.
|
||||
* EXAMPLE:
|
||||
* if (! queue_is_full(q)) {
|
||||
* peek(q);
|
||||
* }
|
||||
*/
|
||||
|
||||
int peek(queue *q);
|
||||
|
||||
/**************************************************************************************************************/
|
||||
|
||||
/*
|
||||
* print_queue
|
||||
*
|
||||
* DESCRIPTION: Print_queue displays the contents of the queue in order.
|
||||
* PARAMETERS:
|
||||
* queue *q -> The queue to print
|
||||
* RETURN VALUES:
|
||||
* None.
|
||||
* CAVEATS:
|
||||
* None.
|
||||
* EXAMPLE:
|
||||
* if (! queue_is_full(q)) {
|
||||
* print_queue(q);
|
||||
* }
|
||||
*/
|
||||
|
||||
void print_queue(queue *q);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user