Computer Assited Medical Intervention Tool Kit  version 3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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-2013 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 {
53 class CAMITK_API ExtensionManager : public QObject {
54 
55 public:
57  enum {
58  };
67  VIEWER
68  };
69 
71  static void autoload();
72 
85  static void autoload(ExtensionType type);
86 
94  static bool loadExtension(ExtensionType type, QString file);
95 
109  static QString getInstallationString(QString file);
110 
113  static const ComponentExtension * getComponentExtension(QString);
116 
121  static const QMap<QString, ComponentExtension*> & getComponentExtensions();
122 
127  static const QMap<QString, ComponentExtension*> & getDataDirectoryComponents();
128 
130  static QStringList getFileExtensions();
131 
133  static QStringList getDataDirectoryExtNames();
134 
139  static void registerFileExtension(QString fileExtension);
140 
144  static bool promptRegisterFileExtensions(QStringList fileExtensions);
145 
149  static bool unloadComponentExtension(QString);
151 
152 
155 
157  static void unloadAllActionExtensions();
158 
163  static const QMap<QString, ActionExtension*> & getActionExtensions();
164 
168  static bool unloadActionExtension(QString);
170 
172  // TODO CAMITK_OBSOLETE. This section list all the methods marked as obsolete. They are to be removed in CamiTK 4.0
178  static bool loadComponentExtension(QString file);
179 
184  static bool loadActionExtension(QString);
185 
189  static void autoloadComponentExtensions();
190 
194  static void autoloadActionExtensions();
195 
197 
198 private:
206  static QMap<QString, ComponentExtension*> & getComponentExtensionMap();
207 
215  static QMap<QString, ComponentExtension*> & getDataDirectoryComponentExtensionMap();
216 
224  static QMap<QString, ActionExtension*> & getActionExtensionMap();
225 
227  static QStringList getExtensionFilter();
228 
230  static QStringList getPluginFileNames(QDir);
231 };
232 
233 }
234 
235 
236 #endif //EXTENSIONS_MANAGER_H