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