Blender
V2.93
intern
dualcon
intern
Queue.h
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU General Public License
4
* as published by the Free Software Foundation; either version 2
5
* of the License, or (at your option) any later version.
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software Foundation,
14
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
*/
16
17
#ifndef __QUEUE_H__
18
#define __QUEUE_H__
19
20
struct
gridQueueEle
{
21
int
x
,
y
,
z
;
22
UCHAR
dir
;
23
gridQueueEle
*
next
;
24
};
25
26
class
GridQueue
{
27
gridQueueEle
*head;
28
gridQueueEle
*tail;
29
int
numEles;
30
31
public
:
32
GridQueue
()
33
{
34
head =
NULL
;
35
tail =
NULL
;
36
numEles = 0;
37
}
38
39
gridQueueEle
*
getHead
()
40
{
41
return
head;
42
}
43
44
int
getNumElements
()
45
{
46
return
numEles;
47
}
48
49
void
pushQueue
(
int
st[3],
int
dir)
50
{
51
gridQueueEle
*ele =
new
gridQueueEle
;
52
ele->
x
= st[0];
53
ele->
y
= st[1];
54
ele->
z
= st[2];
55
ele->
dir
= (
UCHAR
)dir;
56
ele->
next
=
NULL
;
57
if
(head ==
NULL
) {
58
head = ele;
59
}
60
else
{
61
tail->
next
= ele;
62
}
63
tail = ele;
64
numEles++;
65
}
66
67
int
popQueue
(
int
st[3],
int
&dir)
68
{
69
if
(head ==
NULL
) {
70
return
0;
71
}
72
73
st[0] = head->
x
;
74
st[1] = head->
y
;
75
st[2] = head->
z
;
76
dir = (int)(head->
dir
);
77
78
gridQueueEle
*temp = head;
79
head = head->
next
;
80
delete
temp;
81
82
if
(head ==
NULL
) {
83
tail =
NULL
;
84
}
85
numEles--;
86
87
return
1;
88
}
89
90
#ifdef WITH_CXX_GUARDEDALLOC
91
MEM_CXX_CLASS_ALLOC_FUNCS(
"DUALCON:GridQueue"
)
92
#endif
93
};
94
95
#endif
/* __QUEUE_H__ */
UCHAR
#define UCHAR
Definition:
GeoCommon.h:20
NULL
return NULL
Definition:
bmesh_operator_api_inline.h:224
GridQueue
Definition:
Queue.h:26
GridQueue::pushQueue
void pushQueue(int st[3], int dir)
Definition:
Queue.h:49
GridQueue::popQueue
int popQueue(int st[3], int &dir)
Definition:
Queue.h:67
GridQueue::getHead
gridQueueEle * getHead()
Definition:
Queue.h:39
GridQueue::getNumElements
int getNumElements()
Definition:
Queue.h:44
GridQueue::GridQueue
GridQueue()
Definition:
Queue.h:32
gridQueueEle
Definition:
Queue.h:20
gridQueueEle::y
int y
Definition:
Queue.h:21
gridQueueEle::dir
UCHAR dir
Definition:
Queue.h:22
gridQueueEle::next
gridQueueEle * next
Definition:
Queue.h:23
gridQueueEle::x
int x
Definition:
Queue.h:21
gridQueueEle::z
int z
Definition:
Queue.h:21
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1