OpenWalnut
1.2.5
|
OpenWalnut kernel, managing modules and interaction between GUI, GE and DataHandler. More...
#include <WKernel.h>
Public Member Functions | |
virtual | ~WKernel () |
Destructor. | |
void | finalize () |
Stops execution of the modules in the root container. | |
boost::shared_ptr < WGraphicsEngine > | getGraphicsEngine () const |
Returns pointer to currently running instance of graphics engine. | |
const WBoolFlag & | isFinishRequested () const |
Determines whether all threads should finish. | |
void | loadDataSets (std::vector< std::string > fileNames) |
Load specified datasets. | |
void | loadDataSetsSynchronously (std::vector< std::string > fileNames) |
Loads the specified files synchronously. | |
boost::shared_ptr< WModule > | applyModule (boost::shared_ptr< WModule > applyOn, boost::shared_ptr< WModule > prototype) |
Function combines to modules. | |
boost::shared_ptr < WModuleContainer > | getRootContainer () const |
Returns the root module container. | |
boost::shared_ptr< WGUI > | getGui () const |
Getter for the associated GUI. | |
boost::shared_ptr< WROIManager > | getRoiManager () |
get for roi manager | |
boost::shared_ptr < WSelectionManager > | getSelectionManager () |
get for selection manager | |
Static Public Member Functions | |
static WKernel * | instance (boost::shared_ptr< WGraphicsEngine > ge, boost::shared_ptr< WGUI > gui) |
Returns pointer to the running kernel or a new if no kernel was there. | |
static WKernel * | getRunningKernel () |
Returns pointer to the currently running kernel. | |
Protected Member Functions | |
WKernel (boost::shared_ptr< WGraphicsEngine > ge, boost::shared_ptr< WGUI > gui) | |
Constructor is protected because this class is a singleton. | |
virtual void | threadMain () |
Function that has to be overwritten for execution. | |
Protected Attributes | |
boost::shared_ptr< WGUI > | m_gui |
The Gui. | |
boost::shared_ptr < WGraphicsEngine > | m_graphicsEngine |
Pointer to an initialized graphics engine. | |
boost::shared_ptr< WROIManager > | m_roiManager |
Pointer to a roi manager. | |
boost::shared_ptr < WSelectionManager > | m_selectionManager |
pointer to a selection manager | |
boost::shared_ptr< WModuleFactory > | m_moduleFactory |
The module factory to use. | |
boost::shared_ptr < WModuleContainer > | m_moduleContainer |
The container containing the modules. | |
Private Member Functions | |
void | loadModules () |
Loads all the modules it can find. | |
void | init () |
Initializes the graphics engine, data handler and so on. | |
Static Private Attributes | |
static WKernel * | m_kernel = NULL |
Pointer to the unique instance of this singleton class. |
OpenWalnut kernel, managing modules and interaction between GUI, GE and DataHandler.
WKernel::~WKernel | ( | ) | [virtual] |
Destructor.
Definition at line 80 of file WKernel.cpp.
References WLogger::addLogMessage(), and WLogger::getLogger().
WKernel::WKernel | ( | boost::shared_ptr< WGraphicsEngine > | ge, |
boost::shared_ptr< WGUI > | gui | ||
) | [protected] |
Constructor is protected because this class is a singleton.
Awaits an INITIALIZED graphics engine an gui.
ge | initialized graphics engine. |
gui | initialized gui. |
Definition at line 63 of file WKernel.cpp.
References WLogger::addLogMessage(), wlog::debug(), WLogger::getLogger(), init(), m_graphicsEngine, m_gui, and m_kernel.
Referenced by instance().
boost::shared_ptr< WModule > WKernel::applyModule | ( | boost::shared_ptr< WModule > | applyOn, |
boost::shared_ptr< WModule > | prototype | ||
) |
Function combines to modules.
This is a simple alias for "getRootContainer()->applyModule". It runs synchronously, which could freeze the calling thread for a couple of time.
applyOn | the module which already has to be in the container and to apply the other one on. |
prototype | the prototype of the module to apply on the other one specified. |
Definition at line 181 of file WKernel.cpp.
References getRootContainer().
void WKernel::finalize | ( | ) |
Stops execution of the modules in the root container.
Note that this does not wait for the kernel thread since this could cause a dead lock. This is actually an alias for getRootContainer()->stop().
Definition at line 139 of file WKernel.cpp.
References WLogger::addLogMessage(), WDataHandler::getDataHandler(), WLogger::getLogger(), and getRootContainer().
boost::shared_ptr< WGraphicsEngine > WKernel::getGraphicsEngine | ( | ) | const |
Returns pointer to currently running instance of graphics engine.
Definition at line 124 of file WKernel.cpp.
References m_graphicsEngine.
Referenced by WSelectionManager::getFrontSector(), and WSelectionManager::setPaintMode().
boost::shared_ptr< WGUI > WKernel::getGui | ( | ) | const |
Getter for the associated GUI.
Definition at line 134 of file WKernel.cpp.
References m_gui.
boost::shared_ptr< WROIManager > WKernel::getRoiManager | ( | ) |
get for roi manager
Definition at line 186 of file WKernel.cpp.
References m_roiManager.
Referenced by WFiberSelector::slotAddRoi(), WFiberSelector::WFiberSelector(), and WFiberSelector::~WFiberSelector().
boost::shared_ptr< WModuleContainer > WKernel::getRootContainer | ( | ) | const |
Returns the root module container.
This is the actual module graph container.
Definition at line 129 of file WKernel.cpp.
References m_moduleContainer.
Referenced by applyModule(), finalize(), WProjectFile::load(), loadDataSets(), loadDataSetsSynchronously(), WModuleProjectFileCombiner::save(), and WProjectFile::threadMain().
WKernel * WKernel::getRunningKernel | ( | ) | [static] |
Returns pointer to the currently running kernel.
Definition at line 119 of file WKernel.cpp.
References m_kernel.
Referenced by WSelectionManager::getFrontSector(), WProjectFile::load(), WModuleProjectFileCombiner::save(), WSelectionManager::setPaintMode(), WFiberSelector::slotAddRoi(), WProjectFile::threadMain(), WFiberSelector::WFiberSelector(), and WFiberSelector::~WFiberSelector().
boost::shared_ptr< WSelectionManager > WKernel::getSelectionManager | ( | ) |
get for selection manager
Definition at line 191 of file WKernel.cpp.
References m_selectionManager.
void WKernel::init | ( | ) | [private] |
Initializes the graphics engine, data handler and so on.
Definition at line 96 of file WKernel.cpp.
References WDataHandler::getDataHandler(), WModuleFactory::getModuleFactory(), m_moduleContainer, m_moduleFactory, m_roiManager, and m_selectionManager.
Referenced by WKernel().
WKernel * WKernel::instance | ( | boost::shared_ptr< WGraphicsEngine > | ge, |
boost::shared_ptr< WGUI > | gui | ||
) | [static] |
Returns pointer to the running kernel or a new if no kernel was there.
If a running kernel exists the function return it and does not check if ge and gui of the running kernel are equivalent to the ones given as parameters.
ge | initialized graphics engine. |
gui | initialized gui. |
Definition at line 86 of file WKernel.cpp.
const WBoolFlag & WKernel::isFinishRequested | ( | ) | const |
Determines whether all threads should finish.
Definition at line 166 of file WKernel.cpp.
References WThreadedRunner::m_shutdownFlag.
void WKernel::loadDataSets | ( | std::vector< std::string > | fileNames | ) |
Load specified datasets.
It immediately returns and starts another thread, which actually loads the data.
fileNames | list of filenames to load. The registered notification handler for the root container will get notified on error and success. |
Definition at line 171 of file WKernel.cpp.
References getRootContainer().
void WKernel::loadDataSetsSynchronously | ( | std::vector< std::string > | fileNames | ) |
Loads the specified files synchronously.
fileNames | list of filenames to load. The registered notification handler for the root container will get notified on error and success. |
Definition at line 176 of file WKernel.cpp.
References getRootContainer().
void WKernel::loadModules | ( | ) | [private] |
Loads all the modules it can find.
void WKernel::threadMain | ( | ) | [protected, virtual] |
Function that has to be overwritten for execution.
It gets executed in a separate thread after run() has been called.
Reimplemented from WThreadedRunner.
Definition at line 150 of file WKernel.cpp.
References WLogger::addLogMessage(), WLogger::getLogger(), m_graphicsEngine, m_gui, and WThreadedRunner::waitForStop().
boost::shared_ptr< WGraphicsEngine > WKernel::m_graphicsEngine [protected] |
Pointer to an initialized graphics engine.
Definition at line 184 of file WKernel.h.
Referenced by getGraphicsEngine(), threadMain(), and WKernel().
boost::shared_ptr< WGUI > WKernel::m_gui [protected] |
The Gui.
Definition at line 179 of file WKernel.h.
Referenced by getGui(), threadMain(), and WKernel().
WKernel * WKernel::m_kernel = NULL [static, private] |
Pointer to the unique instance of this singleton class.
Used for program wide access to the kernel.
Definition at line 220 of file WKernel.h.
Referenced by getRunningKernel(), instance(), and WKernel().
boost::shared_ptr< WModuleContainer > WKernel::m_moduleContainer [protected] |
The container containing the modules.
Definition at line 204 of file WKernel.h.
Referenced by getRootContainer(), and init().
boost::shared_ptr< WModuleFactory > WKernel::m_moduleFactory [protected] |
boost::shared_ptr< WROIManager > WKernel::m_roiManager [protected] |
Pointer to a roi manager.
Definition at line 189 of file WKernel.h.
Referenced by getRoiManager(), and init().
boost::shared_ptr< WSelectionManager > WKernel::m_selectionManager [protected] |
pointer to a selection manager
Definition at line 194 of file WKernel.h.
Referenced by getSelectionManager(), and init().