Computer Assited Medical Intervention Tool Kit  version 4.0
ComponentExtension.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 COMPONENT_EXTENSION_H
28 #define COMPONENT_EXTENSION_H
29 
30 // -- CamiTK Core stuff
31 #include "CamiTKAPI.h"
32 #include "AbortException.h"
33 #include "Component.h"
34 
35 // -- QT stuff
36 #include <QtPlugin>
37 #include <QPluginLoader>
38 #include <QStringList>
39 #include <QMap>
40 
41 namespace camitk {
63 class CAMITK_API ComponentExtension : public QObject {
64 
65 protected:
66 
69 
70 public:
71 
73  virtual ~ComponentExtension();
74 
78  virtual QString getName() const = 0;
79 
81  virtual QString getDescription() const = 0;
82 
84  virtual QStringList getFileExtensions() const = 0;
85 
93  virtual Component * open(const QString &) throw (AbortException) = 0;
94 
113  virtual bool save(Component * component) const;
114 
116  virtual bool hasDataDirectory() const {
117  return false;
118  }
119 
121  QString getLocation() const {
122  return dynamicLibraryFileName;
123  }
124 
126  void setLocation(const QString loc) {
127  dynamicLibraryFileName = loc;
128  }
129 
131  void initResources();
132 
134 
135 
136 private:
139 
141  bool autoload;
142 };
143 
144 
145 
146 }
147 // -------------------- declare the interface for QPluginLoader --------------------
148 Q_DECLARE_INTERFACE(camitk::ComponentExtension, "TIMC-IMAG.ComponentExtension/2.1") //TODO use variable from CMake?
149 
150 
151 #endif //COMPONENT_EXTENSION_H
void setLocation(const QString loc)
set the file path (once loaded as a dynamic library)
Definition: ComponentExtension.h:126
bool autoload
the autoload state
Definition: ComponentExtension.h:141
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:43
Definition: Action.cpp:40
This class describes what is a generic Component extension.
Definition: ComponentExtension.h:63
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:299
#define CAMITK_API
Definition: CamiTKAPI.h:49
QString dynamicLibraryFileName
the shared lib (.so, .dll or .dylib) used to instanciate the ComponentExtension subclass instance ...
Definition: ComponentExtension.h:138
QString getLocation() const
get the file path (location of the .dll/.so/.dylib) of this plugin
Definition: ComponentExtension.h:121
virtual bool hasDataDirectory() const
return true if this component manages directory instead of individual files (e.g. Dicom series are st...
Definition: ComponentExtension.h:116