Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qSlicerModuleFactoryManager.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17 and was partially funded by NIH grant 3P41RR013218-12S1
18
19==============================================================================*/
20
21#ifndef __qSlicerModuleFactoryManager_h
22#define __qSlicerModuleFactoryManager_h
23
24// Qt includes
25#include <QStringList>
26
27// Slicer includes
29class qSlicerModuleFactoryManagerPrivate;
30
31// Slicer logics includes
33
34// MRML includes
35class vtkMRMLScene;
36
37class Q_SLICER_BASE_QTCORE_EXPORT qSlicerModuleFactoryManager
39{
40 Q_OBJECT
41public:
43 qSlicerModuleFactoryManager(QObject* newParent = nullptr);
44
47
48 void printAdditionalInfo() override;
49
57 Q_INVOKABLE int loadModules();
58
60 Q_INVOKABLE QStringList loadedModuleNames()const;
61
65 Q_INVOKABLE void unloadModules();
66
68 Q_INVOKABLE bool isLoaded(const QString& name)const;
69
72 Q_INVOKABLE qSlicerAbstractCoreModule* loadedModule(const QString& name)const;
73
75 void setAppLogic(vtkSlicerApplicationLogic* applicationLogic);
77
80
85 Q_INVOKABLE bool loadModules(const QStringList& modules);
86
89 bool loadModule(const QString& name);
90
92 QStringList modulePaths(const QString& basePath);
93
94public slots:
97
98signals:
99
100 void modulesLoaded(const QStringList& modulesNames);
101 void moduleLoaded(const QString& moduleName);
102
103 void modulesAboutToBeUnloaded(const QStringList& modulesNames);
104 void moduleAboutToBeUnloaded(const QString& moduleName);
105
106 void modulesUnloaded(const QStringList& modulesNames);
107 void moduleUnloaded(const QString& moduleName);
108
110protected:
111 QScopedPointer<qSlicerModuleFactoryManagerPrivate> d_ptr;
112
113 bool loadModule(const QString& name, const QString& dependee);
114
116 void unloadModule(const QString& name);
117
119 void uninstantiateModule(const QString& moduleName) override;
120
122 virtual void uninstantiateModules();
123private:
124 Q_DECLARE_PRIVATE(qSlicerModuleFactoryManager);
125 Q_DISABLE_COPY(qSlicerModuleFactoryManager);
126};
127
128#endif
qSlicerAbstractCoreModule is the base class of any module in Slicer.
qSlicerAbstractModuleFactoryManager(QObject *newParent=nullptr)
void moduleLoaded(const QString &moduleName)
qSlicerModuleFactoryManager(QObject *newParent=nullptr)
Q_INVOKABLE bool isLoaded(const QString &name) const
Return true if module name has been loaded, false otherwise.
Q_INVOKABLE bool loadModules(const QStringList &modules)
void uninstantiateModule(const QString &moduleName) override
Uninstantiate a module given its moduleName.
void setAppLogic(vtkSlicerApplicationLogic *applicationLogic)
Set the application logic to pass to modules at "load" time.
void moduleUnloaded(const QString &moduleName)
Q_INVOKABLE QStringList loadedModuleNames() const
Return the list of all the loaded modules.
void setMRMLScene(vtkMRMLScene *mrmlScene)
Set the MRML scene to pass to modules at "load" time.
virtual void uninstantiateModules()
Reimplemented to ensure order.
void modulesLoaded(const QStringList &modulesNames)
bool loadModule(const QString &name)
Q_INVOKABLE qSlicerAbstractCoreModule * loadedModule(const QString &name) const
QStringList modulePaths(const QString &basePath)
Return all module paths that are direct child of basePath.
vtkSlicerApplicationLogic * appLogic() const
bool loadModule(const QString &name, const QString &dependee)
void unloadModule(const QString &name)
Unload module identified by name.
void mrmlSceneChanged(vtkMRMLScene *newScene)
void moduleAboutToBeUnloaded(const QString &moduleName)
QScopedPointer< qSlicerModuleFactoryManagerPrivate > d_ptr
qSlicerAbstractModuleFactoryManager Superclass
Q_INVOKABLE int loadModules()
void modulesUnloaded(const QStringList &modulesNames)
void modulesAboutToBeUnloaded(const QStringList &modulesNames)
~qSlicerModuleFactoryManager() override
Unloads all the modules previously loaded.
Q_INVOKABLE void unloadModules()
vtkMRMLScene * mrmlScene() const
Return the mrml scene passed to loaded modules.
void printAdditionalInfo() override
Print internal state using qDebug()
A set of MRML Nodes that supports serialization and undo/redo.