Aldebaran documentation
|
C++ Libraries
|
index
libqi-api
release-2.5.3-2016-11-18
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
qi
macro.hpp
Go to the documentation of this file.
1
#pragma once
2
/*
3
* Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the COPYING file.
6
*/
7
24
#ifndef _QI_MACRO_HPP_
25
# define _QI_MACRO_HPP_
26
27
# include <
qi/preproc.hpp
>
28
34
#if defined(__GNUC__) && !defined(QI_NO_API_DEPRECATED)
35
# define QI_API_DEPRECATED __attribute__((deprecated))
36
#elif defined(_MSC_VER) && !defined(QI_NO_API_DEPRECATED)
37
# define QI_API_DEPRECATED __declspec(deprecated)
38
#else
39
# define QI_API_DEPRECATED
40
#endif
41
48
#if defined(__GNUC__) && !defined(QI_NO_API_DEPRECATED)
49
# define QI_API_DEPRECATED_MSG(msg__) __attribute__((deprecated(#msg__)))
50
#elif defined(_MSC_VER) && !defined(QI_NO_API_DEPRECATED)
51
# define QI_API_DEPRECATED_MSG(msg__) __declspec(deprecated(#msg__))
52
#else
53
# define QI_API_DEPRECATED_MSG(msg__)
54
#endif
55
60
#if defined(__GNUC__)
61
# define QI_NORETURN __attribute__((noreturn))
62
#elif defined(_MSC_VER)
63
# define QI_NORETURN __declspec(noreturn)
65
#else
66
# define QI_NORETURN
67
#endif
68
73
#if defined(__GNUC__) && !defined(__clang__)
74
# define QI_HAS_VARIABLE_LENGTH_ARRAY 1
75
#else
76
# define QI_HAS_VARIABLE_LENGTH_ARRAY 0
77
#endif
78
79
// For shared library
80
81
100
#define QI_LIB_API(libname) _QI_LIB_API(BOOST_PP_CAT(libname, _EXPORTS), BOOST_PP_CAT(libname, _STATIC_BUILD))
101
102
#define _QI_LIB_API(IS_BUILDING_LIB, IS_LIB_STATIC_BUILD) \
103
QI_LIB_API_NORMALIZED(_QI_IS_ONE_OR_EMPTY(BOOST_PP_CAT(_ , IS_BUILDING_LIB)), _QI_IS_ONE_OR_EMPTY(BOOST_PP_CAT(_, IS_LIB_STATIC_BUILD)))
104
119
#if defined _WIN32 || defined __CYGWIN__
120
# define QI_EXPORT_API __declspec(dllexport)
121
# define QI_IMPORT_API __declspec(dllimport)
122
# define QI_LIB_API_NORMALIZED(exporting, isstatic) BOOST_PP_CAT(BOOST_PP_CAT(_QI_LIB_API_NORMALIZED_, exporting), isstatic)
123
# define _QI_LIB_API_NORMALIZED_00 QI_IMPORT_API
124
# define _QI_LIB_API_NORMALIZED_10 QI_EXPORT_API
125
# define _QI_LIB_API_NORMALIZED_11
126
# define _QI_LIB_API_NORMALIZED_01
127
#elif __GNUC__ >= 4
128
# define QI_EXPORT_API __attribute__ ((visibility("default")))
129
# define QI_IMPORT_API QI_EXPORT_API
130
# define QI_LIB_API_NORMALIZED(a, b) QI_EXPORT_API
131
#else
132
# define QI_IMPORT_API
133
# define QI_EXPORT_API
134
# define QI_LIB_API_NORMALIZED(a, b)
135
#endif
136
137
139
// Macros adapted from opencv2.2
140
#if defined(_MSC_VER)
141
#define QI_DO_PRAGMA(x) __pragma(x)
142
#define __ALSTR2__(x) #x
143
#define __ALSTR1__(x) __ALSTR2__(x)
144
#define _ALMSVCLOC_ __FILE__ "("__ALSTR1__(__LINE__)") : "
145
#define QI_MSG_PRAGMA(_msg) QI_DO_PRAGMA(message (_ALMSVCLOC_ _msg))
146
#elif defined(__GNUC__)
147
#define QI_DO_PRAGMA(x) _Pragma (#x)
148
#define QI_MSG_PRAGMA(_msg) QI_DO_PRAGMA(message (_msg))
149
#else
150
#define QI_DO_PRAGMA(x)
151
#define QI_MSG_PRAGMA(_msg)
152
#endif
153
155
161
#if defined(QI_NO_COMPILER_WARNING)
162
# define QI_COMPILER_WARNING(x)
163
#else
164
# define QI_COMPILER_WARNING(x) QI_MSG_PRAGMA("Warning: " #x)
165
#endif
166
172
#if !defined(WITH_DEPRECATED) || defined(QI_NO_DEPRECATED_HEADER)
173
# define QI_DEPRECATED_HEADER(x)
174
#else
175
# define QI_DEPRECATED_HEADER(x) QI_MSG_PRAGMA("\
176
This file includes at least one deprecated or antiquated ALDEBARAN header \
177
which may be removed without further notice in the next version. \
178
Please consult the changelog for details. " #x)
179
#endif
180
181
182
#ifdef __cplusplus
183
namespace
qi {
184
template
<
typename
T>
185
struct
IsClonable;
186
};
187
#endif
188
201
#define QI_DEPRECATE_MACRO(name) \
202
QI_COMPILER_WARNING(name macro is deprecated.)
203
235
#define QI_DISALLOW_COPY_AND_ASSIGN(type) \
236
QI_DEPRECATE_MACRO(QI_DISALLOW_COPY_AND_ASSIGN) \
237
type(type const &); \
238
void operator=(type const &); \
239
using _qi_not_clonable = int; \
240
template<typename U> friend struct ::qi::IsClonable
241
242
247
#if defined(__GNUC__)
248
# define QI_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
249
#else
250
# define QI_WARN_UNUSED_RESULT
251
#endif
252
257
#if defined(__GNUC__)
258
# define QI_ATTR_UNUSED __attribute__((unused))
259
#else
260
# define QI_ATTR_UNUSED
261
#endif
262
277
#define QI_UNUSED(x)
278
284
#define _QI_UNIQ_DEF_LEVEL2(A, B) A ## __uniq__ ## B
285
#define _QI_UNIQ_DEF_LEVEL1(A, B) _QI_UNIQ_DEF_LEVEL2(A, B)
286
#define QI_UNIQ_DEF(A) _QI_UNIQ_DEF_LEVEL1(A, __LINE__)
287
288
#if (!defined(__GNUC__) || defined(__clang__) || \
289
(__GNUC__ >= 4 && __GNUC_MINOR__ >= 7)) && __cplusplus >= 201103L
290
295
# define QI_CXX11_ENABLED 1
296
#endif
297
302
#ifdef QI_CXX11_ENABLED
303
# define QI_NOEXCEPT(cond) noexcept(cond)
304
#else
305
# define QI_NOEXCEPT(cond)
306
#endif
307
308
#endif // _QI_MACRO_HPP_
preproc.hpp
Copyright Aldebaran Robotics