-
Notifications
You must be signed in to change notification settings - Fork 1
/
Params.cpp
50 lines (43 loc) · 1.16 KB
/
Params.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
/**********************************
* FILE NAME: Params.cpp
*
* DESCRIPTION: Definition of Parameter class
**********************************/
#include "Params.h"
/**
* Constructor
*/
Params::Params(): PORTNUM(8001) {}
/**
* FUNCTION NAME: setparams
*
* DESCRIPTION: Set the parameters for this test case
*/
void Params::setparams(char *config_file) {
FILE *fp = fopen(config_file,"r");
fscanf(fp,"MAX_NNB: %d", &MAX_NNB);
fscanf(fp,"\nSINGLE_FAILURE: %d", &SINGLE_FAILURE);
fscanf(fp,"\nDROP_MSG: %d", &DROP_MSG);
fscanf(fp,"\nMSG_DROP_PROB: %lf", &MSG_DROP_PROB);
//printf("Parameters of the test case: %d %d %d %lf\n", MAX_NNB, SINGLE_FAILURE, DROP_MSG, MSG_DROP_PROB);
EN_GPSZ = MAX_NNB;
STEP_RATE=.25;
MAX_MSG_SIZE = 4000;
globaltime = 0;
dropmsg = 0;
allNodesJoined = 0;
for ( unsigned int i = 0; i < EN_GPSZ; i++ ) {
allNodesJoined += i;
}
fclose(fp);
return;
}
/**
* FUNCTION NAME: getcurrtime
*
* DESCRIPTION: Return time since start of program, in time units.
* For a 'real' implementation, this return time would be the UTC time.
*/
int Params::getcurrtime(){
return globaltime;
}