[arrayfire] 212/248: Add version guards for v3.2

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:54:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.

commit 15411ebc1a8f9481713f270ec8b15bec8589f4e0
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Fri Nov 6 12:15:01 2015 -0500

    Add version guards for v3.2
---
 include/af/backend.h  | 12 ++++++++++++
 include/af/defines.h  | 31 +++++++++++++++++++++++++++++++
 include/af/graphics.h | 13 ++++++++++++-
 include/af/index.h    | 10 ++++++++++
 include/af/traits.hpp |  4 ++++
 5 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/include/af/backend.h b/include/af/backend.h
index dcdb195..2d2b17c 100644
--- a/include/af/backend.h
+++ b/include/af/backend.h
@@ -14,6 +14,7 @@
 extern "C" {
 #endif
 
+#if AF_API_VERSION >= 32
 /**
    \param[in] bknd takes one of the values of enum \ref af_backend
    \returns \ref af_err error code
@@ -21,7 +22,9 @@ extern "C" {
    \ingroup unified_func_setbackend
  */
 AFAPI af_err af_set_backend(const af_backend bknd);
+#endif
 
+#if AF_API_VERSION >= 32
 /**
    \param[out] num_backends Number of available backends
    \returns \ref af_err error code
@@ -29,7 +32,9 @@ AFAPI af_err af_set_backend(const af_backend bknd);
    \ingroup unified_func_getbackendcount
  */
 AFAPI af_err af_get_backend_count(unsigned* num_backends);
+#endif
 
+#if AF_API_VERSION >= 32
 /**
    \param[out] backends is the OR sum of the backends available.
    \returns \ref af_err error code
@@ -37,6 +42,7 @@ AFAPI af_err af_get_backend_count(unsigned* num_backends);
    \ingroup unified_func_getavailbackends
  */
 AFAPI af_err af_get_available_backends(int* backends);
+#endif
 
 #ifdef __cplusplus
 }
@@ -46,26 +52,32 @@ AFAPI af_err af_get_available_backends(int* backends);
 namespace af
 {
 
+#if AF_API_VERSION >= 32
 /**
    \param[in] bknd takes one of the values of enum \ref af_backend
 
    \ingroup unified_func_setbackend
  */
 AFAPI void setBackend(const Backend bknd);
+#endif
 
+#if AF_API_VERSION >= 32
 /**
    \returns Number of available backends
 
    \ingroup unified_func_getbackendcount
  */
 AFAPI unsigned getBackendCount();
+#endif
 
+#if AF_API_VERSION >= 32
 /**
    \returns OR sum of the backends available
 
    \ingroup unified_func_getavailbackends
  */
 AFAPI int getAvailableBackends();
+#endif
 
 }
 #endif
diff --git a/include/af/defines.h b/include/af/defines.h
index 26df7e6..09f6acf 100644
--- a/include/af/defines.h
+++ b/include/af/defines.h
@@ -132,10 +132,12 @@ typedef enum {
     ///
     AF_ERR_NOT_CONFIGURED = 302,
 
+#if AF_API_VERSION >= 32
     ///
     /// This build of ArrayFire is not compiled with "nonfree" algorithms
     ///
     AF_ERR_NONFREE        = 303,
+#endif
 
     // 400-499 Errors for missing hardware features
 
@@ -151,8 +153,21 @@ typedef enum {
     AF_ERR_NO_GFX         = 402,
 
     // 500-599 Errors specific to heterogenous API
+
+#if AF_API_VERSION >= 32
+    ///
+    /// There was an error when loading the libraries
+    ///
     AF_ERR_LOAD_LIB       = 501,
+#endif
+
+#if AF_API_VERSION >= 32
+    ///
+    /// There was an error when loading the symbols
+    ///
     AF_ERR_LOAD_SYM       = 502,
+#endif
+
 
     // 900-999 Errors from upstream libraries and runtimes
 
@@ -181,6 +196,8 @@ typedef enum {
     u64,    ///< 64-bit unsigned integral values
 #if AF_API_VERSION >= 32
     s16,    ///< 16-bit signed integral values
+#endif
+#if AF_API_VERSION >= 32
     u16,    ///< 16-bit unsigned integral values
 #endif
 } af_dtype;
@@ -258,17 +275,21 @@ typedef enum {
     AF_SHD        ///< Match based on Sum of Hamming Distances (SHD)
 } af_match_type;
 
+#if AF_API_VERSION >= 31
 typedef enum {
     AF_YCC_601 = 601,  ///< ITU-R BT.601 (formerly CCIR 601) standard
     AF_YCC_709 = 709,  ///< ITU-R BT.709 standard
     AF_YCC_2020 = 2020  ///< ITU-R BT.2020 standard
 } af_ycc_std;
+#endif
 
 typedef enum {
     AF_GRAY = 0, ///< Grayscale
     AF_RGB,      ///< 3-channel RGB
     AF_HSV,      ///< 3-channel HSV
+#if AF_API_VERSION >= 31
     AF_YCbCr     ///< 3-channel YCbCr
+#endif
 } af_cspace_t;
 
 typedef enum {
@@ -309,6 +330,7 @@ typedef enum {
     AF_COLORMAP_BLUE    = 6     ///< Blue hue map
 } af_colormap;
 
+#if AF_API_VERSION >= 31
 typedef enum {
     AF_FIF_BMP          = 0,    ///< FreeImage Enum for Bitmap File
     AF_FIF_ICO          = 1,    ///< FreeImage Enum for Windows Icon File
@@ -324,7 +346,9 @@ typedef enum {
     AF_FIF_JP2          = 31,   ///< FreeImage Enum for JPEG-2000 File
     AF_FIF_RAW          = 34    ///< FreeImage Enum for RAW Camera Image File
 } af_image_format;
+#endif
 
+#if AF_API_VERSION >= 32
 // These enums should be 2^x
 typedef enum {
     AF_BACKEND_DEFAULT = 0,  ///< Default backend order: OpenCL -> CUDA -> CPU
@@ -332,6 +356,7 @@ typedef enum {
     AF_BACKEND_CUDA    = 2,  ///< CUDA Compute Backend
     AF_BACKEND_OPENCL  = 4,  ///< OpenCL Compute Backend
 } af_backend;
+#endif
 
 // Below enum is purely added for example purposes
 // it doesn't and shoudn't be used anywhere in the
@@ -357,9 +382,15 @@ namespace af
     typedef af_mat_prop matProp;
     typedef af_colormap ColorMap;
     typedef af_norm_type normType;
+#if AF_API_VERSION >= 31
     typedef af_ycc_std YCCStd;
+#endif
+#if AF_API_VERSION >= 31
     typedef af_image_format imageFormat;
+#endif
+#if AF_API_VERSION >= 32
     typedef af_backend Backend;
+#endif
 }
 
 #endif
diff --git a/include/af/graphics.h b/include/af/graphics.h
index 6c7061f..7f0fee0 100644
--- a/include/af/graphics.h
+++ b/include/af/graphics.h
@@ -130,6 +130,7 @@ class AFAPI Window {
          */
         void image(const array& in, const char* title=NULL);
 
+#if AF_API_VERSION >= 32
         /**
            Renders the input array as an 3d line plot to the window
 
@@ -139,6 +140,8 @@ class AFAPI Window {
            \note \p in should be 1d array of size 3n or 2d array with (3 x n) or (n x 3) channels.
          */
         void plot3(const array& in, const char* title=NULL);
+#endif
+
         /**
            Renders the input arrays as a 2D plot to the window
 
@@ -163,6 +166,7 @@ class AFAPI Window {
          */
         void hist(const array& X, const double minval, const double maxval, const char* const title=NULL);
 
+#if AF_API_VERSION >= 32
         /**
            Renders the input arrays as a 3D surface plot to the window
 
@@ -172,7 +176,9 @@ class AFAPI Window {
            \note \p S should be a 2D array
          */
         void surface(const array& S, const char* const title);
+#endif
 
+#if AF_API_VERSION >= 32
         /**
            Renders the input arrays as a 3D surface plot to the window
 
@@ -183,7 +189,8 @@ class AFAPI Window {
 
            \note \p X and \p Y should be vectors or 2D arrays \p S should be s 2D array
          */
-	void surface(const array& xVals, const array& yVals, const array& S, const char* const title);
+        void surface(const array& xVals, const array& yVals, const array& S, const char* const title);
+#endif
 
         /**
            Setup grid layout for multiview mode in a window
@@ -324,6 +331,7 @@ AFAPI af_err af_draw_image(const af_window wind, const af_array in, const af_cel
 */
 AFAPI af_err af_draw_plot(const af_window wind, const af_array X, const af_array Y, const af_cell* const props);
 
+#if AF_API_VERSION >= 32
 /**
    C Interface wrapper for drawing an array as a plot
 
@@ -340,6 +348,7 @@ AFAPI af_err af_draw_plot(const af_window wind, const af_array X, const af_array
    \ingroup gfx_func_draw
 */
 AFAPI af_err af_draw_plot3(const af_window wind, const af_array P, const af_cell* const props);
+#endif
 
 /**
    C Interface wrapper for drawing an array as a histogram
@@ -360,6 +369,7 @@ AFAPI af_err af_draw_plot3(const af_window wind, const af_array P, const af_cell
 */
 AFAPI af_err af_draw_hist(const af_window wind, const af_array X, const double minval, const double maxval, const af_cell* const props);
 
+#if AF_API_VERSION >= 32
 /**
    C Interface wrapper for drawing arrayis as a surface
 
@@ -379,6 +389,7 @@ AFAPI af_err af_draw_hist(const af_window wind, const af_array X, const double m
 */
 
 af_err af_draw_surface(const af_window wind, const af_array xVals, const af_array yVals, const af_array S, const af_cell* const props);
+#endif
 
 /**
    C Interface wrapper for grid setup in a window
diff --git a/include/af/index.h b/include/af/index.h
index 98f0e8b..79bf122 100644
--- a/include/af/index.h
+++ b/include/af/index.h
@@ -289,6 +289,7 @@ extern "C" {
                                 const dim_t ndims, const af_index_t* indices,
                                 const af_array rhs);
 
+#if AF_API_VERSION >= 32
     ///
     /// \brief Create an quadruple of af_index_t array
     ///
@@ -298,7 +299,9 @@ extern "C" {
     /// \ingroup index_func_util
     ///
     AFAPI af_err af_create_indexers(af_index_t** indexers);
+#endif
 
+#if AF_API_VERSION >= 32
     ///
     /// \brief set \p dim to given indexer af_array \p idx
     ///
@@ -310,7 +313,9 @@ extern "C" {
     /// \ingroup index_func_util
     ///
     AFAPI af_err af_set_array_indexer(af_index_t* indexer, const af_array idx, const dim_t dim);
+#endif
 
+#if AF_API_VERSION >= 32
     ///
     /// \brief set \p dim to given indexer af_array \p idx
     ///
@@ -323,7 +328,9 @@ extern "C" {
     ///
     AFAPI af_err af_set_seq_indexer(af_index_t* indexer, const af_seq* idx,
                                   const dim_t dim, const bool is_batch);
+#endif
 
+#if AF_API_VERSION >= 32
     ///
     /// \brief set \p dim to given indexer af_array \p idx
     ///
@@ -340,7 +347,9 @@ extern "C" {
     AFAPI af_err af_set_seq_param_indexer(af_index_t* indexer,
                                         const double begin, const double end, const double step,
                                         const dim_t dim, const bool is_batch);
+#endif
 
+#if AF_API_VERSION >= 32
     ///
     /// \brief Release's the memory resource used by the quadruple af_index_t array
     ///
@@ -350,6 +359,7 @@ extern "C" {
     /// \ingroup index_func_util
     ///
     AFAPI af_err af_release_indexers(af_index_t* indexers);
+#endif
 
 #ifdef __cplusplus
 }
diff --git a/include/af/traits.hpp b/include/af/traits.hpp
index 5e2e3da..29a1a58 100644
--- a/include/af/traits.hpp
+++ b/include/af/traits.hpp
@@ -139,6 +139,7 @@ struct dtype_traits<unsigned long long> {
     static const char* getName() { return "ulong"; }
 };
 
+#if AF_API_VERSION >= 32
 template<>
 struct dtype_traits<short> {
     enum {
@@ -148,7 +149,9 @@ struct dtype_traits<short> {
     typedef short base_type;
     static const char* getName() { return "short"; }
 };
+#endif
 
+#if AF_API_VERSION >= 32
 template<>
 struct dtype_traits<unsigned short> {
     enum {
@@ -158,6 +161,7 @@ struct dtype_traits<unsigned short> {
     typedef unsigned short base_type;
     static const char* getName() { return "ushort"; }
 };
+#endif
 
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list