22 #ifndef jtie_tconv_value_impl_hpp
23 #define jtie_tconv_value_impl_hpp
28 #include "jtie_tconv_value.hpp"
29 #include "jtie_tconv_impl.hpp"
30 #include "helpers.hpp"
37 template<
typename J,
typename C >
40 convert(cstatus & s, J j, JNIEnv * env) {
41 TRACE(
"C ParamBasicT.convert(cstatus &, J, JNIEnv *)");
45 return static_cast< C
>(j);
49 release(C c, J j, JNIEnv * env) {
50 TRACE(
"void ParamBasicT.release(C, J, JNIEnv *)");
51 (void)c; (void)j; (void)env;
58 is_valid_primitive_type_mapping< J, C >();
63 template<
typename J,
typename C >
66 convert(C c, JNIEnv * env) {
67 TRACE(
"J ResultBasicT.convert(C, JNIEnv *)");
70 return static_cast< J
>(c);
77 is_valid_primitive_type_mapping< J, C >();
110 template <
typename J,
typename C >
111 struct is_valid_primitive_type_mapping< const J, C > {};
112 template <
typename J,
typename C >
113 struct is_valid_primitive_type_mapping< J, const C > {};
114 template <
typename J,
typename C >
115 struct is_valid_primitive_type_mapping< const J, const C > {};
123 #define JTIE_SPECIALIZE_BASIC_TYPE_MAPPING( J, C ) \
124 template<> struct is_valid_primitive_type_mapping< J, C > {}; \
125 template<> struct Param< J, C > : ParamBasicT< J, C > {}; \
126 template<> struct Result< J, C > : ResultBasicT< J, C > {}; \
127 template<> struct Param< J, C const > : ParamBasicT< J, C > {}; \
128 template<> struct Result< J, C const > : ResultBasicT< J, C > {};
138 convert(cstatus & s, jboolean j, JNIEnv * env) {
139 TRACE(
"bool ParamBasicT.convert(cstatus &, jboolean, JNIEnv *)");
143 return (j == JNI_TRUE);
147 release(
bool c, jboolean j, JNIEnv * env) {
148 TRACE(
"void ParamBasicT.release(bool, jboolean, JNIEnv *)");
149 (void)c; (void)j; (void)env;
157 convert(
bool c, JNIEnv * env) {
158 TRACE(
"jboolean ResultBasicT.convert(bool, JNIEnv *)");
162 return static_cast< jboolean
>(c ? JNI_TRUE : JNI_FALSE);
166 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jboolean,
bool)
172 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jbyte,
char)
173 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jbyte,
signed char)
174 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jbyte,
unsigned char)
176 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jfloat,
float)
177 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jdouble,
double)
192 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jshort,
signed short)
193 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jshort,
unsigned short)
196 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jshort,
signed int)
197 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jshort,
unsigned int)
200 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jint,
signed int)
201 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jint,
unsigned int)
204 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jint,
signed long)
205 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jint,
unsigned long)
208 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jlong,
signed int)
209 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jlong,
unsigned int)
212 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jlong,
signed long)
213 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jlong,
unsigned long)
216 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jlong,
signed long long)
217 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jlong,
unsigned long long)
220 JTIE_SPECIALIZE_BASIC_TYPE_MAPPING(jdouble,
long double)
224 #endif // jtie_tconv_value_impl_hpp