//  // // # # ### # # -= Nuclex Library =-  // // ## # # # ## ## Kernel.h - Nuclex engine kernel  // // ### # # ###  // // # ### # ### Kernel of the nuclex engine system  // // # ## # # ## ##  // // # # ### # # R1 (C)2002-2004 Markus Ewald -> License.txt  // //  // #ifndef NUCLEX_KERNEL_H #define NUCLEX_KERNEL_H #include "Nuclex/Nuclex.h" #include "Nuclex/Application.h" #include "Nuclex/Plugin.h" #include "Nuclex/Support/Exception.h" #include "Nuclex/Support/String.h" #include "SigC++/SigC++.h" #include /* #ifdef NUCLEX_WIN32 #define WIN32_LEAN_AND_MEAN #include #endif */ namespace { /// Custom marshal class for heartbeat accumulation /* class HeartBeatMarshal { public: typedef bool OutType; /// Get default value static bool default_value() { return false; } /// Constructor HeartBeatMarshal() : value_(false) {} /// Get resulting value bool &value() { return value_; } /// Marshal another call's return value bool marshal(bool newval) { value_ |= newval; return false; } private: bool value_; ///< Accumulated return value }; */ } namespace Nuclex { namespace Storage { class StorageServer; } namespace GUI { class GUIServer; } namespace Video { class VideoServer; } namespace Input { class InputServer; } namespace Audio { class AudioServer; } namespace Text { class TextServer; } namespace Scene { class SceneServer; } namespace Script { class ScriptServer; } } namespace Nuclex { //  // //  Nuclex::Kernel  // //  // /// Nuclex Kernel /** @todo Denk dir was neues aus */ class Kernel { public: typedef SigC::Signal0 HeartBeatSignal; /// Message types enum MessageType { MT_NONE = 0, ///< No type MT_INFO, ///< Information MT_WARNING, ///< Warning MT_ERROR, ///< Error MT_EXCEPTION = -1 ///< Exception }; /// Load extension module NUCLEX_API static Kernel &getInstance(); /// Emit message to all listeners NUCLEX_API static void logMessage(int eType, const string &sMessage); // // Kernel implementation // public: /// Update tick NUCLEX_API bool heartBeat(); /// Request kernel shutdown NUCLEX_API void requestShutdown(const string &sCause = ""); /// Load a plugin NUCLEX_API void loadPlugin(const string &sPlugin); /// Load all plugins NUCLEX_API void loadAllPlugins(const string &sPath); /// Unload a plugin NUCLEX_API void unloadPlugin(const string &sPlugin); /// Unload all plugins NUCLEX_API void unloadAllPlugins(); /// Get application instance NUCLEX_API Application &getApplication() { return m_Application; } /// Get const application instance NUCLEX_API const Application &getApplication() const { return m_Application; } /// Get storage server NUCLEX_API const shared_ptr &getStorageServer() const { return m_spStorageServer; } /// Get script server NUCLEX_API const shared_ptr &getScriptServer() const { return m_spScriptServer; } /// Get font server NUCLEX_API const shared_ptr &getTextServer() const { return m_spTextServer; } /// Get video server NUCLEX_API const shared_ptr &getVideoServer() const { return m_spVideoServer; } /// Get audio server NUCLEX_API const shared_ptr &getAudioServer() const { return m_spAudioServer; } /// Get input server NUCLEX_API const shared_ptr &getInputServer() const { return m_spInputServer; } /// Get GUI server NUCLEX_API const shared_ptr &getGUIServer() const { return m_spGUIServer; } /// Get scene server NUCLEX_API const shared_ptr &getSceneServer() const { return m_spSceneServer; } /// Engine heart beat HeartBeatSignal OnHeartBeat; private: /// Settings for the plugin class struct PluginSettings { static string VersionFunctionName; static string RegisterFunctionName; static string UnregisterFunctionName; static string FileExtension; }; /// Constructor Kernel(const string &sApplicationName = "Nuclex"); /// Destructor ~Kernel(); /// Not cloneable Kernel(const Kernel &); /// Not assignable void operator =(const Kernel &); /// Type of plugins used for the nuclex kernel typedef Plugin KernelPlugin; /// Map of loaded plugins typedef std::map > PluginMap; Application m_Application; ///< Display bool m_bShutdownRequested; ///< Shutdown requested ? PluginMap m_Plugins; ///< All plugins currently loaded shared_ptr m_spStorageServer; ///< Storage server shared_ptr m_spScriptServer; ///< Script server shared_ptr m_spVideoServer; ///< Video server shared_ptr m_spAudioServer; ///< Audio server shared_ptr m_spTextServer; ///< Text server shared_ptr m_spInputServer; ///< Input server shared_ptr m_spGUIServer; ///< GUI server shared_ptr m_spSceneServer; ///< Scene server }; } // namespace Nuclex #endif // NUCLEX_KERNEL_H