-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueueNode.h
44 lines (37 loc) · 1008 Bytes
/
QueueNode.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
//
// Name: Joowon Byun
// Date: July 22th 2015 ~ July 27th 2015
//
#ifndef QUEUENODE_H
#define QUEUENODE_H
template< typename NODETYPE > class Queue;
template< typename NODETYPE>
class QueueNode {
friend class Queue<NODETYPE>;
private:
NODETYPE data;
QueueNode< NODETYPE > *prior;
QueueNode< NODETYPE > *next;
protected:
QueueNode( NODETYPE &info, QueueNode< NODETYPE > *NODE );
void setNext( QueueNode< NODETYPE > *NODE );
void changePreToNull();
public:
NODETYPE getData();
};
template< typename NODETYPE >
QueueNode< NODETYPE >::QueueNode( NODETYPE &info, QueueNode< NODETYPE > *NODE )
:data( info ), prior( NODE ), next( 0 ) {}
template< typename NODETYPE >
void QueueNode< NODETYPE >::setNext( QueueNode< NODETYPE > *NODE ) {
next = NODE;
}
template< typename NODETYPE >
void QueueNode< NODETYPE >::changePreToNull() {
prior = NULL;
}
template< typename NODETYPE >
NODETYPE QueueNode< NODETYPE >::getData() {
return data;
}
#endif