1 /*
2  Copyright 2010 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License, version 2.0,
7  as published by the Free Software Foundation.
8 
9  This program is also distributed with certain software (including
10  but not limited to OpenSSL) that is licensed under separate terms,
11  as designated in a particular file or component or in included license
12  documentation.  The authors of MySQL hereby grant you an additional
13  permission to link the program and your derivative works with the
14  separately licensed software that they have included with MySQL.
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  GNU General Public License, version 2.0, for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
24 */
25 /*
26  * jtie_tconv_xwidth.hpp
27  */
28 
29 #ifndef jtie_tconv_xwidth_hpp
30 #define jtie_tconv_xwidth_hpp
31 
32 #include <jni.h>
33 
34 #include "jtie_stdint.h"
35 #include "jtie_tconv_value.hpp"
36 #include "jtie_tconv_ptrbybb.hpp"
37 #include "jtie_tconv_refbybb.hpp"
38 #include "jtie_tconv_ptrbyval.hpp"
39 #include "jtie_tconv_refbyval.hpp"
40 
41 // ---------------------------------------------------------------------------
42 // Java <-> C primitive & derived exact-width type conversions
43 // ---------------------------------------------------------------------------
44 
45 /**
46  * Defines the set of value, pointer, and reference trait type aliases
47  * for the mapping of a basic Java type to a basic C++ type alias.
48  *
49  * The macro takes these arguments:
50  *   J: A basic JNI type name (representing a basic Java type).
51  *   C: A basic C++ type alias.
52  *   T: A name tag for this mapping.
53  *
54  * Naming convention: see documentation of the JTIE_DEFINE_... macros
55  */
56 #define JTIE_DEFINE_BASIC_TYPE_MAPPING_SET( J, C, T )                   \
57     JTIE_DEFINE_BASIC_TYPE_MAPPING(J, C, T)                             \
58     JTIE_DEFINE_ARRAY_PTR_TYPE_MAPPING(_##J##Array, C, T)               \
59     JTIE_DEFINE_ARRAY_PTR_LENGTH1_TYPE_MAPPING(_##J##Array, C, T)       \
60     JTIE_DEFINE_VALUE_REF_TYPE_MAPPING(J, C, T)                         \
61     JTIE_DEFINE_ARRAY_REF_TYPE_MAPPING(_##J##Array, C, T)               \
62     JTIE_DEFINE_BYTEBUFFER_PTR_TYPE_MAPPING(C, T)                       \
63     JTIE_DEFINE_BYTEBUFFER_PTR_LENGTH1_TYPE_MAPPING(C, T)               \
64     JTIE_DEFINE_BYTEBUFFER_REF_TYPE_MAPPING(C, T)
65 
66 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jboolean, bool, bool);
67 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jbyte, char, char);
68 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jbyte, signed char, schar);
69 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jbyte, unsigned char, uchar);
70 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jbyte, int8_t, int8);
71 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jbyte, uint8_t, uint8);
72 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jshort, int16_t, int16);
73 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jshort, uint16_t, uint16);
74 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jint, int32_t, int32);
75 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jint, uint32_t, uint32);
76 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jlong, int64_t, int64);
77 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jlong, uint64_t, uint64);
78 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jfloat, float, float);
79 JTIE_DEFINE_BASIC_TYPE_MAPPING_SET(jdouble, double, double);
80 
81 // ---------------------------------------------------------------------------
82 
83 #endif // jtie_tconv_xwidth_hpp
84