Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
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-2025 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
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 "ViewerExtension.h"
34#include "CamiTKAPI.h"
35
36// -- QT stuff
37#include <QtPlugin>
38#include <QPluginLoader>
39#include <QStringList>
40#include <QMap>
41#include <QDir>
42
43namespace camitk {
57class CAMITK_API ExtensionManager : public QObject {
58
59public:
70
79
81 static void autoload();
82
95 static void autoload(ExtensionType type);
96
104 static bool loadExtension(ExtensionType type, QString file);
105
115 static bool registerNewComponentExtension(ComponentExtension* ce, QString filename = QString());
116
133 static QString getInstallationString(QString file, const QString& globalInstallDir, const QString& userInstallDir, const QString& currentWorkingDir);
134
153 static InstallationRepository getInstallationRepository(const QString& extensionName);
154
158
161 static ComponentExtension* getComponentExtension(QString);
162
173 static const QList<ComponentExtension*> getComponentExtensionsList();
174
178 static ComponentExtension* getDataDirectoryComponentExtension(QString);
179
190 static const QList<ComponentExtension*> getDataDirectoryComponentsList();
191
193 static QStringList getFileExtensions();
194
196 static QStringList getDataDirectoryExtNames();
197
202 static void registerFileExtension(QString fileExtension);
203
207 static bool unloadComponentExtension(QString);
209
210
213
215 static void unloadAllActionExtensions();
216
227 static const QList<ActionExtension*> getActionExtensionsList();
228
237 static ActionExtension* getActionExtension(QString);
238
242 static bool unloadActionExtension(QString);
244
247
249 static void unloadAllViewerExtensions();
250
261 static const QList<ViewerExtension*> getViewerExtensionsList();
262
271 static ViewerExtension* getViewerExtension(QString);
272
276 static bool unloadViewerExtension(QString);
278
279private:
287 static QMap<QString, ComponentExtension*>& getComponentExtensionMap();
288
296 static QMap<QString, ComponentExtension*>& getDataDirectoryComponentExtensionMap();
297
305 static QMap<QString, ActionExtension*>& getActionExtensionMap();
306
314 static QMap<QString, ViewerExtension*>& getViewerExtensionMap();
315
317 static QStringList getPluginFileNames(QDir);
318
327 static void initPrivateLibDirs();
328
334 static void addLibraryPath(QDir potentialPath, QString potentialLibDir);
335
338
348 static bool componentExtensionLessThan(const ComponentExtension* left, const ComponentExtension* right);
349
365 static bool actionExtensionLessThan(ActionExtension* left, ActionExtension* right);
366
372 static bool viewerExtensionLessThan(ViewerExtension* left, ViewerExtension* right);
374};
375
376}
377
378
379#endif //EXTENSIONS_MANAGER_H
#define CAMITK_API
Definition CamiTKAPI.h:66
Definition PersistenceManager.h:30
This class describes what is a generic Action extension.
Definition ActionExtension.h:57
This class describes what is a generic Component extension.
Definition ComponentExtension.h:59
This class is used to manage all plugins loaded by the application.
Definition ExtensionManager.h:57
InstallationRepository
corresponds to where the extension is installed
Definition ExtensionManager.h:72
@ GLOBAL
the extension is installed on the system (global install)
Definition ExtensionManager.h:73
@ WORKING_DIRECTORY
the extension is installed in the current working directory (development stage)
Definition ExtensionManager.h:75
@ LOCAL
the extension is installed in the user defined installation directory (local install)
Definition ExtensionManager.h:74
@ USER
the extension is registered in the user configuration file (could be anywhere)
Definition ExtensionManager.h:76
ExtensionType
describes the CamiTK Extension Type (Action, Component, Application...).
Definition ExtensionManager.h:64
@ ACTION
Action extensions: manages the processing logic.
Definition ExtensionManager.h:65
@ COMPONENT
Component extensions: manages the data logic.
Definition ExtensionManager.h:66
@ APPLICATION
MainWindow extensions: manages the application logic.
Definition ExtensionManager.h:67
This class describes what is a generic Action extension.
Definition ViewerExtension.h:85
Definition Action.cpp:40