-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathjava.h
More file actions
31 lines (24 loc) · 1.18 KB
/
java.h
File metadata and controls
31 lines (24 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <arrayfire.h>
#include <assert.h>
#include <jni.h>
#include <stdexcept>
namespace java {
enum class JavaObjects { FloatComplex, DoubleComplex };
template <typename... Args>
jobject createJavaObject(JNIEnv *env, JavaObjects objectType, Args... args);
af_index_t jIndexToCIndex(JNIEnv *env, jobject obj);
void throwArrayFireException(JNIEnv *env, const char *functionName,
const char *file, const int line, const int code);
} // namespace java
#define AF_CHECK(err) \
if (err != AF_SUCCESS) { \
java::throwArrayFireException(env, __func__, __FILE__, __LINE__, \
(int)err); \
return 0; \
}
#define AF_CHECK_VOID(err) \
if (err != AF_SUCCESS) { \
java::throwArrayFireException(env, __func__, __FILE__, __LINE__, \
(int)err); \
return; \
}