22 #ifndef jtie_tconv_refbyval_impl_hpp
23 #define jtie_tconv_refbyval_impl_hpp
28 #include "jtie_tconv_refbyval.hpp"
29 #include "jtie_tconv_impl.hpp"
30 #include "jtie_tconv_ptrbyval_impl.hpp"
31 #include "jtie_tconv_utils_impl.hpp"
32 #include "helpers.hpp"
47 ensureNonNullArray(jarray ja, JNIEnv * env) {
52 const char * c =
"java/lang/IllegalArgumentException";
53 const char * m = (
"JNI wrapper: Java array cannot be null"
54 " when mapped to an object reference type"
55 " (file: " __FILE__
")");
56 registerException(env, c, m);
64 template<
typename J,
typename C >
68 convert(cstatus & s,
typename J::JA_t * j, JNIEnv * env) {
69 TRACE(
"C & ArrayRefParam.convert(cstatus &, typename J::JA_t *, JNIEnv *)");
75 if (ensureNonNullArray(j, env) != 0) {
79 assert(s != 0 || c != NULL);
85 release(C & c,
typename J::JA_t * j, JNIEnv * env) {
86 TRACE(
"void ArrayRefParam.release(C &, typename J::JA_t *, JNIEnv *)");
94 template<
typename J,
typename C >
97 convert(C & c, JNIEnv * env) {
98 TRACE(
"J * ArrayRefResult.convert(C &, JNIEnv *)");
120 #define JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING( JA, J, C ) \
122 struct Param< J, const C & > \
123 : Param< J, C > {}; \
125 struct Result< J, const C & > \
126 : Result< J, C > {}; \
128 struct Param< JA *, C & > \
129 : ArrayRefParam< _jtie_j_BoundedArray< JA, 1 >, C > {}; \
131 struct Result< J, C & > \
132 : Result< J, C > {}; \
138 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jbooleanArray, jboolean,
bool)
140 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jbyteArray, jbyte,
char)
141 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jbyteArray, jbyte,
signed char)
142 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jbyteArray, jbyte,
unsigned char)
144 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jfloatArray, jfloat,
float)
145 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jdoubleArray, jdouble,
double)
152 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jshortArray, jshort,
signed short)
153 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jshortArray, jshort,
unsigned short)
156 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jshortArray, jshort,
signed int)
157 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jshortArray, jshort,
unsigned int)
160 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jintArray, jint,
signed int)
161 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jintArray, jint,
unsigned int)
164 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jintArray, jint,
signed long)
165 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jintArray, jint,
unsigned long)
168 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong,
signed int)
169 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong,
unsigned int)
172 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong,
signed long)
173 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong,
unsigned long)
176 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong,
signed long long)
177 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong,
unsigned long long)
180 JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jdoubleArray, jdouble,
long double)
184 #endif // jtie_tconv_refbyval_impl_hpp