Commit 09c52185 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - now it uses WModuleFactory for loading modules

parent 68502844
......@@ -34,6 +34,7 @@
#include <boost/thread/xtime.hpp>
#include "WModule.h"
#include "WModuleFactory.h"
#include "../modules/data/WMData.hpp"
#include "../modules/navSlices/WMNavSlices.h"
#include "../modules/coordinateSystem/WMCoordinateSystem.h"
......@@ -63,6 +64,9 @@ WKernel::WKernel( int argc, char* argv[], boost::shared_ptr< WGUI > gui )
m_ArgV = argv;
m_FinishRequested = false;
// get module factory
m_moduleFactory = WModuleFactory::getModuleFactory();
// init GE, DataHandler, ...
init();
......@@ -142,7 +146,7 @@ int WKernel::run()
// run module execution threads
// TODO(ebaum): after having modules loaded they should be started here.
// currently this is just the test module
WLogger::getLogger()->addLogMessage( "*** Starting modules:", "Kernel", LL_DEBUG );
/*WLogger::getLogger()->addLogMessage( "*** Starting modules:", "Kernel", LL_DEBUG );
for( std::list< boost::shared_ptr< WModule > >::iterator list_iter = m_modules.begin(); list_iter != m_modules.end();
++list_iter )
{
......@@ -172,7 +176,7 @@ int WKernel::run()
++list_iter )
{
( *list_iter )->wait( true );
}
}*/
// finally GE
m_graphicsEngine->wait( true );
......@@ -183,22 +187,8 @@ int WKernel::run()
void WKernel::loadModules()
{
// TODO(ebaum): add dynamic loading here
WLogger::getLogger()->addLogMessage( "*** Loading Modules: ", "Kernel", LL_DEBUG );
m_modules.clear();
using boost::shared_ptr;
shared_ptr< WModule > m1 = shared_ptr< WModule >( new WMNavSlices() );
// shared_ptr< WModule > m = shared_ptr< WModule >( new WMFiberDisplay() );
// shared_ptr< WModule > m = shared_ptr< WModule >( new WMFiberCulling() );
// shared_ptr< WModule > m = shared_ptr< WModule >( new WMFiberClustering() );
WLogger::getLogger()->addLogMessage( "Loading module: " + m1->getName(), "Kernel", LL_DEBUG );
m_modules.push_back( m1 );
shared_ptr< WModule > m2 = shared_ptr< WModule >( new WMCoordinateSystem() );
WLogger::getLogger()->addLogMessage( "Loading module: " + m2->getName(), "Kernel", LL_DEBUG );
m_modules.push_back( m2 );
// load all modules
m_moduleFactory->load();
}
void WKernel::init()
......
......@@ -32,9 +32,11 @@
#include <boost/shared_ptr.hpp>
#include "WModule.h"
#include "WModuleFactory.h"
#include "WModuleContainer.h"
#include "../common/WLogger.h"
#include "../graphicsEngine/WGraphicsEngine.h"
#include "../dataHandler/WDataHandler.h"
#include "../common/WLogger.h"
#include "../gui/WGUI.h"
/**
......@@ -147,11 +149,6 @@ public:
protected:
/**
* All the loaded modules.
*/
std::list< boost::shared_ptr< WModule > > m_modules;
/**
* Pointer to an initialized graphics engine.
*/
......@@ -167,6 +164,15 @@ protected:
*/
boost::shared_ptr< WDataHandler > m_dataHandler;
/**
* The module factory to use.
*/
boost::shared_ptr< WModuleFactory > m_moduleFactory;
/**
* The container containing the modules.
*/
boost::shared_ptr< WModuleContainer > m_moduleContainer;
private:
/**
* Loads all the modules it can find.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment