MISR Toolkit  1.5.1
H5public.h
Go to the documentation of this file.
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  * This file contains public declarations for the HDF5 module.
16  */
17 #ifndef _H5public_H
18 #define _H5public_H
19 
20 /* Include files for public use... */
21 /*
22  * Since H5pubconf.h is a generated header file, it is messy to try
23  * to put a #ifndef _H5pubconf_H ... #endif guard in it.
24  * HDF5 has set an internal rule that it is being included here.
25  * Source files should NOT include H5pubconf.h directly but include
26  * it via H5public.h. The #ifndef _H5public_H guard above would
27  * prevent repeated include.
28  */
29 #include "H5pubconf.h" /*from configure */
30 
31 /* API Version macro wrapper definitions */
32 #include "H5version.h"
33 
34 #ifdef H5_HAVE_FEATURES_H
35 #include <features.h> /*for setting POSIX, BSD, etc. compatibility */
36 #endif
37 #ifdef H5_HAVE_SYS_TYPES_H
38 #include <sys/types.h>
39 #endif
40 #ifdef H5_STDC_HEADERS
41 # include <limits.h> /*for H5T_NATIVE_CHAR defn in H5Tpublic.h */
42 #endif
43 #ifndef __cplusplus
44 # ifdef H5_HAVE_STDINT_H
45 # include <stdint.h> /*for C9x types */
46 # endif
47 #else
48 # ifdef H5_HAVE_STDINT_H_CXX
49 # include <stdint.h> /*for C9x types when include from C++ */
50 # endif
51 #endif
52 #ifdef H5_HAVE_INTTYPES_H
53 # include <inttypes.h> /* For uint64_t on some platforms */
54 #endif
55 #ifdef H5_HAVE_STDDEF_H
56 # include <stddef.h>
57 #endif
58 #ifdef H5_HAVE_PARALLEL
59 # include <mpi.h>
60 #ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
61 # include <mpio.h>
62 #endif
63 #endif
64 
65 
66 /* Include the Windows API adapter header early */
67 #include "H5api_adpt.h"
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
73 /* Macros for enabling/disabling particular GCC warnings */
74 /* (see the following web-sites for more info:
75  * http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
76  * http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
77  */
78 /* These pragmas are only implemented usefully in gcc 4.6+ */
79 #if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
80  #define H5_GCC_DIAG_STR(s) #s
81  #define H5_GCC_DIAG_JOINSTR(x,y) H5_GCC_DIAG_STR(x ## y)
82  #define H5_GCC_DIAG_DO_PRAGMA(x) _Pragma (#x)
83  #define H5_GCC_DIAG_PRAGMA(x) H5_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
84 
85  #define H5_GCC_DIAG_OFF(x) H5_GCC_DIAG_PRAGMA(push) H5_GCC_DIAG_PRAGMA(ignored H5_GCC_DIAG_JOINSTR(-W,x))
86  #define H5_GCC_DIAG_ON(x) H5_GCC_DIAG_PRAGMA(pop)
87 #else
88  #define H5_GCC_DIAG_OFF(x)
89  #define H5_GCC_DIAG_ON(x)
90 #endif
91 
92 /* Version numbers */
93 #define H5_VERS_MAJOR 1 /* For major interface/format changes */
94 #define H5_VERS_MINOR 8 /* For minor interface/format changes */
95 #define H5_VERS_RELEASE 21 /* For tweaks, bug-fixes, or development */
96 #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */
97  /* Empty string for real releases. */
98 #define H5_VERS_INFO "HDF5 library version: 1.8.21" /* Full version string */
99 
100 #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
101  H5_VERS_RELEASE)
102 
103 /* macros for comparing the version */
104 #define H5_VERSION_GE(Maj,Min,Rel) \
105  (((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR==Min) && (H5_VERS_RELEASE>=Rel)) || \
106  ((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR>Min)) || \
107  (H5_VERS_MAJOR>Maj))
108 
109 #define H5_VERSION_LE(Maj,Min,Rel) \
110  (((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR==Min) && (H5_VERS_RELEASE<=Rel)) || \
111  ((H5_VERS_MAJOR==Maj) && (H5_VERS_MINOR<Min)) || \
112  (H5_VERS_MAJOR<Maj))
113 
114 /*
115  * Status return values. Failed integer functions in HDF5 result almost
116  * always in a negative value (unsigned failing functions sometimes return
117  * zero for failure) while successfull return is non-negative (often zero).
118  * The negative failure value is most commonly -1, but don't bet on it. The
119  * proper way to detect failure is something like:
120  *
121  * if((dset = H5Dopen2(file, name)) < 0)
122  * fprintf(stderr, "unable to open the requested dataset\n");
123  */
124 typedef int herr_t;
125 
126 
127 /*
128  * Boolean type. Successful return values are zero (false) or positive
129  * (true). The typical true value is 1 but don't bet on it. Boolean
130  * functions cannot fail. Functions that return `htri_t' however return zero
131  * (false), positive (true), or negative (failure). The proper way to test
132  * for truth from a htri_t function is:
133  *
134  * if ((retval = H5Tcommitted(type))>0) {
135  * printf("data type is committed\n");
136  * } else if (!retval) {
137  * printf("data type is not committed\n");
138  * } else {
139  * printf("error determining whether data type is committed\n");
140  * }
141  */
142 typedef unsigned int hbool_t;
143 typedef int htri_t;
144 
145 /* Define the ssize_t type if it not is defined */
146 #if H5_SIZEOF_SSIZE_T==0
147 /* Undefine this size, we will re-define it in one of the sections below */
148 #undef H5_SIZEOF_SSIZE_T
149 #if H5_SIZEOF_SIZE_T==H5_SIZEOF_INT
150 typedef int ssize_t;
151 # define H5_SIZEOF_SSIZE_T H5_SIZEOF_INT
152 #elif H5_SIZEOF_SIZE_T==H5_SIZEOF_LONG
153 typedef long ssize_t;
154 # define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG
155 #elif H5_SIZEOF_SIZE_T==H5_SIZEOF_LONG_LONG
156 typedef long long ssize_t;
157 # define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG_LONG
158 #else /* Can't find matching type for ssize_t */
159 # error "nothing appropriate for ssize_t"
160 #endif
161 #endif
162 
163 /*
164  * The sizes of file objects have their own types defined here, use a 64-bit
165  * type.
166  */
167 #if H5_SIZEOF_LONG_LONG >= 8
168 H5_GCC_DIAG_OFF(long-long)
169 typedef unsigned long long hsize_t;
170 typedef signed long long hssize_t;
171 H5_GCC_DIAG_ON(long-long)
172 # define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG
173 # define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG
174 #else
175 # error "nothing appropriate for hsize_t"
176 #endif
177 
178 /*
179  * File addresses have their own types.
180  */
181 #if H5_SIZEOF_INT64_T>=8
182  typedef uint64_t haddr_t;
183 # define HADDR_UNDEF ((haddr_t)(int64_t)(-1))
184 # define H5_SIZEOF_HADDR_T H5_SIZEOF_INT64_T
185 # ifdef H5_HAVE_PARALLEL
186 # define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT
187 # endif /* H5_HAVE_PARALLEL */
188 #elif H5_SIZEOF_INT>=8
189  typedef unsigned haddr_t;
190 # define HADDR_UNDEF ((haddr_t)(-1))
191 # define H5_SIZEOF_HADDR_T H5_SIZEOF_INT
192 # ifdef H5_HAVE_PARALLEL
193 # define HADDR_AS_MPI_TYPE MPI_UNSIGNED
194 # endif /* H5_HAVE_PARALLEL */
195 #elif H5_SIZEOF_LONG>=8
196  typedef unsigned long haddr_t;
197 # define HADDR_UNDEF ((haddr_t)(long)(-1))
198 # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG
199 # ifdef H5_HAVE_PARALLEL
200 # define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG
201 # endif /* H5_HAVE_PARALLEL */
202 #elif H5_SIZEOF_LONG_LONG>=8
203  typedef unsigned long long haddr_t;
204 # define HADDR_UNDEF ((haddr_t)(long long)(-1))
205 # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG
206 # ifdef H5_HAVE_PARALLEL
207 # define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT
208 # endif /* H5_HAVE_PARALLEL */
209 #else
210 # error "nothing appropriate for haddr_t"
211 #endif
212 #if H5_SIZEOF_HADDR_T ==H5_SIZEOF_INT
213 # define H5_PRINTF_HADDR_FMT "%u"
214 #elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG
215 # define H5_PRINTF_HADDR_FMT "%lu"
216 #elif H5_SIZEOF_HADDR_T ==H5_SIZEOF_LONG_LONG
217 # define H5_PRINTF_HADDR_FMT "%" H5_PRINTF_LL_WIDTH "u"
218 #else
219 # error "nothing appropriate for H5_PRINTF_HADDR_FMT"
220 #endif
221 #define HADDR_MAX (HADDR_UNDEF-1)
222 
223 /* uint32_t type is used for creation order field for messages. It may be
224  * defined in Posix.1g, otherwise it is defined here.
225  */
226 #if H5_SIZEOF_UINT32_T>=4
227 #elif H5_SIZEOF_SHORT>=4
228  typedef short uint32_t;
229 # undef H5_SIZEOF_UINT32_T
230 # define H5_SIZEOF_UINT32_T H5_SIZEOF_SHORT
231 #elif H5_SIZEOF_INT>=4
232  typedef unsigned int uint32_t;
233 # undef H5_SIZEOF_UINT32_T
234 # define H5_SIZEOF_UINT32_T H5_SIZEOF_INT
235 #elif H5_SIZEOF_LONG>=4
236  typedef unsigned long uint32_t;
237 # undef H5_SIZEOF_UINT32_T
238 # define H5_SIZEOF_UINT32_T H5_SIZEOF_LONG
239 #else
240 # error "nothing appropriate for uint32_t"
241 #endif
242 
243 /* int64_t type is used for creation order field for links. It may be
244  * defined in Posix.1g, otherwise it is defined here.
245  */
246 #if H5_SIZEOF_INT64_T>=8
247 #elif H5_SIZEOF_INT>=8
248  typedef int int64_t;
249 # undef H5_SIZEOF_INT64_T
250 # define H5_SIZEOF_INT64_T H5_SIZEOF_INT
251 #elif H5_SIZEOF_LONG>=8
252  typedef long int64_t;
253 # undef H5_SIZEOF_INT64_T
254 # define H5_SIZEOF_INT64_T H5_SIZEOF_LONG
255 #elif H5_SIZEOF_LONG_LONG>=8
256  typedef long long int64_t;
257 # undef H5_SIZEOF_INT64_T
258 # define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG
259 #else
260 # error "nothing appropriate for int64_t"
261 #endif
262 
263 /* uint64_t type is used for fields for H5O_info_t. It may be
264  * defined in Posix.1g, otherwise it is defined here.
265  */
266 #if H5_SIZEOF_UINT64_T>=8
267 #elif H5_SIZEOF_INT>=8
268  typedef unsigned uint64_t;
269 # undef H5_SIZEOF_UINT64_T
270 # define H5_SIZEOF_UINT64_T H5_SIZEOF_INT
271 #elif H5_SIZEOF_LONG>=8
272  typedef unsigned long uint64_t;
273 # undef H5_SIZEOF_UINT64_T
274 # define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG
275 #elif H5_SIZEOF_LONG_LONG>=8
276  typedef unsigned long long uint64_t;
277 # undef H5_SIZEOF_UINT64_T
278 # define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG
279 #else
280 # error "nothing appropriate for uint64_t"
281 #endif
282 
283 /* Common iteration orders */
284 typedef enum {
285  H5_ITER_UNKNOWN = -1, /* Unknown order */
286  H5_ITER_INC, /* Increasing order */
287  H5_ITER_DEC, /* Decreasing order */
288  H5_ITER_NATIVE, /* No particular order, whatever is fastest */
289  H5_ITER_N /* Number of iteration orders */
291 
292 /* Iteration callback values */
293 /* (Actually, any postive value will cause the iterator to stop and pass back
294  * that positive value to the function that called the iterator)
295  */
296 #define H5_ITER_ERROR (-1)
297 #define H5_ITER_CONT (0)
298 #define H5_ITER_STOP (1)
299 
300 /*
301  * The types of indices on links in groups/attributes on objects.
302  * Primarily used for "<do> <foo> by index" routines and for iterating over
303  * links in groups/attributes on objects.
304  */
305 typedef enum H5_index_t {
306  H5_INDEX_UNKNOWN = -1, /* Unknown index type */
307  H5_INDEX_NAME, /* Index on names */
308  H5_INDEX_CRT_ORDER, /* Index on creation order */
309  H5_INDEX_N /* Number of indices defined */
310 } H5_index_t;
311 
312 /*
313  * Storage info struct used by H5O_info_t and H5F_info_t
314  */
315 typedef struct H5_ih_info_t {
316  hsize_t index_size; /* btree and/or list */
317  hsize_t heap_size;
318 } H5_ih_info_t;
319 
320 /* Functions in H5.c */
321 H5_DLL herr_t H5open(void);
322 H5_DLL herr_t H5close(void);
323 H5_DLL herr_t H5dont_atexit(void);
324 H5_DLL herr_t H5garbage_collect(void);
325 H5_DLL herr_t H5set_free_list_limits (int reg_global_lim, int reg_list_lim,
326  int arr_global_lim, int arr_list_lim, int blk_global_lim,
327  int blk_list_lim);
328 H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum,
329  unsigned *relnum);
330 H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum,
331  unsigned relnum);
332 H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts);
333 H5_DLL herr_t H5free_memory(void *mem);
334 H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
335 H5_DLL void *H5resize_memory(void *mem, size_t size);
336 
337 #ifdef __cplusplus
338 }
339 #endif
340 #endif /* _H5public_H */
341 
342 
#define H5_GCC_DIAG_OFF(x)
Definition: H5public.h:88
unsigned int hbool_t
Definition: H5public.h:142
H5_index_t
Definition: H5public.h:305
long long ssize_t
Definition: H5public.h:156
#define H5_DLL
Definition: H5api_adpt.h:256
struct H5_ih_info_t H5_ih_info_t
int herr_t
Definition: H5public.h:124
#define H5_GCC_DIAG_ON(x)
Definition: H5public.h:89
unsigned long long hsize_t
Definition: H5public.h:169
H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
uint64_t haddr_t
Definition: H5public.h:182
H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum)
H5_DLL herr_t H5dont_atexit(void)
H5_DLL herr_t H5garbage_collect(void)
hsize_t index_size
Definition: H5public.h:316
H5_iter_order_t
Definition: H5public.h:284
HDFFCLIBAPI intf * size
H5_DLL herr_t H5free_memory(void *mem)
H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts)
H5_DLL herr_t H5open(void)
signed long long hssize_t
Definition: H5public.h:170
H5_DLL herr_t H5set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim)
hsize_t heap_size
Definition: H5public.h:317
int htri_t
Definition: H5public.h:143
H5_DLL herr_t H5close(void)
H5_DLL void * H5resize_memory(void *mem, size_t size)
H5_DLL void * H5allocate_memory(size_t size, hbool_t clear)

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53