-
Notifications
You must be signed in to change notification settings - Fork 5
/
Core.hpp
81 lines (67 loc) · 1.87 KB
/
Core.hpp
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
#ifndef __CORE__
#define __CORE__
using namespace Protocol;
class Core
{
public:
Core(ANetwork* n
,IGraphDB* g
,ISearchEngine* s
,AProtocol* p
,std::string const& conf_filename = "default.conf")
: __configuration(conf_filename)
, __protocol(p)
, __graphdb(g)
, __search_engine(s)
, __dumper_manager(g)
{
p->set_network(n);
p->set_core(this);
}
~Core()
{
;
}
void use(std::string const& graph_name, Protocol::error_code& code)
{
this->__graphdb->use(graph_name, code);
}
void add(std::string const& graph_name, Protocol::error_code& code)
{
this->__graphdb->add(graph_name, code);
}
Edge::id add(Vertex::id const from, Vertex::id const to, std::string const& name, Protocol::error_code& code)
{
return this->__graphdb->add(from, to, name, code);
}
Vertex::id add(std::string const& vertex_name, std::vector<std::string> const& args)
{
return this->__graphdb->add(vertex_name, args);
}
void remove(std::string const& graph_name, Protocol::error_code& code)
{
this->__graphdb->remove(graph_name, code);
}
void remove(Edge::id id, Protocol::error_code& code)
{
this->__graphdb->remove(id, code);
}
void remove(Vertex::id id, Protocol::error_code& code)
{
this->__graphdb->remove(id, code);
}
std::string dump(std::string const& graph_name, std::string const& dumper_name, Protocol::error_code& error_code) const
{
return this->__dumper_manager(graph_name, dumper_name, error_code);
}
// FIXME : update/read methods, need search engine
private:
Core(const Core&);
Core& operator=(const Core&);
Configuration __configuration;
AProtocol* __protocol;
IGraphDB* __graphdb;
ISearchEngine* __search_engine;
DumperManager __dumper_manager;
};
#endif /* __CORE__ */