-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.cpp
More file actions
55 lines (45 loc) · 1.08 KB
/
node.cpp
File metadata and controls
55 lines (45 loc) · 1.08 KB
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
#include "node.h"
using namespace std;
int node::node_exist = 0;
int node::seqnumber() const
{
return sequence_number;
}
bool node::service_node() const
{
return is_service_node;
}
int node::consume_number() const
{
return con_number;
}
int node::show_level() const
{
return level;
}
void node::set_service_node(bool is_server)
{
is_service_node = is_server;
}
int node::set_consume_node(int consume_number, int band_consumption)
{
con_number = consume_number;
consumption = band_consumption;
return consumption;
}
void node::set_level(int new_level)
{
level = new_level;
}
int node::show_bandwidth(int seq_number) const
{
return 0;
}
ostream & operator << (std::ostream & os, const node &item)
{
os << "节点序号:" << "\t" << item.sequence_number << endl << "服务节点:" << "\t" << (item.is_service_node ? "是" : "否") << endl;
os << "消费节点:" << "\t";
item.consume_number() >= 0 ? (os << "是 " << item.con_number << endl << "消费带宽为:" << "\t" << item.consumption << "Gbps") : os << "否";
os<<endl << "优先级:" << "\t" << item.level;
return os;
}