The LevAWC Project
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Macros
Pages
queue.c
Go to the documentation of this file.
1
/*
2
* _____
3
* ANSI / ___/
4
* / /__
5
* \___/
6
*
7
* Filename: queue.c
8
* Author : Kyle Loudon/Dan Levin
9
* Date : Fri Mar 22 12:40:45 GMT 2013
10
* Version : 0.51
11
* ---
12
* Description: An implementation of a generic, queue ADT.
13
*
14
* 2013-02-19 Made some revision to the Doxygen documentation. Enhanced the description of
15
* in/out parameters - i.e. double-pointers.
16
* 2015-03-31 This code ready for ver. 0.51
17
*/
18
24
#include <stdio.h>
25
#include <stdlib.h>
26
27
#include "
queue.h
"
28
29
30
/* FUNCTION DEFINITIONS --------------------------------------------------- */
31
32
Queue
QUEUEinit
(
void
(*destroy)(
void
*data))
33
{
34
return
SLISTinit
(destroy);
35
}
36
37
void
QUEUEdestroy
(
Queue
que)
38
{
39
SLISTdestroy
(que);
40
}
41
42
int
QUEUEenqueue
(
Queue
que,
const
void
*data)
43
{
44
return
SLISTinsnext
(que,
SLISTtail
(que), data);
45
}
46
47
int
QUEUEdequeue
(
Queue
que,
void
**data)
48
{
49
return
SLISTremnext
(que, NULL, data);
50
}
51
52
void
*
QUEUEpeek
(
Queue
que)
53
{
54
return
SLISTsize
(que) == 0 ? NULL :
SLISTdata
(
SLISThead
(que));
55
}
56
57
int
QUEUEisempty
(
Queue
que)
58
{
59
return
SLISTsize
(que) == 0 ? 1 : 0;
60
}
61
62
int
QUEUEsize
(
Queue
que)
63
{
64
return
SLISTsize
(que);
65
}
66
Generated on Tue Apr 7 2015 09:01:12 for The LevAWC Project by
1.8.2