-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnode.cpp
80 lines (66 loc) · 1.22 KB
/
node.cpp
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
#include "node.h"
#include "combinedfragment.h"
class CombinedFragment;
Node::Node()
{
this->cfrag = NULL;
}
Node& Node:: operator =(const Node& another)
{
this->type = another.getType();
this->mfrag = another.getmFrag();
CombinedFragment* temp = another.getcFragP();
CombinedFragment *ptr = NULL;
if(temp!=NULL)
{
ptr = new CombinedFragment(*temp);
}
(this->cfrag) = ptr;
return *this;
}
Node::Node(int type,Message frag)
{
this->type = type;
this->mfrag = frag;
this->cfrag = NULL;
}
Node::Node(int type,CombinedFragment* frag)
{
this->type = type;
this->cfrag = frag;
}
int Node::getType() const
{
return this->type;
}
void Node::setType(int type)
{
this->type = type;
}
Message Node::getmFrag() const
{
return this->mfrag;
}
void Node::setmFrag(Message frag)
{
this->mfrag = frag;
this->cfrag = NULL;
}
CombinedFragment Node::getcFrag()
{
if(this->cfrag!=NULL)
return *(this->cfrag);
else
{
CombinedFragment cf_null(string(""),-1);
return cf_null;
}
}
void Node::setcFrag(CombinedFragment* frag)
{
this->cfrag = frag;
}
CombinedFragment* Node::getcFragP() const
{
return this->cfrag;
}