summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/src/main.cpp
diff options
context:
space:
mode:
authorAleksander Donchev <aleksander.donchev@partner.bmw.de>2013-07-10 14:05:44 +0200
committerAleksander Donchev <aleksander.donchev@partner.bmw.de>2013-07-10 14:59:18 +0200
commit7b4ad13452dac45128209d54ebc2e1e83ecd5beb (patch)
treed487e0da36ff4b79887e1996591806bbe43d3708 /AudioManagerDaemon/src/main.cpp
parent9dfa70416411055a86a9fd7eba828c65bea48325 (diff)
downloadaudiomanager-7b4ad13452dac45128209d54ebc2e1e83ecd5beb.tar.gz
Created an abstract interface for the database handlers.
Renamed CAmDatabaseHandler to CAmDatabaseHandlerSQLite and CAmMapHandler to CAmDatabaseHandlerMap. Changed std::map to std::unordered_map. Added to the cmake configuration a definition, which defines the capacity of the source and sink maps. Signed-off-by: Christian Linke <christian.linke@bmw.de>
Diffstat (limited to 'AudioManagerDaemon/src/main.cpp')
-rwxr-xr-xAudioManagerDaemon/src/main.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index aa2fb19..69b2860 100755
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -40,9 +40,9 @@
#endif
#ifdef WITH_DATABASE_STORAGE
- #include "CAmDatabaseHandler.h"
+ #include "CAmDatabaseHandlerSQLite.h"
#else
- #include "CAmMapHandler.h"
+ #include "CAmDatabaseHandlerMap.h"
#endif
#ifdef WITH_SYSTEMD_WATCHDOG
@@ -71,7 +71,6 @@
#include "CAmDatabaseObserver.h"
#include "shared/CAmDltWrapper.h"
#include "shared/CAmSocketHandler.h"
-#include "CAmDatabaseHandlerInterface.h"
using namespace am;
DLT_DECLARE_CONTEXT(AudioManager)
@@ -322,35 +321,35 @@ void mainProgram()
#endif /*WITH_SYSTEMD_WATCHDOG*/
#ifdef WITH_DATABASE_STORAGE
- CAmDatabaseHandler * ptr_iDatabaseHandler = new CAmDatabaseHandler(databasePath);
+ CAmDatabaseHandler * pDatabaseHandler = new CAmDatabaseHandler(databasePath);
#else
- CAmMapHandler * ptr_iDatabaseHandler = new CAmMapHandler();
+ CAmDatabaseHandlerMap * pDatabaseHandler = new CAmDatabaseHandlerMap();
#endif /*WITH_DATABASE_STORAGE*/
- CAmDatabaseHandlerInterface & iDatabaseHandler = *ptr_iDatabaseHandler;
+ IAmDatabaseHandler & iDatabaseHandler = *pDatabaseHandler;
CAmRoutingSender iRoutingSender(listRoutingPluginDirs);
CAmCommandSender iCommandSender(listCommandPluginDirs);
CAmControlSender iControlSender(controllerPlugin,&iSocketHandler);
- CAmRouter iRouter(ptr_iDatabaseHandler, &iControlSender);
+ CAmRouter iRouter(pDatabaseHandler, &iControlSender);
#ifdef WITH_DBUS_WRAPPER
- CAmCommandReceiver iCommandReceiver(ptr_iDatabaseHandler, &iControlSender, &iSocketHandler, &iDBusWrapper);
- CAmRoutingReceiver iRoutingReceiver(ptr_iDatabaseHandler, &iRoutingSender, &iControlSender, &iSocketHandler, &iDBusWrapper);
+ CAmCommandReceiver iCommandReceiver(pDatabaseHandler, &iControlSender, &iSocketHandler, &iDBusWrapper);
+ CAmRoutingReceiver iRoutingReceiver(pDatabaseHandler, &iRoutingSender, &iControlSender, &iSocketHandler, &iDBusWrapper);
#ifdef WITH_NSM
- CAmControlReceiver iControlReceiver(ptr_iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter, &iNodeStateCommunicator);
+ CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter, &iNodeStateCommunicator);
iNodeStateCommunicator.registerControlSender(&iControlSender);
#else /*WITH_NSM*/
- CAmControlReceiver iControlReceiver(ptr_iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
+ CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
#endif /*WITH_NSM*/
#else /*WITH_DBUS_WRAPPER*/
- CAmCommandReceiver iCommandReceiver(ptr_iDatabaseHandler,&iControlSender,&iSocketHandler);
- CAmRoutingReceiver iRoutingReceiver(ptr_iDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler);
- CAmControlReceiver iControlReceiver(ptr_iDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
+ CAmCommandReceiver iCommandReceiver(pDatabaseHandler,&iControlSender,&iSocketHandler);
+ CAmRoutingReceiver iRoutingReceiver(pDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler);
+ CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
#endif /*WITH_DBUS_WRAPPER*/
#ifdef WITH_TELNET
- CAmTelnetServer iTelnetServer(&iSocketHandler, &iCommandSender, &iCommandReceiver, &iRoutingSender, &iRoutingReceiver, &iControlSender, &iControlReceiver, ptr_iDatabaseHandler, &iRouter, telnetport, maxConnections);
+ CAmTelnetServer iTelnetServer(&iSocketHandler, &iCommandSender, &iCommandReceiver, &iRoutingSender, &iRoutingReceiver, &iControlSender, &iControlReceiver, pDatabaseHandler, &iRouter, telnetport, maxConnections);
CAmDatabaseObserver iObserver(&iCommandSender, &iRoutingSender, &iSocketHandler, &iTelnetServer);
#else /*WITH_TELNET*/
CAmDatabaseObserver iObserver(&iCommandSender,&iRoutingSender, &iSocketHandler);
@@ -372,10 +371,10 @@ void mainProgram()
//start the mainloop here....
iSocketHandler.start_listenting();
- if(ptr_iDatabaseHandler)
+ if(pDatabaseHandler)
{
- delete ptr_iDatabaseHandler;
- ptr_iDatabaseHandler = NULL;
+ delete pDatabaseHandler;
+ pDatabaseHandler = NULL;
}
}