forked from SharifAIChallenge/AIC16-Client-Cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (30 loc) · 743 Bytes
/
main.cpp
File metadata and controls
35 lines (30 loc) · 743 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
35
/*
* main.cpp
*
* Created on: Feb 6, 2016
* Author: armin
*/
#include <iostream>
#include <cstdlib>
#include "Controller.h"
std::string argNames[4] = { "AICHostIP", "AICHostPort", "AICToken","AICRetryDelay" };
std::string argDefaults[4] = { "127.0.0.1", "7099", "00000000000000000000000000000000", "1000" };
int main() {
setbuf(stdout, NULL);
std::string args[4];
for (int i = 0; i < 4; i++) {
char* tmp = std::getenv(argNames[i].c_str());
if (tmp == NULL)
args[i] = std::string(argDefaults[i]);
else
args[i] = tmp;
}
try {
Controller *control = new Controller(args);
control->start();
} catch (std::exception& e) {
std::cerr << "MAIN EXCEPTION\n";
std::cerr << e.what() << std::endl;
}
return 0;
}