Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
CamiTKAPI.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#ifndef CAMITK_API_H
27#define CAMITK_API_H
28
29// -----------------------------------------------------------------------
30//
31// CAMITK_API
32//
33// -----------------------------------------------------------------------
34// The following ifdef block is the standard way of creating macros which make exporting
35// from a DLL simpler. All files within this DLL are compiled with the COMPILE_CAMITK_API
36// flag defined on the command line. this symbol should not be defined on any project
37// that uses this DLL. This way any other project whose source files include this file see
38// CAMITK_API functions as being imported from a DLL, whereas this DLL sees symbols
39// defined with this macro as being exported.
40#if defined(_WIN32) // MSVC and mingw
41#ifndef PYBIND11_EXPORT
42#ifdef COMPILE_CAMITK_API
43#define PYBIND11_EXPORT __declspec(dllexport)
44#else
45#define PYBIND11_EXPORT __declspec(dllimport)
46#endif
47#endif
48#ifdef COMPILE_CAMITK_API
49#define CAMITK_API __declspec(dllexport)
50#else
51#define CAMITK_API __declspec(dllimport)
52#endif
53#else
54// for all other platforms CAMITK_API is defined to be "nothing"
55// but for class that have pybind11 members, the visibility must be modified (use both CAMITK_API and PYBIND11_EXPORT, see PythonHotPlugAction.h)
56// see https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes
57#ifndef PYBIND11_EXPORT
58#ifdef COMPILE_CAMITK_API
59// hide symbols as pybind11 does not want its symbols to be exported
60#define PYBIND11_EXPORT __attribute__((visibility("default")))
61#else
62#define PYBIND11_EXPORT
63#endif
64#endif
65#ifndef CAMITK_API
66#define CAMITK_API
67#endif
68#endif // MSVC and mingw
69
70// -----------------------------------------------------------------------
71// It seems that MSVC does not understand exception specification
72// If I understand it well, when _declspec() is used, there is a default
73// nothrow attribute.
74// I did not find the throw attribute. It seems that msvc is therefore ignoring the
75// specification of the type of the exception.
76// The compiler therefore issues a warning.
77// The following line is to avoid this particular warning.
78// The best would be to ask msvc not only to take the exception into account, but also
79// its type. Anyway, I did not find how to do that anywhere, and I am not sure this is
80// possible...
81#if defined(_WIN32) && !defined(__MINGW32__) // MSVC only
82#pragma warning( disable : 4290 )
83#endif // MSVC only
84
85// -----------------------------------------------------------------------
86// MSVC does not have the C++ Standard rint function (it should be included in any C99 implementation)
87#if defined(_WIN32) && !defined(__MINGW32__) &&(_MSC_VER < 1800)
88extern double rint(double x);
89#endif
90
91// -----------------------------------------------------------------------
92// -- QT stuff
93#include <QList>
94#include <QSet>
95#include <QMap>
96#include <QString>
97
98// -----------------------------------------------------------------------
99// warning when using deprecated methods
100//
101// prefix each deprecated method by the CAMITK_API_DEPRECATED keyword
102// CAMITK_API_DEPRECATED("Please use newMethod(..) instead") oldType oldMethod(...)
103//
104// example:
105// -------
106// @cond
107//
108// TODO CAMITK_API_DEPRECATED. This section list the methods marked as deprecated.
109// They are to be removed in CamiTK xx.yy
110// @deprecated
111//
112// DEPRECATED (CamiTK xx.yy) -> to be removed
113//
114// Please use newMethod(..) instead
115//
116// /// API DOC of the old method
117// /// ...
118// CAMITK_API_DEPRECATED("Please use newMethod(..) instead") oldType oldMethod(...);
119// @endcond
120
121// see https://stackoverflow.com/a/295229
122#if defined(__GNUC__) || defined(__clang__)
123#define CAMITK_API_DEPRECATED(X) __attribute__((deprecated(X)))
124#elif defined(_MSC_VER)
125#define CAMITK_API_DEPRECATED(X) __declspec(deprecated(X))
126#else
127#pragma message("WARNING: You need to implement CAMITK_API_DEPRECATED(X) for this compiler")
128#define CAMITK_API_DEPRECATED(X)
129#endif
130
131// -----------------------------------------------------------------------
132// warning when using deprecated methods
133//
134// prefix each deprecated method by the CAMITK_API_DEPRECATED keyword
135// CAMITK_API_NOT_IMPLEMENTED mymethod(...)
136//
137// This is silent during CamiTK Core compilation
138#if !defined(COMPILE_CAMITK_API)
139#if defined(__GNUC__) || defined(__clang__)
140#define CAMITK_API_UNIMPLEMENTED __attribute__((deprecated("Unimplemented method. Do not hesitate to contribute to CamiTK API!")))
141#elif defined(_MSC_VER)
142#define CAMITK_API_UNIMPLEMENTED __declspec(deprecated("Unimplemented method. Do not hesitate to contribute to CamiTK API!"))
143#endif // elif
144#else
145// inside CamiTK Core compilation
146#define CAMITK_API_UNIMPLEMENTED
147#if !defined(__GNUC__) && !defined(__clang__) && !defined(_MSC_VER)
148#pragma message("WARNING: You need to implement CAMITK_API_UNIMPLEMENTED() for this compiler")
149#endif
150#endif // COMPILE_CAMITK_API
151
152// -----------------------------------------------------------------------
153// -- Definition of some useful CamiTK container types
154namespace camitk {
155// -- Core stuff Classes
156class Component;
157class Action;
158class Viewer;
159
162
164using ActionSet = QSet<Action*>;
165
167using ViewerSet = QSet<Viewer*>;
168
171
174}
175#endif
A component is something that composed something and could also be a part of something.
Definition modeling/libraries/pml/Component.h:48
Definition Action.cpp:40
QSet< Action * > ActionSet
A set of Action.
Definition CamiTKAPI.h:164
QSet< Viewer * > ViewerSet
A set of Viewer.
Definition CamiTKAPI.h:167