mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-21 18:38:20 -05:00
More module cleanup
This commit is contained in:
@@ -34,27 +34,51 @@ namespace openspace {
|
||||
|
||||
/**
|
||||
* The ModuleEngine is the central repository for registering and accessing
|
||||
* OpenSpaceModule for the current application run. By create%ing the ModuleEngine, the
|
||||
* default set of OpenSpaceModule%s as generated by CMake in the
|
||||
* OpenSpaceModule for the current application run. By initializing (#initialize) the
|
||||
* ModuleEngine, the default set of OpenSpaceModule%s as generated by CMake in the
|
||||
* <code>moduleregistration.h</code> file is automatically registered and created.
|
||||
* Additional OpenSpaceModule%s can be registered with the #registerModule function, which
|
||||
* will internally call the OpenSpaceModule::initialize method.
|
||||
*/
|
||||
class ModuleEngine {
|
||||
public:
|
||||
void create();
|
||||
void destroy();
|
||||
/**
|
||||
* Registers all of the OpenSpaceModule%s which are created by the CMake configuration
|
||||
* and stored in the <code>moduleregistration.h</code> file. For all of those modules
|
||||
* the OpenSpaceModule::initialize method with will called.
|
||||
* \throw ghoul::RuntimeError If two modules in the default modules have the same
|
||||
* name
|
||||
*/
|
||||
void initialize();
|
||||
|
||||
/**
|
||||
* Deinitializes all of the contained OpenSpaceModule%s by calling the
|
||||
* OpenSpaceModule::deinitialize methods.
|
||||
*/
|
||||
void deinitialize();
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
|
||||
void registerModules(std::vector<std::unique_ptr<OpenSpaceModule>> modules);
|
||||
/**
|
||||
* Registers the passed \p module with this ModuleEngine. The OpenSpaceModule::create
|
||||
* method will be called on the \p module in the process.
|
||||
* \param module The OpenSpaceModule that is to be registered
|
||||
* \throw ghoul::RuntimeError If the name of the \p module was already registered
|
||||
* previously
|
||||
* \pre \p module must not be nullptr
|
||||
*/
|
||||
void registerModule(std::unique_ptr<OpenSpaceModule> module);
|
||||
|
||||
/**
|
||||
* Returns a list of all registered OpenSpaceModule%s that have been registered with
|
||||
* this ModuleEngine. All returned OpenSpaceModule%s are guaranteed to be initialized.
|
||||
* \return A list of all registered OpenSpaceModule%s
|
||||
*/
|
||||
std::vector<OpenSpaceModule*> modules() const;
|
||||
|
||||
protected:
|
||||
private:
|
||||
/// The list of all registered OpenSpaceModule%s
|
||||
std::vector<std::unique_ptr<OpenSpaceModule>> _modules;
|
||||
};
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __MODULEENGINE_H__
|
||||
|
||||
Reference in New Issue
Block a user