Point Cloud Library (PCL)
1.3.1
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2010, Willow Garage, Inc. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of Willow Garage, Inc. nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 */ 00034 00035 #ifndef PCL_MACROS_H_ 00036 #define PCL_MACROS_H_ 00037 00038 #if defined __INTEL_COMPILER 00039 #pragma warning disable 2196 2536 279 00040 #endif 00041 00042 #if defined _MSC_VER 00043 #pragma warning (disable : 4521) 00044 #endif 00045 00046 #include <iostream> 00047 #include <stdarg.h> 00048 #include <stdio.h> 00049 00050 #ifndef DEG2RAD 00051 #define DEG2RAD(x) ((x)*0.017453293) 00052 #endif 00053 00054 #ifndef RAD2DEG 00055 #define RAD2DEG(x) ((x)*57.29578) 00056 #endif 00057 00058 #ifndef PVAR 00059 #define PVAR(s) \ 00060 #s << " = " << (s) << std::flush 00061 #endif 00062 #ifndef PVARN 00063 #define PVARN(s) \ 00064 #s << " = " << (s) << "\n" 00065 #endif 00066 #ifndef PVARC 00067 #define PVARC(s) \ 00068 #s << " = " << (s) << ", " << std::flush 00069 #endif 00070 #ifndef PVARS 00071 #define PVARS(s) \ 00072 #s << " = " << (s) << " " << std::flush 00073 #endif 00074 #ifndef PVARA 00075 #define PVARA(s) \ 00076 #s << " = " << RAD2DEG(s) << "deg" << std::flush 00077 #endif 00078 #ifndef PVARAN 00079 #define PVARAN(s) \ 00080 #s << " = " << RAD2DEG(s) << "deg\n" 00081 #endif 00082 #ifndef PVARAC 00083 #define PVARAC(s) \ 00084 #s << " = " << RAD2DEG(s) << "deg, " << std::flush 00085 #endif 00086 #ifndef PVARAS 00087 #define PVARAS(s) \ 00088 #s << " = " << RAD2DEG(s) << "deg " << std::flush 00089 #endif 00090 00091 #define FIXED(s) \ 00092 std::fixed << s << std::resetiosflags(std::ios_base::fixed) 00093 00094 #ifndef ERASE_STRUCT 00095 #define ERASE_STRUCT(var) memset(&var, 0, sizeof(var)) 00096 #endif 00097 00098 #ifndef ERASE_ARRAY 00099 #define ERASE_ARRAY(var, size) memset(var, 0, size*sizeof(*var)) 00100 #endif 00101 00102 #ifndef SET_ARRAY 00103 #define SET_ARRAY(var, value, size) {for (int i=0; i<(int)size; ++i) var[i]=value;} 00104 #endif 00105 00106 /* //This is copy/paste from http://gcc.gnu.org/wiki/Visibility */ 00107 /* #if defined _WIN32 || defined __CYGWIN__ */ 00108 /* #ifdef BUILDING_DLL */ 00109 /* #ifdef __GNUC__ */ 00110 /* #define DLL_PUBLIC __attribute__((dllexport)) */ 00111 /* #else */ 00112 /* #define DLL_PUBLIC __declspec(dllexport) // Note: actually gcc seems to also supports this syntax. */ 00113 /* #endif */ 00114 /* #else */ 00115 /* #ifdef __GNUC__ */ 00116 /* #define DLL_PUBLIC __attribute__((dllimport)) */ 00117 /* #else */ 00118 /* #define DLL_PUBLIC __declspec(dllimport) // Note: actually gcc seems to also supports this syntax. */ 00119 /* #endif */ 00120 /* #endif */ 00121 /* #define DLL_LOCAL */ 00122 /* #else */ 00123 /* #if __GNUC__ >= 4 */ 00124 /* #define DLL_PUBLIC __attribute__ ((visibility("default"))) */ 00125 /* #define DLL_LOCAL __attribute__ ((visibility("hidden"))) */ 00126 /* #else */ 00127 /* #define DLL_PUBLIC */ 00128 /* #define DLL_LOCAL */ 00129 /* #endif */ 00130 /* #endif */ 00131 00132 #ifndef PCL_EXTERN_C 00133 #ifdef __cplusplus 00134 #define PCL_EXTERN_C extern "C" 00135 #else 00136 #define PCL_EXTERN_C 00137 #endif 00138 #endif 00139 00140 #if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__ 00141 #ifdef PCLAPI_EXPORTS 00142 #define PCL_EXPORTS __declspec(dllexport) 00143 #else 00144 #define PCL_EXPORTS 00145 #endif 00146 #else 00147 #define PCL_EXPORTS 00148 #endif 00149 00150 #if defined WIN32 || defined _WIN32 00151 #define PCL_CDECL __cdecl 00152 #define PCL_STDCALL __stdcall 00153 #else 00154 #define PCL_CDECL 00155 #define PCL_STDCALL 00156 #endif 00157 00158 #ifndef PCLAPI 00159 #define PCLAPI(rettype) PCL_EXTERN_C PCL_EXPORTS rettype PCL_CDECL 00160 #endif 00161 00162 // Macro to deprecate old functions 00163 // 00164 // Usage: 00165 // don't use me any more 00166 // PCL_DEPRECATED(void OldFunc(int a, float b), "Use newFunc instead, this functions will be gone in the next major release"); 00167 // use me instead 00168 // void NewFunc(int a, double b); 00169 00170 // gcc supports this starting from 4.5 : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43666 00171 #ifdef __GNUC__ 00172 #define GCC_VERSION (__GNUC__ * 10000 \ 00173 + __GNUC_MINOR__ * 100 \ 00174 + __GNUC_PATCHLEVEL__) 00175 #if GCC_VERSION < 40500 00176 #define PCL_DEPRECATED(func, message) func __attribute__ ((deprecated)) 00177 #else 00178 #define PCL_DEPRECATED(func, message) func __attribute__ ((deprecated(message))) 00179 #endif 00180 00181 #elif defined(_MSC_VER) 00182 #define PCL_DEPRECATED(func, message) __declspec(deprecated(message)) func 00183 #else 00184 #pragma message("WARNING: You need to implement PCL_DEPRECATED for this compiler") 00185 #define PCL_DEPRECATED(func) func 00186 #endif 00187 00188 #endif //#ifndef PCL_MACROS_H_