-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.cpp
64 lines (56 loc) · 1.48 KB
/
main.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <string>
#include <map>
#include <utility>
#include <boost/graph/adjacency_list.hpp>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include "Vertex.hpp"
#include "Edge.hpp"
#include "AProtocol.hpp"
#include "ISearchEngine.hpp"
#include "Configuration.hpp"
#include "Graph.hpp"
#include "IGraphDB.hpp"
#include "GraphDB.hpp"
#include "ADumper.hpp"
#include "DumperManager.hpp"
#include "Core.hpp"
#include "SearchEngine.hpp"
#include "TextProtocol.hpp"
#include "ANetwork.hpp"
#include "NetworkSession.hpp"
#include "Network.hpp"
int main(int argc, const char *argv[]) // FIXME : add options for conf
{
try
{
int port;
if (argc != 2)
port = 5005;
else
port = std::atoi(argv[1]);
ISearchEngine* s = new SearchEngine(); // FIXME : uncomplete
boost::asio::io_service io_service;
IGraphDB* g = new GraphDB();
AProtocol* p = new TextProtocol();
ANetwork* n = new Network(io_service, port, p);
Core c(n, g, s, p);
/*
// FIXME : Test adjacent vertices
// graph -> "default"
Vertex::id v = g->add();
error_code error_code;
adjacency_iterator begin;
adjacency_iterator end;
boost::tie(begin, end) = adjacent_vertices(v, *g->get("default", &error_code));
// ENDFIXME
*/
std::cout << "Launching server on port " << port << std::endl;
io_service.run();
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}