|
a |
|
b/src/Common/CongestionDescriptor.cc |
|
|
1 |
//
|
|
|
2 |
// This program is free software: you can redistribute it and/or modify
|
|
|
3 |
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
4 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
5 |
// (at your option) any later version.
|
|
|
6 |
//
|
|
|
7 |
// This program is distributed in the hope that it will be useful,
|
|
|
8 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
9 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
10 |
// GNU Lesser General Public License for more details.
|
|
|
11 |
//
|
|
|
12 |
// You should have received a copy of the GNU Lesser General Public License
|
|
|
13 |
// along with this program. If not, see http://www.gnu.org/licenses/.
|
|
|
14 |
//
|
|
|
15 |
|
|
|
16 |
#include <CongestionDescriptor.h>
|
|
|
17 |
|
|
|
18 |
CongestionDescriptor::CongestionDescriptor()
|
|
|
19 |
{
|
|
|
20 |
ConId.setSrcCepId(-1);
|
|
|
21 |
ConId.setDstCepId(-1);
|
|
|
22 |
ConId.setQoSId(0);
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
CongestionDescriptor::~CongestionDescriptor() {
|
|
|
26 |
ConId.setSrcCepId(-1);
|
|
|
27 |
ConId.setDstCepId(-1);
|
|
|
28 |
ConId.setQoSId(0);
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
ConnectionId& CongestionDescriptor::getConnectionId() {
|
|
|
32 |
return ConId;
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
CongestionDescriptor::CongestionDescriptor(int srcCepId, int dstCepId,
|
|
|
36 |
unsigned short qosId)
|
|
|
37 |
{
|
|
|
38 |
ConId.setSrcCepId(srcCepId);
|
|
|
39 |
ConId.setDstCepId(dstCepId);
|
|
|
40 |
ConId.setQoSId(qosId);
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
void CongestionDescriptor::setConnectionId(const ConnectionId& conId) {
|
|
|
44 |
ConId = conId;
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
std::string CongestionDescriptor::getCongesDescrName() const {
|
|
|
48 |
std::stringstream os;
|
|
|
49 |
os << ConId.getSrcCepId() << "<=>" << ConId.getDstCepId();
|
|
|
50 |
return os.str();
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
CongestionDescriptor* CongestionDescriptor::dup() const {
|
|
|
54 |
CongestionDescriptor* congDesc = new CongestionDescriptor();
|
|
|
55 |
congDesc->getConnectionId().setSrcCepId(ConId.getSrcCepId());
|
|
|
56 |
congDesc->getConnectionId().setDstCepId(ConId.getDstCepId());
|
|
|
57 |
congDesc->getConnectionId().setQoSId(ConId.getQoSId());
|
|
|
58 |
return congDesc;
|
|
|
59 |
}
|