C Everything
This is a C repository containing a curated set of generic data structures and algorithm.
queue.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include "common.h"
8 #include "link_list.h"
9 
11 typedef enum {
14 } e_queuetype;
15 
17 typedef struct {
18  // queue prams
19  char *name;
20  int max_size;
21  int count;
22  int front;
23  int rear;
25 
26  // link List or array based queue
28 
37 
41 } t_queue;
42 
43 // API
44 t_gen create_queue (char *name, int max_size, e_queuetype type, t_dparams *prm);
Top level include containg common headers.
e_queuetype
types of queue
Definition: queue.h:11
@ eLL_QUEUE_CIRC
Link List Based Queue.
Definition: queue.h:12
@ eARRAY_QUEUE_CIRC
Array Based Queue.
Definition: queue.h:13
t_gen create_queue(char *name, int max_size, e_queuetype type, t_dparams *prm)
Destroy queue instance
Definition: queue.c:37
data params struct defn
Definition: common.h:18
queue struct defn
Definition: queue.h:17
f_len len
routine to get length queue
Definition: queue.h:31
f_print print
routine to print queue elements
Definition: queue.h:35
e_queuetype type
Stack Type.
Definition: queue.h:24
char * name
Stack instance name.
Definition: queue.h:19
f_gen deq
routine to pop elements out of queue
Definition: queue.h:30
f_destroy destroy
routine to detroy queue instance
Definition: queue.h:36
f_empty empty
routine to check if queue empty
Definition: queue.h:34
f_free free
Definition: queue.h:40
f_genidx peek
routine to peek node in queue
Definition: queue.h:32
int max_size
Max Size of queue.
Definition: queue.h:20
f_print print_data
Definition: queue.h:39
f_full full
routine to check if queue full
Definition: queue.h:33
int front
Queue Front Pointer.
Definition: queue.h:22
int count
Total elems present in queue.
Definition: queue.h:21
f_ins enq
routine to push elements to queue
Definition: queue.h:29
t_gen * data
Ptr to link List or array based on type of queue.
Definition: queue.h:27
int rear
Queue Rear Pointer.
Definition: queue.h:23
bool(* f_empty)(t_gen)
fn type of an empty function
Definition: typedefs.h:53
void(* f_free)(t_gen, char *, int)
Definition: typedefs.h:67
f_vgen f_print
fn type to print function
Definition: typedefs.h:56
f_vgen f_destroy
fn type of destroy function
Definition: typedefs.h:61
t_gen(* f_genidx)(t_gen, int)
fn ptr that takes one gen ptr, idx and return gen ptr
Definition: typedefs.h:51
bool(* f_full)(t_gen)
fn type of a full function
Definition: typedefs.h:54
int(* f_len)(t_gen)
fn type of get len function
Definition: typedefs.h:55
void * t_gen
Base Data type used for all data structure and data elements.
Definition: typedefs.h:41
f_vgen2 f_ins
fn type of insert elem function
Definition: typedefs.h:58
t_gen(* f_gen)(t_gen)
Generic data pointer definitions that are common to most data structure operations.
Definition: typedefs.h:46