1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Copyright by The HDF Group. *
3 * Copyright by the Board of Trustees of the University of Illinois. *
4 * All rights reserved. *
5 * *
6 * This file is part of HDF5. The full HDF5 copyright notice, including *
7 * terms governing use, modification, and redistribution, is contained in *
8 * the COPYING file, which can be found at the root of the source code *
9 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
10 * If you do not have access to either file, you may request a copy from *
11 * help@hdfgroup.org. *
12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13
14 /*
15 * For details of the HDF libraries, see the HDF Documentation at:
16 * http://hdfgroup.org/HDF5/doc/
17 *
18 */
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
23
24 #include <stdlib.h>
25 #include "hdf5.h"
26 #include "h5jni.h"
27 #include "h5pGCPLImp.h"
28
29 /*
30 * Pointer to the JNI's Virtual Machine; used for callback functions.
31 */
32 /* extern JavaVM *jvm; */
33
34 /*
35 * Class: hdf_hdf5lib_H5
36 * Method: H5Pset_local_heap_size_hint
37 * Signature: (JJ)I
38 */
39 JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint(JNIEnv * env,jclass clss,jlong gcpl_id,jlong size_hint)40 Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
41 (JNIEnv *env, jclass clss, jlong gcpl_id, jlong size_hint)
42 {
43 herr_t retVal = FAIL;
44
45 UNUSED(clss);
46
47 if ((retVal = H5Pset_local_heap_size_hint((hid_t)gcpl_id, (size_t)size_hint)) < 0)
48 H5_LIBRARY_ERROR(ENVONLY);
49
50 done:
51 return (jint)retVal;
52 } /* end Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint */
53
54 /*
55 * Class: hdf_hdf5lib_H5
56 * Method: H5Pget_local_heap_size_hint
57 * Signature: (J)J
58 */
59 JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint(JNIEnv * env,jclass clss,jlong gcpl_id)60 Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
61 (JNIEnv *env, jclass clss, jlong gcpl_id)
62 {
63 size_t size_hint = 0;
64
65 UNUSED(clss);
66
67 if (H5Pget_local_heap_size_hint((hid_t)gcpl_id, &size_hint) < 0)
68 H5_LIBRARY_ERROR(ENVONLY);
69
70 done:
71 return (jlong)size_hint;
72 } /* end Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint */
73
74 /*
75 * Class: hdf_hdf5lib_H5
76 * Method: H5Pset_link_creation_order
77 * Signature: (JI)I
78 */
79 JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order(JNIEnv * env,jclass clss,jlong gcpl_id,jint crt_order_flags)80 Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
81 (JNIEnv *env, jclass clss, jlong gcpl_id, jint crt_order_flags)
82 {
83 herr_t retVal = FAIL;
84
85 UNUSED(clss);
86
87 if ((retVal = H5Pset_link_creation_order((hid_t)gcpl_id, (unsigned)crt_order_flags)) < 0)
88 H5_LIBRARY_ERROR(ENVONLY);
89
90 done:
91 return (jint)retVal;
92 } /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order */
93
94 /*
95 * Class: hdf_hdf5lib_H5
96 * Method: H5Pget_link_creation_order
97 * Signature: (J)I
98 */
99 JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order(JNIEnv * env,jclass clss,jlong gcpl_id)100 Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
101 (JNIEnv *env, jclass clss, jlong gcpl_id)
102 {
103 unsigned crt_order_flags;
104
105 UNUSED(clss);
106
107 if (H5Pget_link_creation_order((hid_t)gcpl_id, &crt_order_flags) < 0)
108 H5_LIBRARY_ERROR(ENVONLY);
109
110 done:
111 return (jint)crt_order_flags;
112 } /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order */
113
114 /*
115 * Class: hdf_hdf5lib_H5
116 * Method: H5Pset_est_link_info
117 * Signature: (JII)I
118 */
119 JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info(JNIEnv * env,jclass clss,jlong gcpl_id,jint est_num_entries,jint est_name_len)120 Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
121 (JNIEnv *env, jclass clss, jlong gcpl_id, jint est_num_entries, jint est_name_len)
122 {
123 herr_t retVal = FAIL;
124
125 UNUSED(clss);
126
127 /* Range check values */
128 if ((est_num_entries > 65535) || (est_name_len > 65535))
129 H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_est_link_info: est. name length or number of entries must be < 65536");
130
131 if ((retVal = H5Pset_est_link_info((hid_t)gcpl_id, (unsigned)est_num_entries, (unsigned)est_name_len)) < 0)
132 H5_LIBRARY_ERROR(ENVONLY);
133
134 done:
135 return (jint)retVal;
136 } /* end Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info */
137
138 /*
139 * Class: hdf_hdf5lib_H5
140 * Method: H5Pget_est_link_info
141 * Signature: (J[I)I
142 */
143 JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info(JNIEnv * env,jclass clss,jlong gcpl_id,jintArray link_info)144 Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
145 (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray link_info)
146 {
147 jboolean isCopy;
148 jint *theArray = NULL;
149 herr_t retVal = FAIL;
150
151 UNUSED(clss);
152
153 if (NULL == link_info)
154 H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_est_link_info: link_info is NULL");
155
156 PIN_INT_ARRAY(ENVONLY, link_info, theArray, &isCopy, "H5Pget_est_link_info: input not pinned");
157
158 if ((retVal = H5Pget_est_link_info((hid_t)gcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
159 H5_LIBRARY_ERROR(ENVONLY);
160
161 done:
162 if (theArray)
163 UNPIN_INT_ARRAY(ENVONLY, link_info, theArray, (retVal < 0) ? JNI_ABORT : 0);
164
165 return (jint)retVal;
166 } /* end Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info */
167
168 /*
169 * Class: hdf_hdf5lib_H5
170 * Method: H5Pset_link_phase_change
171 * Signature: (JII)I
172 */
173 JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change(JNIEnv * env,jclass clss,jlong gcpl_id,jint max_compact,jint min_dense)174 Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
175 (JNIEnv *env, jclass clss, jlong gcpl_id, jint max_compact, jint min_dense)
176 {
177 herr_t retVal = FAIL;
178
179 UNUSED(clss);
180
181 if (max_compact < min_dense)
182 H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: max compact value must be >= min dense value");
183 if (max_compact > 65535)
184 H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: max compact value must be < 65536");
185 if (min_dense > 65535)
186 H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: min dense value must be < 65536");
187
188 if ((retVal = H5Pset_link_phase_change((hid_t)gcpl_id, (unsigned)max_compact, (unsigned)min_dense)) < 0)
189 H5_LIBRARY_ERROR(ENVONLY);
190
191 done:
192 return (jint)retVal;
193 } /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change */
194
195 /*
196 * Class: hdf_hdf5lib_H5
197 * Method: H5Pget_link_phase_change
198 * Signature: (J[I)I
199 */
200 JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change(JNIEnv * env,jclass clss,jlong gcpl_id,jintArray links)201 Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
202 (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray links)
203 {
204 jboolean isCopy;
205 jint *theArray = NULL;
206 herr_t retVal = FAIL;
207
208 UNUSED(clss);
209
210 if (NULL == links)
211 H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_link_phase_change: links is NULL");
212
213 PIN_INT_ARRAY(ENVONLY, links, theArray, &isCopy, "H5Pget_link_phase_change: input not pinned");
214
215 if ((retVal = H5Pget_link_phase_change((hid_t)gcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
216 H5_LIBRARY_ERROR(ENVONLY);
217
218 done:
219 if (theArray)
220 UNPIN_INT_ARRAY(ENVONLY, links, theArray, (retVal < 0) ? JNI_ABORT : 0);
221
222 return (jint)retVal;
223 } /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change */
224
225 #ifdef __cplusplus
226 } /* end extern "C" */
227 #endif /* __cplusplus */
228