-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmessage.cpp
127 lines (104 loc) · 1.9 KB
/
message.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include "message.h"
#include<string>
#include<iostream>
#include "combinedfragment.h"
using namespace std;
class CombinedFragment;
Message::Message()
{
this->frag = NULL;
}
Message::Message(int num,string xmi_id,string name,string from, string to,int type)
{
this->num = num;
this->from = from;
this->to = to;
this->name = name;
this->xmi_id = xmi_id;
this->type = type;
this->frag = NULL;
}
Message::Message(const Message& another)
{
this->num = another.num;
this->xmi_id = another.xmi_id;
this->from = another.from;
this->to = another.to;
this->name = another.name;
this->type = another.type;
this->frag = another.frag;
}
bool Message::operator < (const Message& temp) const
{
return ((this->getNum()) < (temp.getNum()));
}
CombinedFragment Message::getFrag()
{
if(this->frag!=NULL)
return *(this->frag);
else
{
CombinedFragment cf_null(string(""),-1);
return cf_null;
}
}
CombinedFragment* Message::getFragP()
{
return (this->frag);
}
string Message::getID()
{
return this->xmi_id;
}
int Message::getNum() const
{
return this->num;
}
int Message::getType()
{
return this->type;
}
string Message::getName()
{
return this->name;
}
string Message::getFrom()
{
return this->from;
}
string Message::getTo()
{
return this->to;
}
void Message::setID(string xmi_id)
{
this->xmi_id=xmi_id;
}
void Message::setFrom(string from)
{
this->from=from;
}
void Message::setTo(string to)
{
this->to=to;
}
void Message::setName(string name)
{
this->name=name;
}
void Message::setNum(int num)
{
this->num=num;
}
void Message::setType(int type)
{
this->type=type;
}
void Message::setFrag(CombinedFragment* frag)
{
this->frag=frag;
}
void Message::display()
{
cout<<"[Message ID: "<<this->num<<" | Name: "<<this->name<<" | From: "<<this->from<<" | To: "<<this->to<<"]"<<endl;
}