ESDM
Middleware for Earth System Data
memvol-internal.h
1 // This file is part of h5-memvol.
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU Lesser General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with h5-memvol. If not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef H5_MEMVOL_INTERNAL_HEADER__
17 #define H5_MEMVOL_INTERNAL_HEADER__
18 
19 
20 #include <stdlib.h>
21 #include <string.h>
22 
23 #include <glib.h>
24 
25 #define DEBUG_INTERNALS // for now...
26 
27 #ifdef DEBUG
28 # define debug(...) fprintf(stderr, "[MEMVOL DEBUG] "__VA_ARGS__);
29 #else
30 # define debug(...)
31 #endif
32 
33 #ifdef DEBUG_INTERNALS
34 # define debugI(...) fprintf(stderr, "[MEMVOL DEBUG I] "__VA_ARGS__);
35 #else
36 # define debugI(...)
37 #endif
38 
39 #define critical(...) \
40  { \
41  fprintf(stderr, "[MEMVOL CRITICAL] "__VA_ARGS__); \
42  exit(1); \
43  }
44 #define warn(...) fprintf(stderr, "[MEMVOL WARN] "__VA_ARGS__);
45 
46 #define FUNC_START debug("CALL %s\n", __PRETTY_FUNCTION__);
47 
48 /* HDF5 related integer defintions e.g. as required for herr_t */
49 
50 #define SUCCEED 0
51 
52 typedef enum type {
53  MEMVOL_FILE,
54  MEMVOL_GROUP,
55  MEMVOL_DATASET,
56  MEMVOL_ATTRIBUTE,
57  MEMVOL_DATASPACE,
58  MEMVOL_DATATYPE
59 } memvol_object_type_t;
60 
61 typedef struct {
62  hid_t dscpl_id;
63  int dim;
65 
66 typedef struct memvol_link_t {
67  hid_t dummy;
68  // TODO: consolidate with object?
70 
71 typedef struct memvol_attribute_t {
72  hid_t acpl_id;
73  hid_t aapl_id;
74  hid_t dxpl_id;
76 
77 typedef struct memvol_type_t {
78  hid_t lcpl_id;
79  hid_t tcpl_id;
80  hid_t tapl_id;
81  hid_t dxpl_id;
83 
84 typedef struct memvol_dataset_t {
85  hid_t dcpl_id;
86  hid_t dapl_id;
87  hid_t dxpl_id;
88  char *name;
89  //H5VL_loc_params_t loc_params;
90  hid_t dataspace;
91  hid_t type;
93 
94 typedef struct memvol_groupt_t {
95  GHashTable *childs_tbl;
96  GArray *childs_ord_by_index_arr;
97  hid_t gcpl_id;
98  hid_t gapl_id;
99  hid_t dxpl_id;
100  char *name;
102 
103 typedef struct memvol_file_t {
104  memvol_group_t root_grp; // it must start with the root group, since in many cases we cast files to groups
105  char *name;
106  int mode_flags; // RDWR etc.
107  hid_t fcpl_id;
108  hid_t fapl_id;
109  hid_t dxpl_id;
110 
111 } memvol_file_t;
112 
113 typedef struct memvol_object_t {
114  memvol_object_type_t type;
115  void *object;
116  /* union {
117  memvol_group_t* group;
118  memvol_dataset_t* dataset;
119  memvol_type_t* type;
120  } object; */
122 
123 static void memvol_group_init(memvol_group_t *group);
124 
125 #endif
Definition: memvol-internal.h:71
Definition: memvol-internal.h:84
Definition: memvol-internal.h:61
Definition: memvol-internal.h:103
Definition: memvol-internal.h:94
Definition: memvol-internal.h:113
Definition: memvol-internal.h:77