Blender V4.3
Queue.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#ifndef __QUEUE_H__
6#define __QUEUE_H__
7
13
14class GridQueue {
15 gridQueueEle *head;
16 gridQueueEle *tail;
17 int numEles;
18
19 public:
21 {
22 head = NULL;
23 tail = NULL;
24 numEles = 0;
25 }
26
28 {
29 return head;
30 }
31
33 {
34 return numEles;
35 }
36
37 void pushQueue(int st[3], int dir)
38 {
39 gridQueueEle *ele = new gridQueueEle;
40 ele->x = st[0];
41 ele->y = st[1];
42 ele->z = st[2];
43 ele->dir = (UCHAR)dir;
44 ele->next = NULL;
45 if (head == NULL) {
46 head = ele;
47 }
48 else {
49 tail->next = ele;
50 }
51 tail = ele;
52 numEles++;
53 }
54
55 int popQueue(int st[3], int &dir)
56 {
57 if (head == NULL) {
58 return 0;
59 }
60
61 st[0] = head->x;
62 st[1] = head->y;
63 st[2] = head->z;
64 dir = (int)(head->dir);
65
66 gridQueueEle *temp = head;
67 head = head->next;
68 delete temp;
69
70 if (head == NULL) {
71 tail = NULL;
72 }
73 numEles--;
74
75 return 1;
76 }
77
78#ifdef WITH_CXX_GUARDEDALLOC
79 MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:GridQueue")
80#endif
81};
82
83#endif /* __QUEUE_H__ */
#define UCHAR
Definition GeoCommon.h:8
gridQueueEle * getHead()
Definition Queue.h:27
void pushQueue(int st[3], int dir)
Definition Queue.h:37
int popQueue(int st[3], int &dir)
Definition Queue.h:55
int getNumElements()
Definition Queue.h:32
GridQueue()
Definition Queue.h:20
#define NULL
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
int y
Definition Queue.h:9
UCHAR dir
Definition Queue.h:10
gridQueueEle * next
Definition Queue.h:11
int x
Definition Queue.h:9
int z
Definition Queue.h:9