Computer Assited Medical Intervention Tool Kit  version 4.1
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-2018 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:
68  VIEWER
69  };
70 
72  static void autoload();
73 
86  static void autoload(ExtensionType type);
87 
95  static bool loadExtension(ExtensionType type, QString file);
96 
113  static QString getInstallationString(QString file, const QString& globalInstallDir, const QString& userInstallDir, const QString& currentWorkingDir);
114 
117 
121  static ComponentExtension* getComponentExtension(QString);
122 
133  static const QList<ComponentExtension*> getComponentExtensionsList();
134 
138  static ComponentExtension* getDataDirectoryComponentExtension(QString);
139 
150  static const QList<ComponentExtension*> getDataDirectoryComponentsList();
151 
153  static QStringList getFileExtensions();
154 
156  static QStringList getDataDirectoryExtNames();
157 
162  static void registerFileExtension(QString fileExtension);
163 
167  static bool unloadComponentExtension(QString);
169 
170 
173 
175  static void unloadAllActionExtensions();
176 
187  static const QList<ActionExtension*> getActionExtensionsList();
188 
197  static ActionExtension* getActionExtension(QString);
198 
202  static bool unloadActionExtension(QString);
204 
205 private:
213  static QMap<QString, ComponentExtension*>& getComponentExtensionMap();
214 
222  static QMap<QString, ComponentExtension*>& getDataDirectoryComponentExtensionMap();
223 
231  static QMap<QString, ActionExtension*>& getActionExtensionMap();
232 
234  static QStringList getExtensionFilter();
235 
237  static QStringList getPluginFileNames(QDir);
238 
245  static void initPrivateLibDirs();
246 
249 
259  static bool componentExtensionLessThan(const ComponentExtension* left, const ComponentExtension* right);
260 
276  static bool actionExtensionLessThan(ActionExtension* left, ActionExtension* right);
278 };
279 
280 }
281 
282 
283 #endif //EXTENSIONS_MANAGER_H
MainWindow extensions: manages the application logic.
Definition: ExtensionManager.h:67
Definition: Action.cpp:36
This class describes what is a generic Component extension.
Definition: ComponentExtension.h:57
#define CAMITK_API
Definition: CamiTKAPI.h:49
This class describes what is a generic Action extension.
Definition: ActionExtension.h:59
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:66
Action extensions: manages the processing logic.
Definition: ExtensionManager.h:65
ExtensionType
describes the CamiTK Extension Type (Action, Component, Application...).
Definition: ExtensionManager.h:64