OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
h5io.h
Go to the documentation of this file.
1 /*******************************************************************
2 
3  h5io.h
4 
5  purpose: include file for the use of the hdf I/O routine aids
6 
7  Parameters:
8  Type Name I/O Description
9  ---- ---- --- -----------
10 
11  Modification history:
12  Programmer Date Description of change
13  ---------- ---- ---------------------
14  W. Robinson, SAIC 23-Sep-2008 Original development
15  S. Bailey, Futuretech 01-Nov-2010 removed malloc.h header file
16  *******************************************************************/
17 
18 #ifndef __H5IO_H__
19 #define __H5IO_H__
20 /*
21  * Note that hdf5.h is needed for this
22  */
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdlib.h>
26 #include <hdf5.h>
27 
28 #define H5IO_MAXDIM 6 /* the max # dimensions handled currently */
29 
30 /* Identify the type of ID the h5io_str is */
31 #define H5IO_TYP_FILE_ID 0 /* this is a file ID */
32 #define H5IO_TYP_GRP_ID 1 /* this is a group ID */
33 #define H5IO_TYP_DAT_ID 2 /* this is a dataset ID */
34 #define H5IO_DAT_RWALL 0 /* When read/write dataset, do all */
35 #define H5IO_DAT_RWSLICE 1 /* When read/write dataset, do slices */
36 
37 /*
38  * There are several HDF 5 IDs handles needed for steps in the I/O and
39  * different ones in this structure are set depending on the operation.
40  * The type will determine which is set and can be used to make sure the
41  * proper id is in use for the proper operation.
42  */
43 struct h5io_str_d {
44  int type;
45  hid_t file_id; /* set with type H5IO_TYP_FILE_ID */
46  hid_t grp_id; /* set with type H5IO_TYP_FILE_ID or H5IO_TYP_GRP_ID */
47  hid_t dat_id; /* set with type H5IO_TYP_DAT_ID */
48  int dat_rw_mode; /* data read / write mode: either all or in slices, */
49  /* with several calls to do entire I/O */
50  /* defaults to all = H5IO_DAT_RWALL on open of dataset */
51  hid_t fil_space_id; /* descriptors for slab I/O - these are only set*/
52  hid_t mem_space_id; /* (and freed) if dat_rw_mode = H5IO_DAT_RWSLICE */
53  hid_t native_typ; /* needed for repeated I/O */
54  int prev_ndim; /* # dims of the dataset just needed for ref */
55  hsize_t prev_count[ H5IO_MAXDIM ]; /* make sure slab read set right for
56  next read */
57 };
58 
59 typedef struct h5io_str_d h5io_str;
60 
61 /*
62  * prototypes
63  */
64 int h5io_openw(char *, int, h5io_str *);
65 int h5io_openr(char *, int, h5io_str *);
66 int h5io_rd_attr(h5io_str *, char *, void *);
67 int h5io_set_grp(h5io_str *, char *, h5io_str *);
68 int h5io_set_ds(h5io_str *, char *, h5io_str *);
69 int h5io_rd_ds(h5io_str *, void *);
70 int h5io_rd_ds_slice(h5io_str *, int *, int *, void *);
71 int h5io_close(h5io_str *);
72 int h5io_mk_grp(h5io_str *, char *, h5io_str *);
73 int h5io_mk_ds(h5io_str *, char *, hid_t, int, int *, h5io_str *);
74 int h5io_wr_attr(h5io_str *, char *, hid_t, int, int *, void *);
75 int h5io_wr_attr_str(h5io_str *, char *, int, int *, int, char *);
76 int h5io_wr_ds(h5io_str *, void *);
77 int h5io_wr_ds_slice(h5io_str *, int *, int *, void *);
78 int h5io_attr_exist(h5io_str *, char *);
79 /* currently, h5io_info will do this job but keep as backup
80 int h5io_attr_info( h5io_str *, char *, H5T_class_t *, hid_t *, int*,
81  int *, int * );
82  */
83 int h5io_info(h5io_str *, char *, H5T_class_t *, hid_t *, int*,
84  int *, int *);
85 int h5io_grab_ds(h5io_str *, char *, void *);
86 int h5io_grab_ds_slice(h5io_str *, char *, int *, int *, void *);
87 int h5io_grp_contents(h5io_str *, int *, char ***, int **);
88 int h5io_inq_path(h5io_str *, char *, int *);
89 
90 #endif // __H5IO_H__
hid_t grp_id
Definition: h5io.h:46
int h5io_mk_grp(h5io_str *, char *, h5io_str *)
Definition: h5io.c:778
int h5io_rd_ds(h5io_str *, void *)
Definition: h5io.c:505
int dat_rw_mode
Definition: h5io.h:48
hid_t mem_space_id
Definition: h5io.h:52
int h5io_rd_ds_slice(h5io_str *, int *, int *, void *)
Definition: h5io.c:602
int h5io_info(h5io_str *, char *, H5T_class_t *, hid_t *, int *, int *, int *)
Definition: h5io.c:173
int h5io_wr_ds(h5io_str *, void *)
Definition: h5io.c:1094
int h5io_rd_attr(h5io_str *, char *, void *)
Definition: h5io.c:412
int h5io_wr_attr(h5io_str *, char *, hid_t, int, int *, void *)
Definition: h5io.c:922
int h5io_openr(char *, int, h5io_str *)
Definition: h5io.c:4
int h5io_set_ds(h5io_str *, char *, h5io_str *)
Definition: h5io.c:324
int h5io_grab_ds(h5io_str *, char *, void *)
Definition: h5io.c:1347
#define H5IO_MAXDIM
Definition: h5io.h:28
int h5io_grp_contents(h5io_str *, int *, char ***, int **)
Definition: h5io.c:1506
int h5io_wr_attr_str(h5io_str *, char *, int, int *, int, char *)
Definition: h5io.c:1006
int h5io_openw(char *, int, h5io_str *)
Definition: h5io.c:68
int type
Definition: h5io.h:44
int prev_ndim
Definition: h5io.h:54
int h5io_grab_ds_slice(h5io_str *, char *, int *, int *, void *)
Definition: h5io.c:1396
int h5io_mk_ds(h5io_str *, char *, hid_t, int, int *, h5io_str *)
Definition: h5io.c:821
int h5io_attr_exist(h5io_str *, char *)
Definition: h5io.c:1451
hid_t file_id
Definition: h5io.h:45
int h5io_wr_ds_slice(h5io_str *, int *, int *, void *)
Definition: h5io.c:1175
hid_t fil_space_id
Definition: h5io.h:51
hid_t native_typ
Definition: h5io.h:53
int h5io_set_grp(h5io_str *, char *, h5io_str *)
Definition: h5io.c:369
hsize_t prev_count[H5IO_MAXDIM]
Definition: h5io.h:55
hid_t dat_id
Definition: h5io.h:47
int h5io_close(h5io_str *)
Definition: h5io.c:115
int h5io_inq_path(h5io_str *, char *, int *)
Definition: h5io.c:1604