libqi  1.12
qi/macro.hpp
Go to the documentation of this file.
00001 
00012 #pragma once
00013 #ifndef _LIBQI_QI_API_HPP_
00014 #define _LIBQI_QI_API_HPP_
00015 
00016 // Deprecated
00017 #if defined(__GNUC__) && defined(WITH_DEPRECATED) && !defined(QI_NO_API_DEPRECATED)
00018 #  define QI_API_DEPRECATED __attribute__((deprecated))
00019 #elif defined(_MSC_VER) && defined(WITH_DEPRECATED) && !defined(QI_NO_API_DEPRECATED)
00020 #  define QI_API_DEPRECATED __declspec(deprecated)
00021 #else
00022 #  define QI_API_DEPRECATED
00023 #endif
00024 
00025 // For shared library
00026 #if defined _WIN32 || defined __CYGWIN__
00027 #  define QI_EXPORT_API __declspec(dllexport)
00028 #  if defined _WINDLL
00029 #    define QI_IMPORT_API __declspec(dllimport)
00030 #  else
00031 #    define QI_IMPORT_API
00032 #  endif
00033 #elif __GNUC__ >= 4
00034 #  define QI_EXPORT_API __attribute__ ((visibility("default")))
00035 #  define QI_IMPORT_API __attribute__ ((visibility("default")))
00036 #else
00037 #  define QI_EXPORT_API
00038 #  define QI_IMPORT_API
00039 #endif
00040 
00041 
00043 // Macros adapted from opencv2.2
00044 #if defined(_MSC_VER)
00045   #define QI_DO_PRAGMA(x) __pragma(x)
00046   #define __ALSTR2__(x) #x
00047   #define __ALSTR1__(x) __ALSTR2__(x)
00048   #define _ALMSVCLOC_ __FILE__ "("__ALSTR1__(__LINE__)") : "
00049   #define QI_MSG_PRAGMA(_msg) QI_DO_PRAGMA(message (_ALMSVCLOC_ _msg))
00050 #elif defined(__GNUC__)
00051   #define QI_DO_PRAGMA(x) _Pragma (#x)
00052   #define QI_MSG_PRAGMA(_msg) QI_DO_PRAGMA(message (_msg))
00053 #else
00054   #define QI_DO_PRAGMA(x)
00055   #define QI_MSG_PRAGMA(_msg)
00056 #endif
00057 
00058 
00059 
00060 // Use this macro to generate compiler warnings.
00061 #if !defined(WITH_DEPRECATED) || defined(QI_NO_COMPILER_WARNING)
00062 # define QI_COMPILER_WARNING(x)
00063 #else
00064 # define QI_COMPILER_WARNING(x) QI_MSG_PRAGMA("Warning: " #x)
00065 #endif
00066 
00067 // Deprecate a header, add a message to explain what user should do
00068 #if !defined(WITH_DEPRECATED) || defined(QI_NO_DEPRECATED_HEADER)
00069 # define QI_DEPRECATED_HEADER(x)
00070 #else
00071 # define QI_DEPRECATED_HEADER(x) QI_MSG_PRAGMA("\
00072 This file includes at least one deprecated or antiquated ALDEBARAN header \
00073 which may be removed without further notice in the next version. \
00074 Please consult the changelog for details. " #x)
00075 #endif
00076 
00077 
00078 // A macro to disallow copy constructor and operator=
00079 #define QI_DISALLOW_COPY_AND_ASSIGN(type)       \
00080   type(type const &);                           \
00081   void operator=(type const &)
00082 
00083 
00084 #endif  // _LIBQI_QI_API_HPP_
00085 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines