Emergency 2017 Dokumentation  v3.0.1
qsf::Qsf Class Reference

QSF class. More...

#include <Qsf.h>

Public Member Functions

 Qsf (ApplicationContext &applicationContext)
 Constructor. More...
 
 ~Qsf ()
 Destructor. More...
 
ApplicationContextgetApplicationContext ()
 Return the currently used application context. More...
 
const ApplicationContextgetApplicationContext () const
 Return the currently used application context. More...
 
void switchApplicationContext (ApplicationContext &applicationContext, bool returnToApplicationContext)
 Switch to another application context. More...
 
bool startup (bool serverMode=false)
 Startup QSF. More...
 
void run (const std::string &applicationClassName, const std::vector< std::string > &programOptions, const boost::property_tree::ptree *parametersPTree=nullptr)
 Run an QSF application. More...
 
ApplicationgetApplication () const
 Return the running application instance. More...
 
void shutdown ()
 Shutdown QSF. More...
 
WorkerSystemgetWorkerSystem () const
 Return the worker system instance. More...
 
PlatformSystemgetPlatformSystem () const
 Return the platform system instance. More...
 
FileSystemgetFileSystem () const
 Return the file system instance. More...
 
LogSystemgetLogSystem () const
 Return the log system instance. More...
 
LocalizationSystemgetLocalizationSystem () const
 Return the localization system instance. More...
 
JobSystemgetJobSystem () const
 Return the job system instance. More...
 
ClassSystemgetClassSystem () const
 Return the class system instance. More...
 
PluginSystemgetPluginSystem () const
 Return the plugin system instance. More...
 
AssetSystemgetAssetSystem () const
 Return the asset system instance. More...
 
WindowSystemgetWindowSystem () const
 Return the window system instance. More...
 
ScriptSystemgetScriptSystem () const
 Return the script system instance. More...
 
RendererSystemgetRendererSystem () const
 Return the renderer system instance. More...
 
PhysicsSystemgetPhysicsSystem () const
 Return the physics system instance. More...
 
InputSystemgetInputSystem () const
 Return the input system instance. More...
 
AudioSystemgetAudioSystem () const
 Return the audio system instance. More...
 
NetworkSystemgetNetworkSystem () const
 Return the network system instance. More...
 
MessageSystemgetMessageSystem () const
 Return the message system instance. More...
 
ComponentSystemgetComponentSystem () const
 Return the component system instance. More...
 
PrototypeSystemgetPrototypeSystem () const
 Return the prototype system instance. More...
 
LinkSystemgetLinkSystem () const
 Return the link system instance. More...
 
MapSystemgetMapSystem () const
 Return the map system instance. More...
 
GuiSystemgetGuiSystem () const
 Return the GUI system instance. More...
 
ActionExecutionSystemgetActionExecutionSystem () const
 Return the script action system instance. More...
 
SettingsGroupManagergetSettingsGroupManager ()
 Return the settings group manager instance. More...
 
DebugGroupManagergetDebugGroupManager ()
 Return the debug group manager instance. More...
 
PrototypeManagergetMainPrototypeManager () const
 Return the main prototype manager instance. More...
 
MapgetMainMap () const
 Return the main map instance. More...
 
DebugDrawManagergetDebugDrawManager () const
 Return the debug draw manager instance. More...
 
virtual const char * getSystemContainerName () const override
 
- Public Member Functions inherited from qsf::SystemContainer
 SystemContainer ()
 Default constructor. More...
 
virtual ~SystemContainer ()
 Destructor. More...
 
bool startupSystems (bool serverMode)
 Startup all registered systems in the order of registeration. More...
 
void shutdownSystems ()
 Shutdown all registered systems in reverse registration order. More...
 
const std::vector< System * > & getSystems () const
 Return the list of systems. More...
 

Static Public Member Functions

static Qsfinstance ()
 Return the global QSF instance. More...
 

Protected Member Functions

virtual void logSystemMessage (const std::string &message) override
 
- Protected Member Functions inherited from qsf::SystemContainer
template<typename T >
T * createAndInsertSystem ()
 

Additional Inherited Members

- Protected Attributes inherited from qsf::SystemContainer
std::vector< System * > mSystems
 The systems, do not destroy the instances. More...
 

Detailed Description

QSF class.

Remarks
This is the central part of the Quadriga Simulation Framework (QSF). It's purpose is to startup and administer all systems (renderer, audio etc.) as well as running an QSF application.

QSF lifecycle:

  • "startup()"
  • "run()"
  • "shutdown()"

The most basic usage looks like the following:

// Prepare the application context
qsf::ApplicationContext applicationContext;
applicationContext.setApplicationName("QSF Sample");
applicationContext.setApplicationVersion("0.0.1");
applicationContext.setOrganizationName("Promotion Software GmbH");
applicationContext.setOrganizationDomain("promotion-software.de");
applicationContext.setSplashScreen("sample.bmp");
{ // Plugins
std::vector<std::string> plugins;
plugins.push_back("editor");
plugins.push_back("sample");
plugins.push_back("sample_editor");
applicationContext.setPlugins(plugins);
}
applicationContext.setApplicationClassName("sample::Application");
// Feed the QSF instance with the application context
qsf::Qsf qsf(applicationContext);
if (qsf.startup())
{
qsf.run(applicationContext.getApplicationClassName(), std::vector<std::string>());
qsf.shutdown();
}

Instead of writing "qsf::Qsf::instance()->getAudioSystem()" to access the audio system, you can also use the ease of use macro "QSF_AUDIO". The following QSF macros exist inside the "qsf/QsfHelper.h" header: "QSF_PLATFORM", "QSF_FILE", "QSF_LOG", "QSF_LOCALIZATION", "QSF_JOB", "QSF_CLASS", "QSF_PLUGIN", "QSF_ASSET", "QSF_SCRIPT", "QSF_RENDERER", "QSF_PARTICLE", "QSF_PHYSICS", "QSF_INPUT", "QSF_AUDIO", "QSF_NETWORK", "QSF_COMPONENT", "QSF_PROTOTYPE", "QSF_MAP", "QSF_GUI", "QSF_WORKER" and "QSF_APPLICATION"

Note
  • There should only exist one QSF instance at one and the same time

Definition at line 132 of file Qsf.h.

Constructor & Destructor Documentation

qsf::Qsf::Qsf ( ApplicationContext applicationContext)
explicit

Constructor.

Parameters
[in]applicationContextApplication context the QSF instance should use
Remarks
  • QSF takes ownership of the given applicationContext
qsf::Qsf::~Qsf ( )

Destructor.

Note
  • Not virtual by intent

Member Function Documentation

ActionExecutionSystem & qsf::Qsf::getActionExecutionSystem ( ) const
inline

Return the script action system instance.

Returns
The script action system instance, do no destroy the returned instance

Definition at line 189 of file Qsf-inl.h.

Application * qsf::Qsf::getApplication ( ) const
inline

Return the running application instance.

Returns
Pointer to the running application instance, can be a null pointer, do no destroy the returned instance
Note
  • The application instance pointer is set and also unset within the "run()"-method

Definition at line 30 of file Qsf-inl.h.

ApplicationContext & qsf::Qsf::getApplicationContext ( )
inline

Return the currently used application context.

Returns
The currently used application context, do no destroy the returned instance

Definition at line 20 of file Qsf-inl.h.

const ApplicationContext & qsf::Qsf::getApplicationContext ( ) const
inline

Return the currently used application context.

Returns
The currently used application context, do no destroy the returned instance

Definition at line 25 of file Qsf-inl.h.

AssetSystem & qsf::Qsf::getAssetSystem ( ) const
inline

Return the asset system instance.

Returns
The asset system instance, do no destroy the returned instance

Definition at line 91 of file Qsf-inl.h.

AudioSystem & qsf::Qsf::getAudioSystem ( ) const
inline

Return the audio system instance.

Returns
The audio system instance, do no destroy the returned instance

Definition at line 133 of file Qsf-inl.h.

ClassSystem & qsf::Qsf::getClassSystem ( ) const
inline

Return the class system instance.

Returns
The class system instance, do no destroy the returned instance

Definition at line 77 of file Qsf-inl.h.

ComponentSystem & qsf::Qsf::getComponentSystem ( ) const
inline

Return the component system instance.

Returns
The component system instance, do no destroy the returned instance

Definition at line 154 of file Qsf-inl.h.

DebugDrawManager& qsf::Qsf::getDebugDrawManager ( ) const

Return the debug draw manager instance.

Returns
The debug draw manager instance, do no destroy the returned instance
Note
  • This ease-of-use method was added to make committing debug draw requests, which are a part of "qsf::MapSystem", more comfortable
  • Please do not use this method if you can avoid it, use the debug draw manager of a concrete map instance instead
DebugGroupManager& qsf::Qsf::getDebugGroupManager ( )

Return the debug group manager instance.

Returns
The debug group manager instance, do no destroy the returned instance
Todo:
TODO(co) Find a better place for the debug group manager
FileSystem & qsf::Qsf::getFileSystem ( ) const
inline

Return the file system instance.

Returns
The file system instance, do no destroy the returned instance

Definition at line 49 of file Qsf-inl.h.

GuiSystem & qsf::Qsf::getGuiSystem ( ) const
inline

Return the GUI system instance.

Returns
The GUI system instance, do no destroy the returned instance

Definition at line 182 of file Qsf-inl.h.

InputSystem & qsf::Qsf::getInputSystem ( ) const
inline

Return the input system instance.

Returns
The input system instance, do no destroy the returned instance

Definition at line 126 of file Qsf-inl.h.

JobSystem & qsf::Qsf::getJobSystem ( ) const
inline

Return the job system instance.

Returns
The job system instance, do no destroy the returned instance

Definition at line 70 of file Qsf-inl.h.

LinkSystem & qsf::Qsf::getLinkSystem ( ) const
inline

Return the link system instance.

Returns
The link system instance, do no destroy the returned instance

Definition at line 168 of file Qsf-inl.h.

LocalizationSystem & qsf::Qsf::getLocalizationSystem ( ) const
inline

Return the localization system instance.

Returns
The localization system instance, do no destroy the returned instance

Definition at line 63 of file Qsf-inl.h.

LogSystem & qsf::Qsf::getLogSystem ( ) const
inline

Return the log system instance.

Returns
The log system instance, do no destroy the returned instance

Definition at line 56 of file Qsf-inl.h.

Map& qsf::Qsf::getMainMap ( ) const

Return the main map instance.

Returns
The main map instance, do no destroy the returned instance
Note
  • This ease-of-use method was added to make accessing the main map, which are a part of "qsf::MapSystem", more comfortable
  • Please do not use this method if you can avoid it, use concrete map instances instead
PrototypeManager& qsf::Qsf::getMainPrototypeManager ( ) const

Return the main prototype manager instance.

Returns
The main prototype manager instance, do no destroy the returned instance
Note
  • This ease-of-use method was added to make accessing the main prototype manager, which are a part of "qsf::PrototypeSystem", more comfortable
  • Please do not use this method if you can avoid it, use concrete prototype manager instances instead
MapSystem & qsf::Qsf::getMapSystem ( ) const
inline

Return the map system instance.

Returns
The map system instance, do no destroy the returned instance

Definition at line 175 of file Qsf-inl.h.

MessageSystem & qsf::Qsf::getMessageSystem ( ) const
inline

Return the message system instance.

Returns
The message system instance, do no destroy the returned instance

Definition at line 147 of file Qsf-inl.h.

NetworkSystem & qsf::Qsf::getNetworkSystem ( ) const
inline

Return the network system instance.

Returns
The network system instance, do no destroy the returned instance

Definition at line 140 of file Qsf-inl.h.

PhysicsSystem & qsf::Qsf::getPhysicsSystem ( ) const
inline

Return the physics system instance.

Returns
The physics system instance, do no destroy the returned instance

Definition at line 119 of file Qsf-inl.h.

PlatformSystem & qsf::Qsf::getPlatformSystem ( ) const
inline

Return the platform system instance.

Returns
The platform system instance, do no destroy the returned instance

Definition at line 42 of file Qsf-inl.h.

PluginSystem & qsf::Qsf::getPluginSystem ( ) const
inline

Return the plugin system instance.

Returns
The plugin system instance, do no destroy the returned instance

Definition at line 84 of file Qsf-inl.h.

PrototypeSystem & qsf::Qsf::getPrototypeSystem ( ) const
inline

Return the prototype system instance.

Returns
The prototype system instance, do no destroy the returned instance

Definition at line 161 of file Qsf-inl.h.

RendererSystem & qsf::Qsf::getRendererSystem ( ) const
inline

Return the renderer system instance.

Returns
The renderer system instance, do no destroy the returned instance

Definition at line 112 of file Qsf-inl.h.

ScriptSystem & qsf::Qsf::getScriptSystem ( ) const
inline

Return the script system instance.

Returns
The script system instance, do no destroy the returned instance

Definition at line 105 of file Qsf-inl.h.

SettingsGroupManager& qsf::Qsf::getSettingsGroupManager ( )

Return the settings group manager instance.

Returns
The settings group manager instance, do no destroy the returned instance
Todo:
TODO(co) Find a better place for the settings group manager
const char * qsf::Qsf::getSystemContainerName ( ) const
inlineoverridevirtual

Implements qsf::SystemContainer.

Definition at line 200 of file Qsf-inl.h.

WindowSystem & qsf::Qsf::getWindowSystem ( ) const
inline

Return the window system instance.

Returns
The window system instance, do no destroy the returned instance

Definition at line 98 of file Qsf-inl.h.

WorkerSystem & qsf::Qsf::getWorkerSystem ( ) const
inline

Return the worker system instance.

Returns
The worker system instance, do no destroy the returned instance

Definition at line 35 of file Qsf-inl.h.

static Qsf* qsf::Qsf::instance ( )
static

Return the global QSF instance.

Returns
The global QSF instance, null pointer in case there's no such global instance, do no destroy the returned instance
Remarks
This QSF class plays a central role and therefore we decided to make it to a singleton. The approach is the same as the one used by Qt's "QCoreApplication::instance()".
virtual void qsf::Qsf::logSystemMessage ( const std::string &  message)
overrideprotectedvirtual

Reimplemented from qsf::SystemContainer.

void qsf::Qsf::run ( const std::string &  applicationClassName,
const std::vector< std::string > &  programOptions,
const boost::property_tree::ptree parametersPTree = nullptr 
)

Run an QSF application.

Parameters
[in]applicationClassNameCAMP reflection ASCII class name of the application to run (e.g. "sample::Application")
[in]programOptionsList of UTF-8 program options, the first entry is always the absolute executable filename
[in]parametersPTreeOptional application-specific parameters as a generic Boost property tree
Note
  • Do only call this method in case "startup()" returned successfully
  • In case there's a next application context the current context (see "qsf::Qsf::getApplicationContext()") will be switched to this new application context and the next application context will be reset to a null pointer
void qsf::Qsf::shutdown ( )

Shutdown QSF.

Remarks
The implementation does the following tasks:
  • Clear map ("qsf::MapSystem::clear()" followed by "qsf::MapSystem::performGarbageCollection()")
  • Unload all plugins ("qsf::PluginSystem::unloadAllPlugins()")
  • Shutdown the action execution system ("qsf::ActionExecutionSystem::onShutdown()")
  • Shutdown the GUI system ("qsf::GuiSystem::onShutdown()")
  • Shutdown the map system ("qsf::MapSystem::onShutdown()")
  • Shutdown the prototype system ("qsf::PrototypeSystem::onShutdown()")
  • Shutdown the link system ("qsf::LinkSystem::onShutdown()")
  • Shutdown the component system ("qsf::ComponentSystem::onShutdown()")
  • Shutdown the message system ("qsf::MessageSystem::onShutdown()")
  • Shutdown the network system ("qsf::NetworkSystem::onShutdown()")
  • Shutdown the audio system ("qsf::AudioSystem::onShutdown()")
  • Shutdown the input system ("qsf::InputSystem::onShutdown()")
  • Shutdown the physics system ("qsf::PhysicsSystem::onShutdown()")
  • Shutdown the renderer system ("qsf::RendererSystem::onShutdown()")
  • Shutdown the script system ("qsf::ScriptSystem::onShutdown()")
  • Shutdown the window system ("qsf::WindowSystem::onShutdown()")
  • Shutdown the asset system ("qsf::AssetSystem::onShutdown()")
  • Shutdown the plugin system ("qsf::PluginSystem::onShutdown()")
  • Shutdown the class system ("qsf::ClassSystem::onShutdown()")
  • Shutdown the job system ("qsf::JobSystem::onShutdown()")
  • Shutdown the localization system ("qsf::LocalizationSystem::onShutdown()")
  • Shutdown the log system ("qsf::LogSystem::onShutdown()")
  • Shutdown the file system ("qsf::FileSystem::onShutdown()")
  • Shutdown the platform system ("qsf::PlatformSystem::onShutdown()")
  • Shutdown the worker system ("qsf::WorkerSystem::onStartup()")
  • Destroy the project manager instance, in case there's one
  • Destroy the debug group manager instance, in case there's one
  • Destroy the settings group manager instance, in case there's one
  • Destroy the string hash manager instance
Note
  • Do only call this method in case "startup()" returned successfully
bool qsf::Qsf::startup ( bool  serverMode = false)

Startup QSF.

Parameters
[in]serverMode"true" if the system should start in server mode, else "false"
Returns
"true" if all went fine, else "false"
Remarks
The implementation does the following tasks:
  • Startup the worker system ("qsf::WorkerSystem::onStartup()")
  • Startup the platform system ("qsf::PlatformSystem::onStartup()")
  • Startup the file system ("qsf::FileSystem::onStartup()")
  • Startup the log system ("qsf::LogSystem::onStartup()")
  • Startup the localization system ("qsf::LocalizationSystem::onStartup()")
  • Startup the job system ("qsf::JobSystem::onStartup()")
  • Startup the class system ("qsf::ClassSystem::onStartup()")
  • Startup the plugin system ("qsf::PluginSystem::onStartup()")
  • Startup the asset system ("qsf::AssetSystem::onStartup()")
  • Startup the window system ("qsf::WindowSystem::onStartup()")
  • Startup the script system ("qsf::ScriptSystem::onStartup()")
  • Startup the renderer system ("qsf::RendererSystem::onStartup()")
  • Startup the physics system ("qsf::PhysicsSystem::onStartup()")
  • Startup the input system ("qsf::InputSystem::onStartup()")
  • Startup the audio system ("qsf::AudioSystem::onStartup()")
  • Startup the network system ("qsf::NetworkSystem::onStartup()")
  • Startup the message system ("qsf::MessageSystem::onStartup()")
  • Startup the component system ("qsf::ComponentSystem::onStartup()")
  • Startup the link system ("qsf::LinkSystem::onStartup()")
  • Startup the prototype system ("qsf::PrototypeSystem::onStartup()")
  • Startup the map system ("qsf::MapSystem::onStartup()")
  • Startup the GUI system ("qsf::GuiSystem::onStartup()")
  • Startup the action execution system ("qsf::ActionExecutionSystem::onStartup()")
  • Load application context plugins (set via "qsf::ApplicationContext::setPlugins()")
Note
  • Server mode means that e.g. there's no need for audio & visual stuff because there's no display or sound hardware in the first place
void qsf::Qsf::switchApplicationContext ( ApplicationContext applicationContext,
bool  returnToApplicationContext 
)

Switch to another application context.

Parameters
[in]applicationContextApplication context the QSF instance should switch to
[in]returnToApplicationContextReturn to the current application context when done with the application we should now switch to?
Remarks
  • Qsf takes ownership of the given application context

The documentation for this class was generated from the following files: