Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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
29 class qSlicerModuleFactoryManagerPrivate;
30 
31 // Slicer logics includes
33 
34 // MRML includes
35 class vtkMRMLScene;
36 
37 class Q_SLICER_BASE_QTCORE_EXPORT qSlicerModuleFactoryManager
39 {
40  Q_OBJECT
41 public:
43  qSlicerModuleFactoryManager(QObject* newParent = nullptr);
44 
46  ~qSlicerModuleFactoryManager() override;
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);
76  vtkSlicerApplicationLogic* appLogic()const;
77 
79  vtkMRMLScene* mrmlScene()const;
80 
85  Q_INVOKABLE bool loadModules(const QStringList& modules);
86 
89  bool loadModule(const QString& name);
90 
92  QStringList modulePaths(const QString& basePath);
93 
94 public slots:
96  void setMRMLScene(vtkMRMLScene* mrmlScene);
97 
98 signals:
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 
109  void mrmlSceneChanged(vtkMRMLScene* newScene);
110 protected:
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();
123 private:
124  Q_DECLARE_PRIVATE(qSlicerModuleFactoryManager);
125  Q_DISABLE_COPY(qSlicerModuleFactoryManager);
126 };
127 
128 #endif
QScopedPointer< qSlicerModuleFactoryManagerPrivate > d_ptr
void uninstantiateModules()
Uninstantiate all instantiated modules.
virtual void uninstantiateModule(const QString &moduleName)
Uninstantiate a module given its moduleName.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
virtual void printAdditionalInfo()
Print internal state using qDebug()
qSlicerAbstractCoreModule is the base class of any module in Slicer.
qSlicerAbstractModuleFactoryManager Superclass