-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquadstack.h
48 lines (42 loc) · 1.36 KB
/
quadstack.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
#ifndef QUADSTACK_H
#define QUADSTACK_H
#include "quadtritree.h"
struct QuadStackNode{
QuadStackNode* next;
QuadStackNode* prev;
QuadTriTree* diamond;
};
class QuadStack{
public:
QuadStack();
~QuadStack();
void UnlinkNode(QuadStackNode*);
QuadStackNode* push(QuadTriTree*); //Returns address of QueueNode if successful
QuadTriTree* pop();
bool IsEmpty();
void DeleteAll();
QuadStackNode* begin();
QuadStackNode* end();
int Size();
#ifndef WIN32
friend class Iterator{
#else
class Iterator{
#endif
public:
Iterator() : current(NULL) {};
~Iterator(){ current = NULL; };
QuadStackNode* operator ++(int){ current = current->next; return current; };
QuadStackNode* operator --(int){ current = current->prev; return current; };
void operator= (QuadStackNode* toPoint){ current = toPoint; };
bool operator!= (QuadStackNode* compare) { return compare != current; };
QuadStackNode* operator->() { return current; };
QuadTriTree* operator*() { return current->diamond; };
QuadStackNode* current;
};
protected:
QuadStackNode* head;
QuadStackNode* tail;
int size;
};
#endif