#At file:///Users/mz/mysql/ndb-6.3-ndbjtie-automake/ based on
revid:martin.zaun@stripped
3104 Martin Zaun 2009-11-06
ndbjtie - part 5 of ?: added missing fixes of template specialization for reference
types.
modified:
storage/ndb/ndbjtie/jtie/include/jtie_tconv_refbybb_impl.hpp
storage/ndb/ndbjtie/jtie/include/jtie_tconv_refbyval_impl.hpp
=== modified file 'storage/ndb/ndbjtie/jtie/include/jtie_tconv_refbybb_impl.hpp'
--- a/storage/ndb/ndbjtie/jtie/include/jtie_tconv_refbybb_impl.hpp 2009-09-18 20:40:07
+0000
+++ b/storage/ndb/ndbjtie/jtie/include/jtie_tconv_refbybb_impl.hpp 2009-11-07 06:25:30
+0000
@@ -106,14 +106,12 @@ struct ByteBufferRefResult {
// Specializations for ByteBuffer type conversions
// ---------------------------------------------------------------------------
-// for ByteBuffers mapped to references, require a minimum buffer capacity
-// of size of the reference's base type
+// specialize ByteBuffers mapped to references:
+// - params: require a minimum buffer capacity of the size of the base type
+// - results: allocate buffer with a capacity of the size of the base type
template< typename C >
struct Param< jtie_j_n_ByteBuffer, C & >
: ByteBufferRefParam< _jtie_j_n_BoundedByteBuffer< sizeof(C) >, C > {};
-
-// for ByteBuffers mapped to references, allocate buffer with a capacity
-// of the size of the reference's base type
template< typename C >
struct Result< jtie_j_n_ByteBuffer, C & >
: ByteBufferRefResult< _jtie_j_n_BoundedByteBuffer< sizeof(C) >, C > {};
=== modified file 'storage/ndb/ndbjtie/jtie/include/jtie_tconv_refbyval_impl.hpp'
--- a/storage/ndb/ndbjtie/jtie/include/jtie_tconv_refbyval_impl.hpp 2009-11-04 17:28:51
+0000
+++ b/storage/ndb/ndbjtie/jtie/include/jtie_tconv_refbyval_impl.hpp 2009-11-07 06:25:30
+0000
@@ -113,169 +113,72 @@ struct ArrayRefResult {
// template instantiation ambiguities for non-primitive types. Therefore,
// we enumerate all specicializations for primitive type references.
+// specialize values/value-holders mapped to references:
+// - const params: map as value copy
+// - const results: map as value copy
+// - non-const params: map as value holder (array of length 1)
+// - non-const results: map as value copy (no use as value holders)
+#define JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING( JA, J, C ) \
+ template<> \
+ struct Param< J, const C & > \
+ : Param< J, C > {}; \
+ template<> \
+ struct Result< J, const C & > \
+ : Result< J, C > {}; \
+ template<> \
+ struct Param< JA *, C & > \
+ : ArrayRefParam< _jtie_j_BoundedArray< JA, 1 >, C > {}; \
+ template<> \
+ struct Result< J, C & > \
+ : Result< J, C > {}; \
+
// ---------------------------------------------------------------------------
// Specializations for reference to exact-width primitive type conversions
// ---------------------------------------------------------------------------
-// const reference parameters (map as value copy)
-template<> struct Param< jboolean, const bool & > : Param< jboolean,
bool > {};
-template<> struct Param< jbyte, const char & > : Param< jbyte, char
> {};
-template<> struct Param< jbyte, const int8_t & > : Param< jbyte,
int8_t > {};
-template<> struct Param< jbyte, const uint8_t & > : Param< jbyte,
uint8_t > {};
-template<> struct Param< jshort, const int16_t & > : Param< jshort,
int16_t > {};
-template<> struct Param< jshort, const uint16_t & > : Param< jshort,
uint16_t > {};
-template<> struct Param< jint, const int32_t & > : Param< jint,
int32_t > {};
-template<> struct Param< jint, const uint32_t & > : Param< jint,
uint32_t > {};
-template<> struct Param< jlong, const int64_t & > : Param< jlong,
int64_t > {};
-template<> struct Param< jlong, const uint64_t & > : Param< jlong,
uint64_t > {};
-template<> struct Param< jfloat, const float & > : Param< jfloat,
float > {};
-template<> struct Param< jdouble, const double & > : Param< jdouble,
double > {};
-
-// const reference results (map as value copy)
-template<> struct Result< jboolean, const bool & > : Result< jboolean,
bool > {};
-template<> struct Result< jbyte, const char & > : Result< jbyte, char
> {};
-template<> struct Result< jbyte, const int8_t & > : Result< jbyte,
int8_t > {};
-template<> struct Result< jbyte, const uint8_t & > : Result< jbyte,
uint8_t > {};
-template<> struct Result< jshort, const int16_t & > : Result< jshort,
int16_t > {};
-template<> struct Result< jshort, const uint16_t & > : Result< jshort,
uint16_t > {};
-template<> struct Result< jint, const int32_t & > : Result< jint,
int32_t > {};
-template<> struct Result< jint, const uint32_t & > : Result< jint,
uint32_t > {};
-template<> struct Result< jlong, const int64_t & > : Result< jlong,
int64_t > {};
-template<> struct Result< jlong, const uint64_t & > : Result< jlong,
uint64_t > {};
-template<> struct Result< jfloat, const float & > : Result< jfloat,
float > {};
-template<> struct Result< jdouble, const double & > : Result< jdouble,
double > {};
-
-// non-const reference parameters (map as value holders)
-template<> struct Param< _jbooleanArray *, bool & > : ArrayRefParam<
_jtie_j_BoundedArray< _jbooleanArray, 1 >, bool > {};
-template<> struct Param< _jbyteArray *, char & > : ArrayRefParam<
_jtie_j_BoundedArray< _jbyteArray, 1 >, char > {};
-template<> struct Param< _jbyteArray *, int8_t & > : ArrayRefParam<
_jtie_j_BoundedArray< _jbyteArray, 1 >, int8_t > {};
-template<> struct Param< _jbyteArray *, uint8_t & > : ArrayRefParam<
_jtie_j_BoundedArray< _jbyteArray, 1 >, uint8_t > {};
-template<> struct Param< _jshortArray *, int16_t & > : ArrayRefParam<
_jtie_j_BoundedArray< _jshortArray, 1 >, int16_t > {};
-template<> struct Param< _jshortArray *, uint16_t & > : ArrayRefParam<
_jtie_j_BoundedArray< _jshortArray, 1 >, uint16_t > {};
-template<> struct Param< _jintArray *, int32_t & > : ArrayRefParam<
_jtie_j_BoundedArray< _jintArray, 1 >, int32_t > {};
-template<> struct Param< _jintArray *, uint32_t & > : ArrayRefParam<
_jtie_j_BoundedArray< _jintArray, 1 >, uint32_t > {};
-template<> struct Param< _jlongArray *, int64_t & > : ArrayRefParam<
_jtie_j_BoundedArray< _jlongArray, 1 >, int64_t > {};
-template<> struct Param< _jlongArray *, uint64_t & > : ArrayRefParam<
_jtie_j_BoundedArray< _jlongArray, 1 >, uint64_t > {};
-template<> struct Param< _jfloatArray *, float & > : ArrayRefParam<
_jtie_j_BoundedArray< _jfloatArray, 1 >, float > {};
-template<> struct Param< _jdoubleArray *, double & > : ArrayRefParam<
_jtie_j_BoundedArray< _jdoubleArray, 1 >, double > {};
-
-// non-const reference results (map as value copy, no use as value holders)
-template<> struct Result< jboolean, bool & > : Result< jboolean, bool
> {};
-template<> struct Result< jbyte, char & > : Result< jbyte, char >
{};
-template<> struct Result< jbyte, int8_t & > : Result< jbyte, int8_t
> {};
-template<> struct Result< jbyte, uint8_t & > : Result< jbyte, uint8_t
> {};
-template<> struct Result< jshort, int16_t & > : Result< jshort,
int16_t > {};
-template<> struct Result< jshort, uint16_t & > : Result< jshort,
uint16_t > {};
-template<> struct Result< jint, int32_t & > : Result< jint, int32_t
> {};
-template<> struct Result< jint, uint32_t & > : Result< jint, uint32_t
> {};
-template<> struct Result< jlong, int64_t & > : Result< jlong, int64_t
> {};
-template<> struct Result< jlong, uint64_t & > : Result< jlong,
uint64_t > {};
-template<> struct Result< jfloat, float & > : Result< jfloat, float
> {};
-template<> struct Result< jdouble, double & > : Result< jdouble,
double > {};
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jbooleanArray, jboolean, bool)
+
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jbyteArray, jbyte, char)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jbyteArray, jbyte, signed char)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jbyteArray, jbyte, unsigned char)
+
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jfloatArray, jfloat, float)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jdoubleArray, jdouble, double)
// ---------------------------------------------------------------------------
// Specializations for reference to variable-width primitive type conversions
// ---------------------------------------------------------------------------
-// const reference parameters (map as value copy)
-#if (defined(JTIE_TSPECIALIZE_SHORT) && JTIE_TSPECIALIZE_SHORT > 0)
-template<> struct Param< JTIE_JNI_SHORT_T, const signed short & > :
Param< JTIE_JNI_SHORT_T, signed short > {};
-template<> struct Param< JTIE_JNI_SHORT_T, const unsigned short & > :
Param< JTIE_JNI_SHORT_T, unsigned short > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_INT) && JTIE_TSPECIALIZE_INT > 0)
-template<> struct Param< JTIE_JNI_INT_T, const signed int & > : Param<
JTIE_JNI_INT_T, signed int > {};
-template<> struct Param< JTIE_JNI_INT_T, const unsigned int & > :
Param< JTIE_JNI_INT_T, unsigned int > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONG) && JTIE_TSPECIALIZE_LONG > 0)
-template<> struct Param< JTIE_JNI_LONG_T, const signed long & > :
Param< JTIE_JNI_LONG_T, signed long > {};
-template<> struct Param< JTIE_JNI_LONG_T, const unsigned long & > :
Param< JTIE_JNI_LONG_T, unsigned long > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONGLONG) && JTIE_TSPECIALIZE_LONGLONG > 0)
-template<> struct Param< JTIE_JNI_LONGLONG_T, const signed long long & >
: Param< JTIE_JNI_LONGLONG_T, signed long long > {};
-template<> struct Param< JTIE_JNI_LONGLONG_T, const unsigned long long &
> : Param< JTIE_JNI_LONGLONG_T, unsigned long long > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONGDOUBLE) && JTIE_TSPECIALIZE_LONGDOUBLE > 0)
-template<> struct Param< JTIE_JNI_LONGDOUBLE_T, const long double & > :
Param< JTIE_JNI_LONGDOUBLE_T, long double > {};
-#endif
-
-// const reference results (map as value copy)
-#if (defined(JTIE_TSPECIALIZE_SHORT) && JTIE_TSPECIALIZE_SHORT > 0)
-template<> struct Result< JTIE_JNI_SHORT_T, const signed short & > :
Result< JTIE_JNI_SHORT_T, signed short > {};
-template<> struct Result< JTIE_JNI_SHORT_T, const unsigned short & > :
Result< JTIE_JNI_SHORT_T, unsigned short > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_INT) && JTIE_TSPECIALIZE_INT > 0)
-template<> struct Result< JTIE_JNI_INT_T, const signed int & > :
Result< JTIE_JNI_INT_T, signed int > {};
-template<> struct Result< JTIE_JNI_INT_T, const unsigned int & > :
Result< JTIE_JNI_INT_T, unsigned int > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONG) && JTIE_TSPECIALIZE_LONG > 0)
-template<> struct Result< JTIE_JNI_LONG_T, const signed long & > :
Result< JTIE_JNI_LONG_T, signed long > {};
-template<> struct Result< JTIE_JNI_LONG_T, const unsigned long & > :
Result< JTIE_JNI_LONG_T, unsigned long > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONGLONG) && JTIE_TSPECIALIZE_LONGLONG > 0)
-template<> struct Result< JTIE_JNI_LONGLONG_T, const signed long long & >
: Result< JTIE_JNI_LONGLONG_T, signed long long > {};
-template<> struct Result< JTIE_JNI_LONGLONG_T, const unsigned long long &
> : Result< JTIE_JNI_LONGLONG_T, unsigned long long > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONGDOUBLE) && JTIE_TSPECIALIZE_LONGDOUBLE > 0)
-template<> struct Result< JTIE_JNI_LONGDOUBLE_T, const long double & > :
Result< JTIE_JNI_LONGDOUBLE_T, long double > {};
-#endif
-
-// non-const reference parameters (map as value holders)
-#if (defined(JTIE_TSPECIALIZE_SHORT_ARRAY) && JTIE_TSPECIALIZE_SHORT_ARRAY >
0)
-template<> struct Param< JTIE_JNI_SHORT_ARRAY_T, const signed short & > :
ArrayRefParam< _jtie_j_BoundedArray< JTIE_JNI_SHORT_ARRAY_T, 1 >, signed short
> {};
-template<> struct Param< JTIE_JNI_SHORT_ARRAY_T, const unsigned short & >
: ArrayRefParam< _jtie_j_BoundedArray< JTIE_JNI_SHORT_ARRAY_T, 1 >, unsigned
short > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_INT_ARRAY) && JTIE_TSPECIALIZE_INT_ARRAY > 0)
-template<> struct Param< JTIE_JNI_INT_ARRAY_T, const signed int & > :
ArrayRefParam< _jtie_j_BoundedArray< JTIE_JNI_INT_ARRAY_T, 1 >, signed int >
{};
-template<> struct Param< JTIE_JNI_INT_ARRAY_T, const unsigned int & > :
ArrayRefParam< _jtie_j_BoundedArray< JTIE_JNI_INT_ARRAY_T, 1 >, unsigned int
> {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONG_ARRAY) && JTIE_TSPECIALIZE_LONG_ARRAY > 0)
-template<> struct Param< JTIE_JNI_LONG_ARRAY_T, const signed long & > :
ArrayRefParam< _jtie_j_BoundedArray< JTIE_JNI_LONG_ARRAY_T, 1 >, signed long
> {};
-template<> struct Param< JTIE_JNI_LONG_ARRAY_T, const unsigned long & > :
ArrayRefParam< _jtie_j_BoundedArray< JTIE_JNI_LONG_ARRAY_T, 1 >, unsigned long
> {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONGLONG_ARRAY) && JTIE_TSPECIALIZE_LONGLONG_ARRAY
> 0)
-template<> struct Param< JTIE_JNI_LONGLONG_ARRAY_T, const signed long long &
> : ArrayRefParam< _jtie_j_BoundedArray< JTIE_JNI_LONGLONG_ARRAY_T, 1 >,
signed long long > {};
-template<> struct Param< JTIE_JNI_LONGLONG_ARRAY_T, const unsigned long long
& > : ArrayRefParam< _jtie_j_BoundedArray< JTIE_JNI_LONGLONG_ARRAY_T, 1
>, unsigned long long > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONGDOUBLE_ARRAY) &&
JTIE_TSPECIALIZE_LONGDOUBLE_ARRAY > 0)
-template<> struct Param< JTIE_JNI_LONGDOUBLE_ARRAY_T, const long double &
> : ArrayRefParam< _jtie_j_BoundedArray< JTIE_JNI_LONGDOUBLE_ARRAY_T, 1 >,
long double > {};
-#endif
-
-// non-const reference results (map as value copy, no use as value holders)
-#if (defined(JTIE_TSPECIALIZE_SHORT) && JTIE_TSPECIALIZE_SHORT > 0)
-template<> struct Result< JTIE_JNI_SHORT_T, signed short & > : Result<
JTIE_JNI_SHORT_T, signed short > {};
-template<> struct Result< JTIE_JNI_SHORT_T, unsigned short & > :
Result< JTIE_JNI_SHORT_T, unsigned short > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_INT) && JTIE_TSPECIALIZE_INT > 0)
-template<> struct Result< JTIE_JNI_INT_T, signed int & > : Result<
JTIE_JNI_INT_T, signed int > {};
-template<> struct Result< JTIE_JNI_INT_T, unsigned int & > : Result<
JTIE_JNI_INT_T, unsigned int > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONG) && JTIE_TSPECIALIZE_LONG > 0)
-template<> struct Result< JTIE_JNI_LONG_T, signed long & > : Result<
JTIE_JNI_LONG_T, signed long > {};
-template<> struct Result< JTIE_JNI_LONG_T, unsigned long & > : Result<
JTIE_JNI_LONG_T, unsigned long > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONGLONG) && JTIE_TSPECIALIZE_LONGLONG > 0)
-template<> struct Result< JTIE_JNI_LONGLONG_T, signed long long & > :
Result< JTIE_JNI_LONGLONG_T, signed long long > {};
-template<> struct Result< JTIE_JNI_LONGLONG_T, unsigned long long & > :
Result< JTIE_JNI_LONGLONG_T, unsigned long long > {};
-#endif
-
-#if (defined(JTIE_TSPECIALIZE_LONGDOUBLE) && JTIE_TSPECIALIZE_LONGDOUBLE > 0)
-template<> struct Result< JTIE_JNI_LONGDOUBLE_T, long double & > :
Result< JTIE_JNI_LONGDOUBLE_T, long double > {};
-#endif
+// jshort in LP32, ILP32, LP64, ILP64, LLP64
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jshortArray, jshort, signed short)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jshortArray, jshort, unsigned short)
+
+// jshort in LP32
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jshortArray, jshort, signed int)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jshortArray, jshort, unsigned int)
+
+// jint in ILP32, LP64, LLP64
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jintArray, jint, signed int)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jintArray, jint, unsigned int)
+
+// jint in LP32, ILP32, LLP64
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jintArray, jint, signed long)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jintArray, jint, unsigned long)
+
+// jlong in ILP64
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong, signed int)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong, unsigned int)
+
+// jlong in LP64, ILP64
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong, signed long)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong, unsigned long)
+
+// jlong in LLP64
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong, signed long long)
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jlongArray, jlong, unsigned long long)
+
+// jdouble
+JTIE_SPECIALIZE_REFERENCE_TYPE_MAPPING(_jdoubleArray, jdouble, long double)
// ---------------------------------------------------------------------------
Attachment: [text/bzr-bundle] bzr/martin.zaun@sun.com-20091107062530-r353axpa5m4sj9yc.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-6.3-ndbjtie branch (martin.zaun:3104) | Martin Zaun | 7 Nov 2009 |