RequestHandler object is now returned as reference rather than as pointer. Memory handling should be more clear by that change.

This commit is contained in:
Dennis Luxen 2011-03-14 13:39:16 +00:00
parent da3789f2ce
commit 2b639a5a14
2 changed files with 6 additions and 8 deletions

View File

@ -61,10 +61,8 @@ public:
ioService.stop();
}
RequestHandler * GetRequestHandlerPtr() {
return &requestHandler;
RequestHandler & GetRequestHandlerPtr() {
return requestHandler;
}
private:

View File

@ -56,16 +56,16 @@ int main (int argc, char *argv[])
ServerConfiguration serverConfig("server.ini");
Server * s = ServerFactory::CreateServer(serverConfig);
RequestHandler * h = s->GetRequestHandlerPtr();
RequestHandler & h = s->GetRequestHandlerPtr();
BasePlugin * helloWorld = new HelloWorldPlugin();
h->RegisterPlugin(helloWorld);
h.RegisterPlugin(helloWorld);
BasePlugin * locate = new LocatePlugin(
serverConfig.GetParameter("ramIndex"),
serverConfig.GetParameter("fileIndex"),
serverConfig.GetParameter("nodesData"));
h->RegisterPlugin(locate);
h.RegisterPlugin(locate);
BasePlugin * route = new RoutePlugin(
serverConfig.GetParameter("hsgrData"),
@ -73,7 +73,7 @@ int main (int argc, char *argv[])
serverConfig.GetParameter("fileIndex"),
serverConfig.GetParameter("nodesData"),
serverConfig.GetParameter("namesData"));
h->RegisterPlugin(route);
h.RegisterPlugin(route);
boost::thread t(boost::bind(&Server::Run, s));