GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
ArrayTypes.java
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * - Redistribution of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * - Redistribution in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * Neither the name of Sun Microsystems, Inc. or the names of
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * This software is provided "AS IS," without a warranty of any kind. ALL
20 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
21 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
22 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
23 * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
24 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
25 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
26 * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
27 * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
28 * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
29 * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
30 * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
31 *
32 * You acknowledge that this software is not designed or intended for use
33 * in the design, construction, operation or maintenance of any nuclear
34 * facility.
35 *
36 * Sun gratefully acknowledges that this software was originally authored
37 * and developed by Kenneth Bradley Russell and Christopher John Kline.
38 */
39
40package com.jogamp.gluegen;
41
42import java.nio.*;
43
44/**
45 * Convenience class containing the Class objects corresponding to arrays of
46 * various types (e.g., {@link #booleanArrayClass} is the Class of Java type
47 * "boolean[]").
48 */
49public class ArrayTypes {
50 /** Class for Java type boolean[] */
51 public static final Class<?> booleanArrayClass;
52 /** Class for Java type byte[] */
53 public static final Class<?> byteArrayClass;
54 /** Class for Java type char[] */
55 public static final Class<?> charArrayClass;
56 /** Class for Java type short[] */
57 public static final Class<?> shortArrayClass;
58 /** Class for Java type int[] */
59 public static final Class<?> intArrayClass;
60 /** Class for Java type long[] */
61 public static final Class<?> longArrayClass;
62 /** Class for Java type float[] */
63 public static final Class<?> floatArrayClass;
64 /** Class for Java type double[] */
65 public static final Class<?> doubleArrayClass;
66 /** Class for Java type String[] */
67 public static final Class<?> stringArrayClass;
68
69 // Classes for two-dimensional arrays.
70 //
71 // GlueGen converts C types like int** into Java arrays of direct
72 // buffers of the appropriate type (like IntBuffer[]). If the tool
73 // supported conversions like byte[][] -> char**, it would
74 // effectively be necessary to copy all of the data from the Java
75 // heap to the C heap during each call. The reason for this is that
76 // if we wanted to use GetPrimitiveArrayCritical to lock down the
77 // storage for each individual array element, we would need to fetch
78 // each element of the two-dimensional Java array into temporary
79 // storage before making the first GetPrimitiveArrayCritical call,
80 // since one can not call GetObjectArrayElement inside a Get /
81 // ReleasePrimitiveArrayCritical pair. This means that we would need
82 // two top-level pieces of temporary storage for the two-dimensional
83 // array as well as two loops to set up the contents, which would be
84 // too complicated.
85 //
86 // The one concession we make is converting String[] -> char**. The
87 // JVM takes care of the C heap allocation for GetStringUTFChars and
88 // ReleaseStringUTFChars, and this conversion is important for
89 // certain OpenGL operations.
90
91 /** Class for Java type Buffer[] */
92 public static final Class<?> bufferArrayClass;
93 /** Class for Java type ByteBuffer[] */
94 public static final Class<?> byteBufferArrayClass;
95 /** Class for Java type ShortBuffer[] */
96 public static final Class<?> shortBufferArrayClass;
97 /** Class for Java type IntBuffer[] */
98 public static final Class<?> intBufferArrayClass;
99 /** Class for Java type LongBuffer[] */
100 public static final Class<?> longBufferArrayClass;
101 /** Class for Java type FloatBuffer[] */
102 public static final Class<?> floatBufferArrayClass;
103 /** Class for Java type DoubleBuffer[] */
104 public static final Class<?> doubleBufferArrayClass;
105
106 static {
107 booleanArrayClass = new boolean[0].getClass();
108 byteArrayClass = new byte [0].getClass();
109 charArrayClass = new char [0].getClass();
110 shortArrayClass = new short [0].getClass();
111 intArrayClass = new int [0].getClass();
112 longArrayClass = new long [0].getClass();
113 floatArrayClass = new float [0].getClass();
114 doubleArrayClass = new double [0].getClass();
115 stringArrayClass = new String [0].getClass();
116
117 bufferArrayClass = new Buffer [0].getClass();
118 byteBufferArrayClass = new ByteBuffer [0].getClass();
119 shortBufferArrayClass = new ShortBuffer [0].getClass();
120 intBufferArrayClass = new IntBuffer [0].getClass();
121 longBufferArrayClass = new LongBuffer [0].getClass();
122 floatBufferArrayClass = new FloatBuffer [0].getClass();
123 doubleBufferArrayClass = new DoubleBuffer[0].getClass();
124 }
125}
Convenience class containing the Class objects corresponding to arrays of various types (e....
Definition: ArrayTypes.java:49
static final Class<?> longBufferArrayClass
Class for Java type LongBuffer[].
static final Class<?> charArrayClass
Class for Java type char[].
Definition: ArrayTypes.java:55
static final Class<?> floatBufferArrayClass
Class for Java type FloatBuffer[].
static final Class<?> intArrayClass
Class for Java type int[].
Definition: ArrayTypes.java:59
static final Class<?> booleanArrayClass
Class for Java type boolean[].
Definition: ArrayTypes.java:51
static final Class<?> intBufferArrayClass
Class for Java type IntBuffer[].
Definition: ArrayTypes.java:98
static final Class<?> bufferArrayClass
Class for Java type Buffer[].
Definition: ArrayTypes.java:92
static final Class<?> shortArrayClass
Class for Java type short[].
Definition: ArrayTypes.java:57
static final Class<?> byteBufferArrayClass
Class for Java type ByteBuffer[].
Definition: ArrayTypes.java:94
static final Class<?> shortBufferArrayClass
Class for Java type ShortBuffer[].
Definition: ArrayTypes.java:96
static final Class<?> longArrayClass
Class for Java type long[].
Definition: ArrayTypes.java:61
static final Class<?> floatArrayClass
Class for Java type float[].
Definition: ArrayTypes.java:63
static final Class<?> stringArrayClass
Class for Java type String[].
Definition: ArrayTypes.java:67
static final Class<?> doubleBufferArrayClass
Class for Java type DoubleBuffer[].
static final Class<?> byteArrayClass
Class for Java type byte[].
Definition: ArrayTypes.java:53
static final Class<?> doubleArrayClass
Class for Java type double[].
Definition: ArrayTypes.java:65