-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnection_module.h
111 lines (100 loc) · 2.03 KB
/
connection_module.h
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
///////////////////////////////////////////////////////
// System Software Experiment 3.
// Project 2 : Mini Factory.
// written by Youngdae Kwon.
// MIT license.
///////////////////////////////////////////////////////
#ifndef __LIB_CONNECTION_MODULE_H__
#define __LIB_CONNECTION_MODULE_H__
#include "setup.h"
// #include "server_module.h"
using namespace std;
class Connection
{
public:
int vertexFrom;
int vertexTo;
int capacity;
int distance;
// variables for run()
vector<Entity> vEntities;
vector<double> vUtils;
int idx_min;
// variables for stats
int timeInConnection;
int numPassedEntity;
int entitySize;
double util;
// class methods declaration.
void setVertex(int a, int b);
int getVertexFrom();
int getVertexTo();
void setCapacity(int num);
void setDistance(int num);
int getCapacity();
int getDistance();
void setParams(int, int , int , int );
// member methods declaration.
Connection();
void putEntity(Entity* pEntity, int );
int getWhichEntity(int );
Entity getEntity(int , int);
void popEntity(int );
// void dispUtils();
};
class Way : public Connection
{
public:
int cost;
int wayID;
// class methods declaration.
Way();
Way(int );
int calCost();
int calPassTime(Entity *);
};
class Bus : public Connection
{
public:
int speed;
int cost;
int busID;
int currentID;
// class methods declaration.
Bus();
Bus(int );
// int setParams(int, int , int , int , int );
void setSpeed(int num);
int getSpeed();
int calCost();
int calPassTime();
Entity getEntity(int );
void popEntity();
};
class Interconnect{
public:
int numWay;
int numBus;
int interconnectNum;
vector<Way> vWays;
vector<Bus> vBuses;
Queue InterQueue;
Interconnect();
Interconnect(int , int , int );
// void insertEntityToQueueInter(Entity* , int);
// int checkQueue();
// Entity getEntityFromQueue(int );
// void putEntity(Entity* , int );
// Entity getEntity();
// void popEntity();
};
class Distance
{
public:
int ** distArr;
int numServer;
// class methods declaration.
void setNumServer(int );
void disp();
};
#endif