Computer Assited Medical Intervention Tool Kit  version 4.1
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-2018 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 namespace camitk {
57 class CAMITK_API ComponentExtension : public QObject {
58 
59 protected:
60 
62  ComponentExtension();
63 
64 public:
65 
67  ~ComponentExtension() override = default;
68 
72  virtual QString getName() const = 0;
73 
75  virtual QString getDescription() const = 0;
76 
78  virtual QStringList getFileExtensions() const = 0;
79 
89  virtual Component* open(const QString&) = 0;
90 
109  virtual bool save(Component* component) const;
110 
112  virtual bool hasDataDirectory() const {
113  return false;
114  }
115 
117  QString getLocation() const {
118  return dynamicLibraryFileName;
119  }
120 
122  void setLocation(const QString loc) {
123  dynamicLibraryFileName = loc;
124  }
125 
127  void initResources();
128 
130 
131 
132 private:
134  QString dynamicLibraryFileName;
135 
137  bool autoload;
138 };
139 
140 
141 
142 }
143 // -------------------- declare the interface for QPluginLoader --------------------
144 Q_DECLARE_INTERFACE(camitk::ComponentExtension, "TIMC-IMAG.ComponentExtension/2.1") //TODO use variable from CMake?
145 
146 
147 #endif //COMPONENT_EXTENSION_H
CAMITK_WARNING
#define CAMITK_WARNING(MSG)
Log for warning verbosity (the most common one) Will appear by default.
Definition: Log.h:261
CamiTKAPI.h
camitk::Application::getSelectedLanguage
static QString getSelectedLanguage()
Returns for the current CamiTK application, the selected language (stored in its ....
Definition: Application.cpp:1232
AbortException.h
CAMITK_INFO
#define CAMITK_INFO(MSG)
Log for info verbosity (the second most verbose one) The msg will appear only if the user asked for I...
Definition: Log.h:256
camitk::ComponentExtension
This class describes what is a generic Component extension. To add a ComponentExtension to CamiTK cor...
Definition: ComponentExtension.h:78
camitk::ComponentExtension::initResources
void initResources()
Load, for the selected langage (asked to the Application), the associated .qm file.
Definition: ComponentExtension.cpp:72
camitk::ComponentExtension::ComponentExtension
ComponentExtension()
protected constructor,
Definition: ComponentExtension.cpp:56
Log.h
Component.h
Component::getName
const std::string getName() const
get the name of the component
Definition: modeling/libraries/pml/Component.h:146
camitk::ComponentExtension::save
virtual bool save(Component *component) const
save a given Component (does not have to be top-level) into one of the currently managed format (chec...
Definition: ComponentExtension.cpp:61
ComponentExtension.h
Component
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:47
camitk::ComponentExtension::autoload
bool autoload
the autoload state
Definition: ComponentExtension.h:180
camitk::ComponentExtension::getLocation
QString getLocation() const
get the file path (location of the .dll/.so/.dylib) of this plugin
Definition: ComponentExtension.h:160
camitk::ComponentExtension::getName
virtual QString getName() const =0
camitk::Component
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:297
Application.h
CAMITK_API
#define CAMITK_API
Definition: CamiTKAPI.h:48
camitk
Definition: Action.cpp:36