Commit b7b2264f authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[STYLE]

parent c8b233fe
......@@ -66,8 +66,8 @@ WKernel::WKernel( int argc, char* argv[], boost::shared_ptr< WGUI > gui )
// get module factory
m_moduleFactory = WModuleFactory::getModuleFactory();
m_moduleContainer = boost::shared_ptr< WModuleContainer >( new WModuleContainer( "KernelRootContainer", "Root module\
container in Kernel." ) );
m_moduleContainer = boost::shared_ptr< WModuleContainer >( new WModuleContainer( "KernelRootContainer",
"Root module container in Kernel." ) );
// init GE, DataHandler, ...
init();
......@@ -129,7 +129,7 @@ char** WKernel::getArguments() const
void WKernel::stop()
{
getRootContainer()->stop();
getRootContainer()->stop();
}
int WKernel::run()
......@@ -153,7 +153,8 @@ 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 )
{
......@@ -183,7 +184,8 @@ int WKernel::run()
++list_iter )
{
( *list_iter )->wait( true );
}*/
}
*/
// TODO(schurade): this must be moved somewhere else, and realize the wait loop in another fashion
while ( !m_gui->isInitalized() )
......
......@@ -22,6 +22,7 @@
//
//---------------------------------------------------------------------------
#include <set>
#include <string>
#include <sstream>
......@@ -73,7 +74,8 @@ void WModuleContainer::add( boost::shared_ptr< WModule > module )
m_modules.insert( module );
lock.unlock();
module->setAssociatedContainer( shared_from_this() );
WLogger::getLogger()->addLogMessage( "Associated module " + module->getName() + " with container." , "ModuleContainer (" + m_name + ")", LL_DEBUG );
WLogger::getLogger()->addLogMessage( "Associated module " + module->getName() + " with container." , "ModuleContainer (" + m_name + ")",
LL_DEBUG );
// now module->isUsable() is true
// -> so run it
......@@ -106,13 +108,14 @@ void WModuleContainer::remove( boost::shared_ptr< WModule > module )
void WModuleContainer::stop()
{
WLogger::getLogger()->addLogMessage( "Stopping modules." , "ModuleContainer (" + m_name + ")", LL_DEBUG );
WLogger::getLogger()->addLogMessage( "Stopping modules." , "ModuleContainer (" + m_name + ")", LL_DEBUG );
// read lock
boost::shared_lock<boost::shared_mutex> slock = boost::shared_lock<boost::shared_mutex>( m_moduleSetLock );
for( std::set< boost::shared_ptr< WModule > >::iterator listIter = m_modules.begin(); listIter != m_modules.end(); ++listIter )
{
WLogger::getLogger()->addLogMessage( "Waiting for module " + ( *listIter )->getName() + " to finish." , "ModuleContainer (" + m_name + ")", LL_DEBUG );
WLogger::getLogger()->addLogMessage( "Waiting for module " + ( *listIter )->getName() + " to finish." , "ModuleContainer (" + m_name + ")",
LL_DEBUG );
( *listIter )->wait( true );
}
slock.unlock();
......
......@@ -111,7 +111,7 @@ protected:
* Description of the module.
*/
std::string m_description;
private:
};
......
......@@ -23,6 +23,7 @@
//---------------------------------------------------------------------------
#include <set>
#include <string>
#include "../common/WLogger.h"
......@@ -57,12 +58,9 @@ void WModuleFactory::load()
{
// load modules
WLogger::getLogger()->addLogMessage( "Loading Modules", "ModuleFactory", LL_INFO );
std::cout << "sdasdshallo" << std::endl;
// operation must be exclusive
std::cout << "sdasdshallo" << std::endl;
boost::unique_lock< boost::shared_mutex > lock = boost::unique_lock< boost::shared_mutex >( m_prototypesLock );
std::cout << "sdasdshallo" << std::endl;
// currently the prototypes are added by hand. This will be done automatically later.
m_prototypes.insert( boost::shared_ptr< WModule >( new WMNavSlices() ) );
......@@ -84,7 +82,7 @@ void WModuleFactory::load()
++listIter )
{
WLogger::getLogger()->addLogMessage( "Loading module: " + ( *listIter )->getName(), "ModuleFactory", LL_DEBUG );
// that should not happen. Names should not occur multiple times since they are unique
if ( names.count( ( *listIter )->getName() ) )
{
......@@ -134,7 +132,7 @@ const boost::shared_ptr< WModule > WModuleFactory::getPrototypeByName( std::stri
// for this a read lock is sufficient
boost::shared_lock< boost::shared_mutex > slock = boost::shared_lock< boost::shared_mutex >( m_prototypesLock );
// find first and only prototype (ensured during load() )
// find first and only prototype (ensured during load())
boost::shared_ptr< WModule > ret = boost::shared_ptr< WModule >();
for( std::set< boost::shared_ptr< WModule > >::iterator listIter = m_prototypes.begin(); listIter != m_prototypes.end();
++listIter )
......@@ -146,7 +144,7 @@ const boost::shared_ptr< WModule > WModuleFactory::getPrototypeByName( std::stri
}
}
slock.unlock();
slock.unlock();
// if not found -> throw
if ( ret == boost::shared_ptr< WModule >() )
......
......@@ -26,6 +26,7 @@
#define WMODULEFACTORY_H
#include <set>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
......
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