Inviwo  0.9.10.1
Inviwo documentation
inviwo::ModuleManager Class Reference

#include <modulemanager.h>

Public Types

using IdSet = std::set< std::string, CaseInsensitiveCompare >
 

Public Member Functions

 ModuleManager (InviwoApplication *app)
 
 ModuleManager (const ModuleManager &rhs)=delete
 
ModuleManageroperator= (const ModuleManager &that)=delete
 
bool isRuntimeModuleReloadingEnabled ()
 
void registerModules (std::vector< std::unique_ptr< InviwoModuleFactoryObject >> moduleFactories)
 Registers modules from factories and takes ownership of input module factories. Module is registered if dependencies exist and they have correct version.
 
void registerModules (RuntimeModuleLoading)
 Load modules from dynamic library files in the specified search paths. More...
 
void unregisterModules ()
 Removes all modules not marked as protected by the application. More...
 
const std::vector< std::unique_ptr< InviwoModule > > & getModules () const
 
const std::vector< std::unique_ptr< InviwoModuleFactoryObject > > & getModuleFactoryObjects () const
 
template<class T >
T * getModuleByType () const
 
InviwoModulegetModuleByIdentifier (const std::string &identifier) const
 
std::vector< InviwoModule * > getModulesByAlias (const std::string &alias) const
 
InviwoModuleFactoryObjectgetFactoryObject (const std::string &identifier) const
 
std::vector< std::string > findDependentModules (const std::string &module) const
 
std::shared_ptr< std::function< void()> > onModulesDidRegister (std::function< void()> callback)
 Register callback for monitoring when modules have been registered. Invoked in registerModules.
 
std::shared_ptr< std::function< void()> > onModulesWillUnregister (std::function< void()> callback)
 Register callback for monitoring when modules have been registered. Invoked in unregisterModules.
 
const IdSet & getProtectedModuleIdentifiers () const
 List of modules to keep during runtime library reloading. More...
 
bool isProtected (const std::string &module) const
 
void addProtectedIdentifier (const std::string &id)
 
void reloadModules ()
 

Static Public Member Functions

static std::function< bool(const std::string &)> getEnabledFilter ()
 

Detailed Description

Manages finding, loading, unloading, reloading of Inviwo modules

Member Function Documentation

◆ getProtectedModuleIdentifiers()

const std::set< std::string, CaseInsensitiveCompare > & inviwo::ModuleManager::getProtectedModuleIdentifiers ( ) const

List of modules to keep during runtime library reloading.

Some modules such as Core can cause errors if unloaded. Append them to this list in your application to prevent them from being unloaded.

Returns
Module identifiers of modules

◆ registerModules()

void inviwo::ModuleManager::registerModules ( RuntimeModuleLoading  )

Load modules from dynamic library files in the specified search paths.

Will recursively search for all dll/so/dylib/bundle files in the specified search paths. The library filename must contain "inviwo-module" to be loaded.

Note
Which modules to load can be specified by creating a file (application_name-enabled-modules.txt) containing the names of the modules to load.

◆ unregisterModules()

void inviwo::ModuleManager::unregisterModules ( )

Removes all modules not marked as protected by the application.

Use this function with care since all modules will be destroyed.

  1. Network will be cleared.
  2. Non-protected modules will be removed.
  3. Loaded dynamic module libraries will be unloaded (unless marked as protected).
See also
InviwoApplication::getProtectedModuleIdentifiers
InviwoModuleLibraryObserver

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