-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathServerStatus.cpp
More file actions
34 lines (30 loc) · 902 Bytes
/
ServerStatus.cpp
File metadata and controls
34 lines (30 loc) · 902 Bytes
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
// Based off https://github.com/UCLA-CS130/Team07/blob/master/server_stats.cpp
#include "ServerStatus.h"
namespace Team15 {
namespace server {
ServerStatus& ServerStatus::getInstance() {
static ServerStatus instance;
return instance;
}
void ServerStatus::insertHandler(const std::string& prefix,
const std::string& handler_name) {
// Checks for duplicates
for (unsigned int i=0; i < handlers_.size(); i++) {
if (handlers_[i].first == prefix) {
return;
}
}
std::pair<std::string, std::string> handler(prefix, handler_name);
handlers_.push_back(handler);
}
void ServerStatus::insertRequest(const std::string& uri,
const std::string& status) {
std::pair<std::string, std::string> request(uri, status);
requests_.push_back(request);
}
void ServerStatus::resetStatus() {
handlers_.clear();
requests_.clear();
}
}
}