forked from jontodd/r.refine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueue.h
96 lines (79 loc) · 1.95 KB
/
queue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* ************************************************************
*
* MODULE: r.refine
*
* Authors: Jon Todd <[email protected]>, Laura Toma <[email protected]>
* Bowdoin College, USA
*
* Purpose: convert grid data to TIN
*
* COPYRIGHT:
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
* for details.
*
*
************************************************************ */
/******************************************************************************
*
* queue.h has all functions to support a queue of elements
*
* AUTHOR(S): Jonathan Todd - <[email protected]>
* Laura Toma - <[email protected]>
*
* UPDATED: jt 2005-08-15
*
* COMMENTS: Based on Laura Toma's PQ
*
*****************************************************************************/
#ifndef QUEUE_H
#define QUEUE_H
#include "point.h"
typedef R_POINT queueElem;
typedef struct queueNode {
queueElem e;
struct queueNode* next;
} QNODE;
typedef QNODE* QUEUE;
//
//create a head, point it to itself and return a pointer to the head
//of the list
//
QUEUE Q_init();
//
// insert element e at the head of the list by copying its contents into QNODE
//
void Q_insert_elem_head(QUEUE h, queueElem e);
//
// insert QNODE at head of the list
//
void Q_insert_qnode_head(QUEUE h, QNODE* n);
//
// remove the first element in the queue
//
QNODE* Q_remove_first(QUEUE h);
//
// remove the first element and free it from memory
//
short Q_delete_first(QUEUE h);
//
// Free all the elements in the queue
//
void Q_free_queue(QUEUE h);
//
// Print all the elements in a queue
//
void Q_print(QUEUE h);
//
// returns first element after head, or NULL if queue is empty (dummy only)
//
QNODE* Q_first(QUEUE h);
//
//returns p->next
//
QNODE* Q_next(QUEUE h, QNODE* p);
//
//returns 1 if p is the last element in the queue else 0
//
short Q_isEnd(QUEUE h, QNODE* p);
#endif // QUEUE_H