Computer Assisted Medical Intervention Tool Kit  version 5.2
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-2024 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 COMPONENT_EXTENSION_H
28 #define COMPONENT_EXTENSION_H
29 
30 // -- Qt stuff
31 #include <QObject>
32 
33 // -- CamiTK Core stuff
34 #include "CamiTKAPI.h"
35 #include "AbortException.h"
36 
37 namespace camitk {
38 class Component;
60 class CAMITK_API ComponentExtension : public QObject {
61 
62 protected:
63 
66 
67 public:
68 
70  ~ComponentExtension() override = default;
71 
75  virtual QString getName() const = 0;
76 
78  virtual QString getDescription() const = 0;
79 
81  virtual QStringList getFileExtensions() const = 0;
82 
92  virtual Component* open(const QString&) = 0;
93 
110  virtual bool save(Component* component) const;
111 
113  virtual bool hasDataDirectory() const {
114  return false;
115  }
116 
118  QString getLocation() const {
119  return dynamicLibraryFileName;
120  }
121 
123  void setLocation(const QString loc) {
124  dynamicLibraryFileName = loc;
125  }
126 
128  void initResources();
129 
131 
132 
133 private:
135  QString dynamicLibraryFileName;
136 
138  bool autoload;
139 };
140 
141 
142 
143 }
144 // -------------------- declare the interface for QPluginLoader --------------------
145 Q_DECLARE_INTERFACE(camitk::ComponentExtension, "TIMC-IMAG.ComponentExtension/2.1") //TODO use variable from CMake?
146 
147 
148 #endif //COMPONENT_EXTENSION_H
#define CAMITK_API
Definition: CamiTKAPI.h:49
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
This class describes what is a generic Component extension.
Definition: ComponentExtension.h:60
QString getLocation() const
get the file path (location of the .dll/.so/.dylib) of this plugin
Definition: ComponentExtension.h:118
virtual QString getName() const =0
virtual bool hasDataDirectory() const
return true if this component manages directory instead of individual files (e.g. Dicom series are st...
Definition: ComponentExtension.h:113
~ComponentExtension() override=default
protected destructor,
virtual QString getDescription() const =0
get the plugin description
void setLocation(const QString loc)
set the file path (once loaded as a dynamic library)
Definition: ComponentExtension.h:123
virtual Component * open(const QString &)=0
get a new instance from data stored in a file (this is the most important method to redefine in your ...
virtual QStringList getFileExtensions() const =0
get the list of managed extensions (each file with an extension in the list can be loaded by this Com...
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:303
Definition: Action.cpp:36