-
Notifications
You must be signed in to change notification settings - Fork 0
/
Print.hpp
60 lines (53 loc) · 2.25 KB
/
Print.hpp
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
/*Print専用クラス*/
#ifndef PRINT_HEAD
#define PRINT_HEAD
class Print{
public:
static void printNodesMode(NODE *n_data, int N, double t_count){
for(int i = 0; i < N; i++){
if((n_data[i].mode != SLEEP) && (n_data[i].mode != Re_Be_ACK)){
cout << t_count << "\t" << i << "\t" << n_data[i].mode << endl;
}
}
}
static void printNodesActiveTime(NODE *n_data, int N){
for(int i = 0; i < N; i++){
cout << i << "\t" << n_data[i].activetime << endl;
}
}
static void printRecAndTransPacket(NODE *n_data, MovingSink *car, int N){
int cnt = 0;
cout << "RecPacket\t" << car->recPackets << "\t";
for(int i = 0; i < N; i++ ){
cnt += n_data[i].transCount;
}
cout << "TransPacket\t" << cnt << endl;
}
static void printNodeProcess(NODE *n_data, int N, double t_count){
//cout << t_count << endl;
for(int i = 0; i < 1; i++){
if((abs(n_data[i].activetime - t_count) < TCOUNT)){
cout << "id =" << n_data[i].id << "ActiveTime = " << n_data[i].activetime << endl;
}
if(n_data[i].ca_time < TCOUNT && n_data[i].prevState == CSMA){
cout << "CSMA\t" << "id =" << n_data[i].id << "ca_tome = " << n_data[i].ca_time << "\tmode = " << n_data[i].mode << "\tnext_mode = " << n_data[i].next_mode << endl;
}
if(abs(n_data[i].be_end - t_count) < TCOUNT){
cout << "BEACON\t" << "id =" << n_data[i].id << "Time = " << t_count << "\tmode = " << n_data[i].mode << "\tnext_mode = " << n_data[i].next_mode << endl;
}
if(abs(n_data[i].re_be_end - t_count) < TCOUNT){
cout << "Re_be_ACK\t" << "id =" << n_data[i].id << "Time = " << t_count << "\tmode = " << n_data[i].mode << "\tnext_mode = " << n_data[i].next_mode << endl;
}
if(n_data[i].next_mode != n_data[i].mode){
cout << "Mode Change\t" << "id =" << n_data[i].id << "mode = " << n_data[i].mode << "\tnext_mode = " << n_data[i].next_mode << "\tprevState = " << n_data[i].prevState << endl;
}
}
}
static void printListSize(ModeMemory *modeMemo){
cout << "All_trans = " << modeMemo->All_trans.size() << endl;
cout << "Trans = " << modeMemo->Trans_node.size() << endl;
cout << "Beacon = " << modeMemo->Beacon_node.size() << endl;
cout << "ACK = " << modeMemo->ACK_node.size() << endl;
}
};
#endif