-
Notifications
You must be signed in to change notification settings - Fork 1
/
nodeP.h
82 lines (71 loc) · 1.44 KB
/
nodeP.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
#pragma once
//#ifndef __nodeP_H_
//#define __nodeP_H_
template < typename T>
class nodeP
{
private:
T item; // A data item( the data element of the queue Enemy for example
int P; // the periority of an item an integer value for every nodeP
nodeP<T>* next; // Pointer to next nodeP
public:
nodeP();
nodeP(const T& r_Item,int p); //passing by const ref.
nodeP(const T& r_Item,int p, nodeP<T>* nextnodePPtr);
void setItem(const T& r_Item);
void setNext(nodeP<T>* nextnodePPtr);
void setP(int);
int getP();
T getItem() const;
nodeP<T>* getNext() const;
}; // end nodeP
template < typename T>
nodeP<T>::nodeP()
{
next = nullptr;
}
template < typename T>
nodeP<T>::nodeP(const T& r_Item,int p)
{
item = r_Item;
P = p;
next = nullptr;
}
template < typename T>
nodeP<T>::nodeP(const T& r_Item,int p, nodeP<T>* nextnodePPtr)
{
item = r_Item;
P = p;
next = nextnodePPtr;
}
template < typename T>
void nodeP<T>::setItem(const T& r_Item)
{
item = r_Item;
}
template< typename T>
void nodeP<T>::setP(int p)
{
P = p; //set the periorty of the node by this value
}
template<typename T>
int nodeP<T>::getP()
{
return P;
}
template < typename T>
void nodeP<T>::setNext(nodeP<T>* nextnodePPtr)
{
next = nextnodePPtr;
}
template < typename T>
T nodeP<T>::getItem() const
{
return item;
}
template < typename T>
nodeP<T>* nodeP<T>::getNext() const
{
return next;
}
//#endif