Slicer
5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
#include <Base/QTCore/qSlicerAbstractModuleFactoryManager.h>
Public Types | |
typedef ctkAbstractFileBasedFactory< qSlicerAbstractCoreModule > | qSlicerFileBasedModuleFactory |
typedef ctkAbstractFactory< qSlicerAbstractCoreModule > | qSlicerModuleFactory |
typedef QObject | Superclass |
Properties | |
QStringList | modulesToIgnore |
QStringList | searchPaths |
Public Slots | |
bool | isVerbose () const |
void | setIsVerbose (bool flag) |
Signals | |
void | explicitModulesChanged (const QStringList &moduleNames) |
void | moduleAboutToBeUninstantiated (const QString &moduleName) |
void | moduleIgnored (const QString &moduleName) |
void | moduleInstantiated (const QString &moduleName) |
void | moduleRegistered (const QString &moduleName) |
void | modulesAboutToBeUninstantiated (const QStringList &moduleNames) |
void | modulesInstantiated (const QStringList &moduleNames) |
void | modulesRegistered (const QStringList &moduleNames) |
This signal is emitted when all the modules associated with the registered factories have been loaded. More... | |
void | modulesToIgnoreChanged (const QStringList &moduleNames) |
void | modulesUninstantiated (const QStringList &moduleNames) |
void | moduleUninstantiated (const QString &moduleName) |
Public Member Functions | |
void | addModuleToIgnore (const QString &moduleName) |
void | addSearchPath (const QString &path) |
Utility function that adds a path to the current searchPaths list. More... | |
void | addSearchPaths (const QStringList &paths) |
QStringList | dependentModules (const QString &module) const |
QStringList | explicitModules () const |
QStringList | ignoredModuleNames () const |
Q_INVOKABLE QStringList | instantiatedModuleNames () const |
List of registered and instantiated modules. More... | |
virtual void | instantiateModules () |
Instantiate all previously registered modules. More... | |
Q_INVOKABLE bool | isInstantiated (const QString &name) const |
Return true if a module has been instantiated, false otherwise. More... | |
Q_INVOKABLE bool | isRegistered (const QString &name) const |
Return true if a module has been registered, false otherwise. More... | |
QStringList | moduleDependees (const QString &module) const |
Q_INVOKABLE qSlicerAbstractCoreModule * | moduleInstance (const QString &moduleName) const |
Return the instance of a module if already instantiated, 0 otherwise. More... | |
QStringList | modulesToIgnore () const |
virtual void | printAdditionalInfo () |
Print internal state using qDebug() More... | |
qSlicerAbstractModuleFactoryManager (QObject *newParent=nullptr) | |
Q_INVOKABLE QStringList | registeredModuleNames () const |
Convenient method returning the list of all registered module names. More... | |
void | registerFactory (qSlicerModuleFactory *factory, int priority=0) |
Register a factory The factory will be deleted when unregistered (e.g. in ~qSlicerAbstractModuleFactoryManager()) More... | |
Q_INVOKABLE void | registerModule (const QFileInfo &file) |
void | registerModules () |
void | removeModuleToIgnore (const QString &moduleName) |
void | removeSearchPath (const QString &path) |
Utility function that removes a path from the current searchPaths list. More... | |
void | removeSearchPaths (const QStringList &paths) |
QStringList | searchPaths () const |
void | setExplicitModules (const QStringList &moduleNames) |
void | setModulesToIgnore (const QStringList &modulesNames) |
void | setSearchPaths (const QStringList &searchPaths) |
void | setVerboseModuleDiscovery (bool value) |
Enable/Disable verbose output during module discovery process. More... | |
void | uninstantiateModules () |
Uninstantiate all instantiated modules. More... | |
void | unregisterFactories () |
void | unregisterFactory (qSlicerModuleFactory *factory) |
~qSlicerAbstractModuleFactoryManager () override | |
Protected Member Functions | |
qSlicerAbstractCoreModule * | instantiateModule (const QString &name) |
Instantiate a module given its name. More... | |
void | registerModules (const QString &directoryPath) |
virtual void | uninstantiateModule (const QString &moduleName) |
Uninstantiate a module given its moduleName. More... | |
Protected Attributes | |
QScopedPointer< qSlicerAbstractModuleFactoryManagerPrivate > | d_ptr |
Loading modules into slicer happens in multiple steps: 1) module factories must be registered into the factory manager: qSlicerModuleFactoryManager* factoryManager = app->moduleManager()->factoryManager(); factoryManager->registerFactory(new qSlicerLoadableModuleFactory); ... 2) directories where the modules to load are located must be passed to the factory manager factoryManager->addSearchPath(app->slicerHome() + "/" + Slicer_QTSCRIPTEDMODULES_LIB_DIR + "/" ); factoryManager->addSearchPath(app->slicerHome() + "/" + Slicer_CLIMODULES_LIB_DIR + "/" ); ... 3) Optionally:
Definition at line 65 of file qSlicerAbstractModuleFactoryManager.h.
typedef ctkAbstractFileBasedFactory<qSlicerAbstractCoreModule> qSlicerAbstractModuleFactoryManager::qSlicerFileBasedModuleFactory |
Definition at line 86 of file qSlicerAbstractModuleFactoryManager.h.
typedef ctkAbstractFactory<qSlicerAbstractCoreModule> qSlicerAbstractModuleFactoryManager::qSlicerModuleFactory |
Definition at line 87 of file qSlicerAbstractModuleFactoryManager.h.
typedef QObject qSlicerAbstractModuleFactoryManager::Superclass |
Definition at line 89 of file qSlicerAbstractModuleFactoryManager.h.
|
readwrite |
This property holds the names of the modules to ignore at registration time.
Due to the large amount of modules to load, it can be faster (and less overwhelming) to load only a subset of the modules.
Definition at line 84 of file qSlicerAbstractModuleFactoryManager.h.
|
readwrite |
This property holds the paths where the modules are located. At registration time (registerModules), the paths are scanned and module discovered. A module can be a library (dll, so), an executable (exe), a python file (py) or any other file type supported by the registered factories. The search is not recursive, you need to provide each subdirectory manually.
Definition at line 78 of file qSlicerAbstractModuleFactoryManager.h.
qSlicerAbstractModuleFactoryManager::qSlicerAbstractModuleFactoryManager | ( | QObject * | newParent = nullptr | ) |
|
override |
Destructor, Deallocates resources Unregister (and delete) all registered factories.
|
inline |
Utility function that adds a module to the modulesToIgnore list.
Definition at line 271 of file qSlicerAbstractModuleFactoryManager.h.
|
inline |
Utility function that adds a path to the current searchPaths list.
Definition at line 248 of file qSlicerAbstractModuleFactoryManager.h.
|
inline |
Utility function that adds a list of path to the current searchPaths list.
Definition at line 242 of file qSlicerAbstractModuleFactoryManager.h.
QStringList qSlicerAbstractModuleFactoryManager::dependentModules | ( | const QString & | module | ) | const |
Return the list of modules that have module as a dependency. Note that the list can contain unloaded modules.
QStringList qSlicerAbstractModuleFactoryManager::explicitModules | ( | ) | const |
|
signal |
QStringList qSlicerAbstractModuleFactoryManager::ignoredModuleNames | ( | ) | const |
After the modules are registered, ignoredModules contains the list of all the modules that were ignored.
Q_INVOKABLE QStringList qSlicerAbstractModuleFactoryManager::instantiatedModuleNames | ( | ) | const |
List of registered and instantiated modules.
|
protected |
Instantiate a module given its name.
|
virtual |
Instantiate all previously registered modules.
Q_INVOKABLE bool qSlicerAbstractModuleFactoryManager::isInstantiated | ( | const QString & | name | ) | const |
Return true if a module has been instantiated, false otherwise.
Q_INVOKABLE bool qSlicerAbstractModuleFactoryManager::isRegistered | ( | const QString & | name | ) | const |
Return true if a module has been registered, false otherwise.
|
slot |
|
signal |
QStringList qSlicerAbstractModuleFactoryManager::moduleDependees | ( | const QString & | module | ) | const |
Return the list of modules that depend on module. Note that the list can contain unloaded modules.
|
signal |
Q_INVOKABLE qSlicerAbstractCoreModule* qSlicerAbstractModuleFactoryManager::moduleInstance | ( | const QString & | moduleName | ) | const |
Return the instance of a module if already instantiated, 0 otherwise.
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
This signal is emitted when all the modules associated with the registered factories have been loaded.
QStringList qSlicerAbstractModuleFactoryManager::modulesToIgnore | ( | ) | const |
|
signal |
|
signal |
|
signal |
|
virtual |
Print internal state using qDebug()
Reimplemented in qSlicerModuleFactoryManager.
Q_INVOKABLE QStringList qSlicerAbstractModuleFactoryManager::registeredModuleNames | ( | ) | const |
Convenient method returning the list of all registered module names.
void qSlicerAbstractModuleFactoryManager::registerFactory | ( | qSlicerModuleFactory * | factory, |
int | priority = 0 |
||
) |
Register a factory The factory will be deleted when unregistered (e.g. in ~qSlicerAbstractModuleFactoryManager())
Example:
The order in which factories are registered is important. When scanning directories, registered factories are browse and the first factory that can read a file is used. Priority is used when multiple factories can register the same module. The factory with the higher priority wins.
Q_INVOKABLE void qSlicerAbstractModuleFactoryManager::registerModule | ( | const QFileInfo & | file | ) |
void qSlicerAbstractModuleFactoryManager::registerModules | ( | ) |
Scan the paths in searchPaths and for each file, attempt to register using one of the registered factories.
|
protected |
|
inline |
Utility function that removes a module to the modulesToIgnore list.
Definition at line 283 of file qSlicerAbstractModuleFactoryManager.h.
|
inline |
Utility function that removes a path from the current searchPaths list.
Definition at line 263 of file qSlicerAbstractModuleFactoryManager.h.
|
inline |
Utility function that removes a list of path to the current searchPaths list.
Definition at line 254 of file qSlicerAbstractModuleFactoryManager.h.
QStringList qSlicerAbstractModuleFactoryManager::searchPaths | ( | ) | const |
void qSlicerAbstractModuleFactoryManager::setExplicitModules | ( | const QStringList & | moduleNames | ) |
|
slot |
Enable/disable local verbose output during module discovery and uninstantiating, set by setVerboseModuleDiscovery()
void qSlicerAbstractModuleFactoryManager::setModulesToIgnore | ( | const QStringList & | modulesNames | ) |
Set or get the modulesToIgnore list.
If list is modified, the signal modulesToIgnoreChanged(const QStringLists&) is emitted.
void qSlicerAbstractModuleFactoryManager::setSearchPaths | ( | const QStringList & | searchPaths | ) |
void qSlicerAbstractModuleFactoryManager::setVerboseModuleDiscovery | ( | bool | value | ) |
Enable/Disable verbose output during module discovery process.
|
protectedvirtual |
Uninstantiate a module given its moduleName.
Reimplemented in qSlicerModuleFactoryManager.
void qSlicerAbstractModuleFactoryManager::uninstantiateModules | ( | ) |
Uninstantiate all instantiated modules.
void qSlicerAbstractModuleFactoryManager::unregisterFactories | ( | ) |
void qSlicerAbstractModuleFactoryManager::unregisterFactory | ( | qSlicerModuleFactory * | factory | ) |
|
protected |
Definition at line 226 of file qSlicerAbstractModuleFactoryManager.h.