summaryrefslogtreecommitdiffstats
path: root/hl/src/H5LT.h
blob: f01e0121c998b67333f681f1f8b8d733b6120a83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the files COPYING and Copyright.html.  COPYING can be found at the root   *
 * of the source code distribution tree; Copyright.html can be found at the  *
 * root level of an installed copy of the electronic HDF5 document set and   *
 * is linked from the top-level documents page.  It can also be found at     *
 * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html.  If you do not have     *
 * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef _H5LT_H
#define _H5LT_H

#include <hdf5.h>


#ifndef FAIL
#define FAIL -1
#endif

#ifndef SUCCESS
#define SUCCESS 0
#endif

#define TESTING(WHAT)	{printf("%-70s", "Testing " WHAT); fflush(stdout);}
#define TESTING2(WHAT)  {printf("%-70s", "Testing     " WHAT); fflush(stdout);}
#define TESTING3(WHAT)  {printf("%-70s", "" WHAT); fflush(stdout);}
#define PASSED()	{puts(" PASSED");fflush(stdout);}
#define H5_FAILED()	{puts("*FAILED*");fflush(stdout);}
#define SKIPPED()	{puts(" -SKIP-");fflush(stdout);}
#define EXAMPLE(WHAT)	{printf("%-70s", "Example " WHAT); fflush(stdout);}


#ifdef __cplusplus
extern "C" {
#endif

/*-------------------------------------------------------------------------
 *
 * Make dataset functions
 *
 *-------------------------------------------------------------------------
 */

H5_HLDLL herr_t  H5LTmake_dataset( hid_t loc_id,
                         const char *dset_name,
                         int rank,
                         const hsize_t *dims,
                         hid_t type_id,
                         const void *buffer );

H5_HLDLL herr_t  H5LTmake_dataset_char( hid_t loc_id,
                              const char *dset_name,
                              int rank,
                              const hsize_t *dims,
                              const char *buffer );

H5_HLDLL herr_t  H5LTmake_dataset_short( hid_t loc_id,
                               const char *dset_name,
                               int rank,
                               const hsize_t *dims,
                               const short *buffer );

H5_HLDLL herr_t  H5LTmake_dataset_int( hid_t loc_id,
                             const char *dset_name,
                             int rank,
                             const hsize_t *dims,
                             const int *buffer );

H5_HLDLL herr_t  H5LTmake_dataset_long( hid_t loc_id,
                              const char *dset_name,
                              int rank,
                              const hsize_t *dims,
                              const long *buffer );

H5_HLDLL herr_t  H5LTmake_dataset_float( hid_t loc_id,
                               const char *dset_name,
                               int rank,
                               const hsize_t *dims,
                               const float *buffer );

H5_HLDLL herr_t  H5LTmake_dataset_double( hid_t loc_id,
                                const char *dset_name,
                                int rank,
                                const hsize_t *dims,
                                const double *buffer );

H5_HLDLL herr_t  H5LTmake_dataset_string( hid_t loc_id,
                               const char *dset_name,
                               const char *buf );


/*-------------------------------------------------------------------------
 *
 * Read dataset functions
 *
 *-------------------------------------------------------------------------
 */

H5_HLDLL herr_t  H5LTread_dataset( hid_t loc_id,
                         const char *dset_name,
                         hid_t type_id,
                         void *buffer );

H5_HLDLL herr_t  H5LTread_dataset_char( hid_t loc_id,
                              const char *dset_name,
                              char *buffer );

H5_HLDLL herr_t  H5LTread_dataset_short( hid_t loc_id,
                               const char *dset_name,
                               short *buffer );

H5_HLDLL herr_t  H5LTread_dataset_int( hid_t loc_id,
                             const char *dset_name,
                             int *buffer );

H5_HLDLL herr_t  H5LTread_dataset_long( hid_t loc_id,
                              const char *dset_name,
                              long *buffer );

H5_HLDLL herr_t  H5LTread_dataset_float( hid_t loc_id,
                               const char *dset_name,
                               float *buffer );

H5_HLDLL herr_t  H5LTread_dataset_double( hid_t loc_id,
                                const char *dset_name,
                                double *buffer );

H5_HLDLL herr_t  H5LTread_dataset_string( hid_t loc_id,
                                const char *dset_name,
                                char *buf );

/*-------------------------------------------------------------------------
 *
 * Query dataset functions
 *
 *-------------------------------------------------------------------------
 */


H5_HLDLL herr_t  H5LTget_dataset_ndims( hid_t loc_id,
                             const char *dset_name,
                             int *rank );

H5_HLDLL herr_t  H5LTget_dataset_info( hid_t loc_id,
                             const char *dset_name,
                             hsize_t *dims,
                             H5T_class_t *type_class,
                             size_t *type_size );

H5_HLDLL herr_t  H5LTfind_dataset( hid_t loc_id, const char *name );



/*-------------------------------------------------------------------------
 *
 * Set attribute functions
 *
 *-------------------------------------------------------------------------
 */


H5_HLDLL herr_t  H5LTset_attribute_string( hid_t loc_id,
                                 const char *obj_name,
                                 const char *attr_name,
                                 const char *attr_data );

H5_HLDLL herr_t  H5LTset_attribute_char( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               const char *buffer,
                               size_t size );

H5_HLDLL herr_t  H5LTset_attribute_uchar( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               const unsigned char *buffer,
                               size_t size );

H5_HLDLL herr_t  H5LTset_attribute_short( hid_t loc_id,
                              const char *obj_name,
                              const char *attr_name,
                              const short *buffer,
                              size_t size );

H5_HLDLL herr_t  H5LTset_attribute_ushort( hid_t loc_id,
                              const char *obj_name,
                              const char *attr_name,
                              const unsigned short *buffer,
                              size_t size );

H5_HLDLL herr_t  H5LTset_attribute_int( hid_t loc_id,
                              const char *obj_name,
                              const char *attr_name,
                              const int *buffer,
                              size_t size );

H5_HLDLL herr_t  H5LTset_attribute_uint( hid_t loc_id,
                              const char *obj_name,
                              const char *attr_name,
                              const unsigned int *buffer,
                              size_t size );

H5_HLDLL herr_t  H5LTset_attribute_long( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               const long *buffer,
                               size_t size );

H5_HLDLL herr_t  H5LTset_attribute_long_long( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               const long_long *buffer,
                               size_t size );

H5_HLDLL herr_t  H5LTset_attribute_ulong( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               const unsigned long *buffer,
                               size_t size );

H5_HLDLL herr_t  H5LTset_attribute_float( hid_t loc_id,
                                const char *obj_name,
                                const char *attr_name,
                                const float *buffer,
                                size_t size );

H5_HLDLL herr_t  H5LTset_attribute_double( hid_t loc_id,
                                 const char *obj_name,
                                 const char *attr_name,
                                 const double *buffer,
                                 size_t size );

/*-------------------------------------------------------------------------
 *
 * Get attribute functions
 *
 *-------------------------------------------------------------------------
 */

H5_HLDLL herr_t  H5LTget_attribute( hid_t loc_id,
                          const char *obj_name,
                          const char *attr_name,
                          hid_t mem_type_id,
                          void *data );

H5_HLDLL herr_t  H5LTget_attribute_string( hid_t loc_id,
                                 const char *obj_name,
                                 const char *attr_name,
                                 char *data );

H5_HLDLL herr_t  H5LTget_attribute_char( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               char *data );

H5_HLDLL herr_t  H5LTget_attribute_uchar( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               unsigned char *data );

H5_HLDLL herr_t  H5LTget_attribute_short( hid_t loc_id,
                                const char *obj_name,
                                const char *attr_name,
                                short *data );

H5_HLDLL herr_t  H5LTget_attribute_ushort( hid_t loc_id,
                                const char *obj_name,
                                const char *attr_name,
                                unsigned short *data );

H5_HLDLL herr_t  H5LTget_attribute_int( hid_t loc_id,
                              const char *obj_name,
                              const char *attr_name,
                              int *data );

H5_HLDLL herr_t  H5LTget_attribute_uint( hid_t loc_id,
                              const char *obj_name,
                              const char *attr_name,
                              unsigned int *data );

H5_HLDLL herr_t  H5LTget_attribute_long( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               long *data );

H5_HLDLL herr_t  H5LTget_attribute_long_long( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               long_long *data );

H5_HLDLL herr_t  H5LTget_attribute_ulong( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               unsigned long *data );

H5_HLDLL herr_t  H5LTget_attribute_float( hid_t loc_id,
                                const char *obj_name,
                                const char *attr_name,
                                float *data );

H5_HLDLL herr_t  H5LTget_attribute_double( hid_t loc_id,
                                 const char *obj_name,
                                 const char *attr_name,
                                 double *data );


/*-------------------------------------------------------------------------
 *
 * Query attribute functions
 *
 *-------------------------------------------------------------------------
 */


H5_HLDLL herr_t  H5LTget_attribute_ndims( hid_t loc_id,
                                const char *obj_name,
                                const char *attr_name,
                                int *rank );

H5_HLDLL herr_t  H5LTget_attribute_info( hid_t loc_id,
                               const char *obj_name,
                               const char *attr_name,
                               hsize_t *dims,
                               H5T_class_t *type_class,
                               size_t *type_size );





/*-------------------------------------------------------------------------
 *
 * General functions
 *
 *-------------------------------------------------------------------------
 */


H5_HLDLL hid_t H5LTcreate_compound_type( hsize_t nfields, size_t size, const char *field_names[],
                                const size_t *field_offset, const hid_t *field_types );

hid_t H5LTtext_to_dtype(const char *text);

H5_HLDLL herr_t  H5LTrepack( hsize_t nfields,
                   hsize_t nrecords,
                   size_t src_size,
                   const size_t *src_offset,
                   const size_t *src_sizes,
                   size_t dst_size,
                   const size_t *dst_offset,
                   const size_t *dst_sizes,
                   unsigned char *src_buf,
                   unsigned char *dst_buf );



/*-------------------------------------------------------------------------
 *
 * Private functions
 *
 *-------------------------------------------------------------------------
 */


H5_HLDLL herr_t  H5LT_get_attribute_mem( hid_t obj_id,
                           const char *attr_name,
                           hid_t mem_type_id,
                           void *data );

H5_HLDLL herr_t  H5LT_get_attribute_disk( hid_t obj_id,
                           const char *attr_name,
                           void *data );

H5_HLDLL herr_t  H5LT_find_attribute( hid_t loc_id, const char *name );


H5_HLDLL herr_t  H5LT_set_attribute_numerical( hid_t loc_id,
                                     const char *obj_name,
                                     const char *attr_name,
                                     size_t size,
                                     hid_t type_id,
                                     const void *data );

H5_HLDLL herr_t  H5LT_set_attribute_string( hid_t dset_id,
                                 char *name,
                                 char *buf );




#ifdef __cplusplus
}
#endif

#endif