Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2014 UJF-Grenoble 1, 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 
125  static const QMap<QString, ComponentExtension*> & getComponentExtensions();
126 
131  static const QMap<QString, ComponentExtension*> & getDataDirectoryComponents();
132 
134  static QStringList getFileExtensions();
135 
137  static QStringList getDataDirectoryExtNames();
138 
143  static void registerFileExtension(QString fileExtension);
144 
148  static bool promptRegisterFileExtensions(QStringList fileExtensions);
149 
153  static bool unloadComponentExtension(QString);
155 
156 
159 
161  static void unloadAllActionExtensions();
162 
167  static const QMap<QString, ActionExtension*> & getActionExtensions();
168 
172  static bool unloadActionExtension(QString);
174 
176  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
182  static bool loadComponentExtension(QString file);
183 
188  static bool loadActionExtension(QString);
189 
193  static void autoloadComponentExtensions();
194 
198  static void autoloadActionExtensions();
199 
201 
202 private:
210  static QMap<QString, ComponentExtension*> & getComponentExtensionMap();
211 
219  static QMap<QString, ComponentExtension*> & getDataDirectoryComponentExtensionMap();
220 
228  static QMap<QString, ActionExtension*> & getActionExtensionMap();
229 
231  static QStringList getExtensionFilter();
232 
234  static QStringList getPluginFileNames(QDir);
235 };
236 
237 }
238 
239 
240 #endif //EXTENSIONS_MANAGER_H
Component extensions: manages the data logic.
Definition: ExtensionManager.h:69
MainWindow extensions: manages the application logic.
Definition: ExtensionManager.h:70
Definition: Action.h:40
This class describes what is a generic Component extension.
Definition: ComponentExtension.h:63
Action extensions: manages the processing logic.
Definition: ExtensionManager.h:68
#define CAMITK_API
Definition: CamiTKAPI.h:49
This class is used to manage all plugins loaded by the application.
Definition: ExtensionManager.h:57
ExtensionType
describes the CamiTK Extension Type (Action, Component, Application...).
Definition: ExtensionManager.h:67