29 #if defined(__APPLE__)
30 #include <mach-o/dyld.h>
36 #include "../common/WLogger.h"
37 #include "../common/WThreadedRunner.h"
38 #include "../common/WTimer.h"
39 #include "../common/WRealtimeTimer.h"
40 #include "../dataHandler/WDataHandler.h"
41 #include "../ui/WUI.h"
42 #include "exceptions/WKernelException.h"
44 #include "WModuleContainer.h"
45 #include "WModuleFactory.h"
46 #include "WROIManager.h"
47 #include "WSelectionManager.h"
49 #include "core/WVersion.h"
56 WKernel::WKernel( boost::shared_ptr< WGraphicsEngine > ge, boost::shared_ptr< WUI > ui ):
61 wlog::debug(
"Kernel" ) <<
"Version: " << W_VERSION;
107 "Root module container in Kernel." ) );
112 m_moduleFactory->load();
155 m_ui->isInitialized().wait();
159 wlog::warn(
"Kernel" ) <<
"Expected UI instance but none was initialized.";
172 wlog::warn(
"Kernel" ) <<
"Expected GE instance but none was initialized.";
176 wlog::info(
"Kernel" ) <<
"Initializing extensions.";
180 wlog::info(
"Kernel" ) <<
"Initialization completed.";
201 return getRootContainer()->loadDataSetsSynchronously( filenames, suppressColormaps );
204 boost::shared_ptr< WModule >
WKernel::applyModule( boost::shared_ptr< WModule > applyOn, boost::shared_ptr< WModule > prototype )
233 case KERNEL_STARTUPCOMPLETE:
236 std::ostringstream s;
237 s <<
"Could not subscribe to unknown signal.";
boost::shared_ptr< WScriptEngine > getScriptEngine()
Get the script engine of this kernel.
boost::signals2::connection subscribeSignal(t_ConditionNotifierType notifier) const
Subscribes a specified function to be notified on condition change.
boost::shared_ptr< WSelectionManager > m_selectionManager
pointer to a selection manager
boost::shared_ptr< WModuleContainer > getRootContainer() const
Returns the root module container.
WTimer::ConstSPtr getTimer() const
Returns the system timer.
static WKernel * getRunningKernel()
Returns pointer to the currently running kernel.
virtual void threadMain()
Function that has to be overwritten for execution.
boost::shared_ptr< WSelectionManager > getSelectionManager()
get for selection manager
WStreamedLogger info(const std::string &source)
Logging an information message.
boost::shared_ptr< WScriptEngine > m_scriptEngine
The script engine to use.
WKernel(boost::shared_ptr< WGraphicsEngine > ge, boost::shared_ptr< WUI > ui)
Constructor is protected because this class is a singleton.
OpenWalnut kernel, managing modules and interaction between UI, GE and DataHandler.
boost::shared_ptr< WUI > getUI() const
Getter for the associated UI.
boost::shared_ptr< WGraphicsEngine > m_graphicsEngine
Pointer to an initialized graphics engine.
static WLogger * getLogger()
Returns pointer to the currently running logger instance.
boost::shared_ptr< WROIManager > m_roiManager
Pointer to a roi manager.
void addLogMessage(std::string message, std::string source="", LogLevel level=LL_DEBUG)
Appends a log message to the logging queue.
static WKernel * instance(boost::shared_ptr< WGraphicsEngine > ge, boost::shared_ptr< WUI > ui)
Returns pointer to the running kernel or a new if no kernel was there.
WConditionOneShot m_startupCompleted
Notified when the startup, including GE and UI has been completed.
void finalize()
Stops execution of the modules in the root container.
Base class for all classes needing to be executed in a separate thread.
static boost::shared_ptr< WModuleLoader > getModuleLoader()
Returns instance of the module loader.
const WBoolFlag & isFinishRequested() const
Determines whether all threads should finish.
virtual void notify()
Notifies all waiting threads.
boost::shared_ptr< WROIManager > getRoiManager()
get for roi manager
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.
WBatchLoader::SPtr loadDataSetsSynchronously(std::vector< std::string > filenames, bool suppressColormaps=false)
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< WBatchLoader > SPtr
Shared ptr abbreviation.
Class to store and manage different ROI's for fiber selection.
KERNEL_SIGNAL
Enum of all possible signals WKernel instances can emit.
static SPtr getModuleFactory()
Returns instance of the module factory to use to create modules.
static boost::shared_ptr< WDataHandler > getDataHandler()
As WDataHandler is a singleton -> return instance.
manages the several selection tools
boost::shared_ptr< WModuleFactory > m_moduleFactory
The module factory to use.
static WKernel * m_kernel
Pointer to the unique instance of this singleton class.
boost::signals2::connection subscribeSignal(KERNEL_SIGNAL signal, t_KernelGenericSignalHandlerType notifier)
Subscribe to several signals.
void setThreadName(std::string name)
Set the name of the thread.
boost::function< void(void) > t_KernelGenericSignalHandlerType
Signal for generic events.
WTimer::SPtr m_timer
The ow system timer.
boost::shared_ptr< WUI > m_ui
The UI.
void waitForStop()
Let the thread sleep until a stop request was given.
boost::shared_ptr< WGraphicsEngine > getGraphicsEngine() const
Returns pointer to currently running instance of graphics engine.
Class able to contain other modules.
General purpose exception and therefore base class for all kernel related exceptions.
WStreamedLogger debug(const std::string &source)
Logging a debug message.
boost::shared_ptr< WModuleContainer > m_moduleContainer
The container containing the modules.
WStreamedLogger warn(const std::string &source)
Logging a warning message.
WBatchLoader::SPtr loadDataSets(std::vector< std::string > filenames, bool suppressColormaps=false)
Load specified datasets.
boost::shared_ptr< const WTimer > ConstSPtr
Convenience typedef for a const shared_ptr.
void init()
Initializes the graphics engine, data handler and so on.
virtual ~WKernel()
Destructor.