More module cleanup

This commit is contained in:
Alexander Bock
2015-12-14 11:46:44 -08:00
parent 2fce471743
commit 6eca5c0f68
13 changed files with 128 additions and 104 deletions
+34 -10
View File
@@ -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__