-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataCenterGroup.cpp
More file actions
46 lines (35 loc) · 1.12 KB
/
Copy pathdataCenterGroup.cpp
File metadata and controls
46 lines (35 loc) · 1.12 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
#include "dataCenterGroup.h"
int DataCenterGroup::getNumOfDCs(){
return this->num_of_DCs;
}
int DataCenterGroup::getNumOfServers(){
return this->num_of_Servers;
}
void DataCenterGroup::setNumOfDCs(int NumOfDCs){
this->num_of_DCs=NumOfDCs;
}
void DataCenterGroup::setNumOfServers(int NumOfServers){
this->num_of_Servers=NumOfServers;
}
Avl<Key,Server>* DataCenterGroup::getTrafficRankTree(){
return this->traffic_rank_tree;
}
void DataCenterGroup::setTrafficRankTree(Avl<Key,Server>* tree){
assert(tree!= nullptr);
delete this->traffic_rank_tree;
this->traffic_rank_tree=tree;
}
void DataCenterGroup::removeServer(int server_ID, int traffic){
Key key(server_ID,traffic);
this->num_of_Servers--;
this->traffic_rank_tree->delete_element(key);
}
void DataCenterGroup::addServer(int serverID, int traffic, const std::shared_ptr<Server>& server){
Key key(serverID,traffic);
this->num_of_Servers++;
this->traffic_rank_tree->insert(key,server, traffic);
}
DataCenterGroup::~DataCenterGroup(){
delete this->traffic_rank_tree;
// std::cout << "~DataCenterGroup()"<< std::endl;
}