[arrayfire] 74/284: Add overload of toString that returns a string

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:20 UTC 2016


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

ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.

commit 72060282fc4b94133ddb7afd2a12abdb956c7eea
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Mon Dec 14 18:07:12 2015 -0500

    Add overload of toString that returns a string
---
 include/af/util.h    | 21 ++++++++++++++++++++-
 src/api/cpp/util.cpp |  6 ++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/include/af/util.h b/include/af/util.h
index c1fd96a..a563376 100644
--- a/include/af/util.h
+++ b/include/af/util.h
@@ -95,7 +95,8 @@ namespace af
 #if AF_API_VERSION >= 31
     /**
         \param[out] output is the pointer to the c-string that will hold the data. The memory for
-        output is allocated by the function. The user is responsible for deleting the memory.
+        output is allocated by the function. The user is responsible for deleting the memory using
+        af::freeHost() or af_free_host().
         \param[in] exp is an expression, generally the name of the array
         \param[in] arr is the input array
         \param[in] precision is the precision length for display
@@ -108,6 +109,24 @@ namespace af
                         const int precision = 4, const bool transpose = true);
 #endif
 
+#if AF_API_VERSION >= 33
+    /**
+        \param[in] exp is an expression, generally the name of the array
+        \param[in] arr is the input array
+        \param[in] precision is the precision length for display
+        \param[in] transpose determines whether or not to transpose the array before storing it in
+        the string
+
+        \return output is the pointer to the c-string that will hold the data. The memory for
+        output is allocated by the function. The user is responsible for deleting the memory using
+        af::freeHost() or af_free_host().
+
+        \ingroup print_func_tostring
+    */
+    AFAPI const char* toString(const char *exp, const array &arr,
+                               const int precision = 4, const bool transpose = true);
+#endif
+
     // Purpose of Addition: "How to add Function" documentation
     AFAPI array exampleFunction(const array& in, const af_someenum_t param);
 }
diff --git a/src/api/cpp/util.cpp b/src/api/cpp/util.cpp
index a99b856..895d347 100644
--- a/src/api/cpp/util.cpp
+++ b/src/api/cpp/util.cpp
@@ -62,4 +62,10 @@ namespace af
         return;
     }
 
+    const char* toString(const char *exp, const array &arr, const int precision, const bool transpose)
+    {
+        char *output = NULL;
+        AF_THROW(af_array_to_string(&output, exp, arr.get(), precision, transpose));
+        return output;
+    }
 }

-- 
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