Computer Assited Medical Intervention Tool Kit  version 4.0
ExtensionManager.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2016 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 
27 #ifndef EXTENSIONS_MANAGER_H
28 #define EXTENSIONS_MANAGER_H
29 
30 // -- Core stuff
31 #include "ComponentExtension.h"
32 #include "ActionExtension.h"
33 #include "CamiTKAPI.h"
34 #include "AbortException.h"
35 
36 // -- QT stuff
37 #include <QtPlugin>
38 #include <QPluginLoader>
39 #include <QStringList>
40 #include <QMap>
41 #include <QDir>
42 
43 namespace camitk {
57 class CAMITK_API ExtensionManager : public QObject {
58 
59 public:
61  enum {
62  };
71  VIEWER
72  };
73 
75  static void autoload();
76 
89  static void autoload(ExtensionType type);
90 
98  static bool loadExtension(ExtensionType type, QString file);
99 
113  static QString getInstallationString(QString file);
114 
117  static const ComponentExtension * getComponentExtension(QString);
120 
131  static const QList<ComponentExtension*> getComponentExtensionsList();
132 
143  static const QList<ComponentExtension*> getDataDirectoryComponentsList();
144 
146  static QStringList getFileExtensions();
147 
149  static QStringList getDataDirectoryExtNames();
150 
155  static void registerFileExtension(QString fileExtension);
156 
160  static bool promptRegisterFileExtensions(QStringList fileExtensions);
161 
165  static bool unloadComponentExtension(QString);
167 
168 
171 
173  static void unloadAllActionExtensions();
174 
185  static const QList<ActionExtension*> getActionExtensionsList();
186 
190  static bool unloadActionExtension(QString);
192 
194  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
200  static bool loadComponentExtension(QString file);
201 
206  static bool loadActionExtension(QString);
207 
211  static void autoloadComponentExtensions();
212 
216  static void autoloadActionExtensions();
217 
227  static const QMap<QString, ActionExtension*> & getActionExtensions();
228 
238  static const QMap<QString, ComponentExtension*> & getComponentExtensions();
239 
248  static const QMap<QString, ComponentExtension*> & getDataDirectoryComponents();
249 
250 
252 
253 private:
261  static QMap<QString, ComponentExtension*> & getComponentExtensionMap();
262 
270  static QMap<QString, ComponentExtension*> & getDataDirectoryComponentExtensionMap();
271 
279  static QMap<QString, ActionExtension*> & getActionExtensionMap();
280 
282  static QStringList getExtensionFilter();
283 
285  static QStringList getPluginFileNames(QDir);
286 
293  static void initPrivateLibDirs();
294 
297 
307  static bool componentExtensionLessThan(const ComponentExtension* left, const ComponentExtension* right);
308 
324  static bool actionExtensionLessThan(ActionExtension* left, ActionExtension* right);
326 
327 
328 };
329 
330 }
331 
332 
333 #endif //EXTENSIONS_MANAGER_H
MainWindow extensions: manages the application logic.
Definition: ExtensionManager.h:70
Definition: Action.cpp:40
This class describes what is a generic Component extension.
Definition: ComponentExtension.h:63
#define CAMITK_API
Definition: CamiTKAPI.h:49
This class describes what is a generic Action extension.
Definition: ActionExtension.h:61
This class is used to manage all plugins loaded by the application.
Definition: ExtensionManager.h:57
Component extensions: manages the data logic.
Definition: ExtensionManager.h:69
Action extensions: manages the processing logic.
Definition: ExtensionManager.h:68
ExtensionType
describes the CamiTK Extension Type (Action, Component, Application...).
Definition: ExtensionManager.h:67