Changeset 6f53da8
- Timestamp:
- Dec 29, 2021, 5:52:03 PM (3 years ago)
- Branches:
- feature/crepe
- Children:
- 1c2ccea
- Parents:
- 1666945
- git-author:
- Paul Brossier <piem@piem.org> (01/29/19 04:06:41)
- git-committer:
- Paul Brossier <piem@piem.org> (12/29/21 17:52:03)
- Location:
- src/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/file_hdf5.c
r1666945 r6f53da8 36 36 #endif 37 37 38 #define MAX_DEPTH 100 39 38 40 struct _aubio_file_hdf5_t { 39 41 const char_t *path; … … 49 51 if (f->fid <= 0) goto failure; 50 52 53 // TODO keep a copy 51 54 f->path = path; 55 56 //AUBIO_DBG("file_hdf5: opened %s\n", f->path); 57 //aubio_file_hdf5_list(f); 58 52 59 return f; 53 60 … … 121 128 } 122 129 130 static herr_t aubio_file_hdf5_iterate(hid_t loc_id, const char *name, 131 const H5L_info_t *info UNUSED, void *opdata) 132 { 133 H5O_info_t infobuf; 134 const char_t *type_name; 135 uint_t *depth = (uint_t *)opdata; 136 herr_t err = H5Oget_info_by_name(loc_id, name, &infobuf, H5P_DEFAULT); 137 if (err < 0) goto failure; 138 if (*depth > MAX_DEPTH) goto failure; 139 switch (infobuf.type) { 140 case H5O_TYPE_GROUP: 141 type_name = "group"; 142 break; 143 case H5O_TYPE_DATASET: 144 type_name = "dataset"; 145 break; 146 case H5O_TYPE_NAMED_DATATYPE: 147 type_name = "datatype"; 148 break; 149 default: 150 type_name = "unknown"; 151 break; 152 } 153 AUBIO_MSG("%*s %s (%s)\n", *depth, "-", name, type_name); 154 if (infobuf.type == H5O_TYPE_GROUP) { 155 uint_t d = *depth + 1; 156 err = H5Literate_by_name(loc_id, name, H5_INDEX_NAME, H5_ITER_NATIVE, 157 NULL, aubio_file_hdf5_iterate, &d, H5P_DEFAULT); 158 } 159 failure: 160 return err; 161 } 162 163 void aubio_file_hdf5_list(aubio_file_hdf5_t *f) 164 { 165 uint_t depth = 1; 166 herr_t err = H5Literate(f->fid, H5_INDEX_NAME, H5_ITER_NATIVE, 167 NULL, aubio_file_hdf5_iterate, &depth); 168 if (err < 0) 169 AUBIO_ERR("file_hdf5: failed iterating into %s\n", f->path); 170 } 171 123 172 void del_aubio_file_hdf5(aubio_file_hdf5_t *f) 124 173 { -
src/io/file_hdf5.h
r1666945 r6f53da8 28 28 void del_aubio_file_hdf5(aubio_file_hdf5_t *f); 29 29 30 void aubio_file_hdf5_list(aubio_file_hdf5_t *f); 31 30 32 uint_t aubio_file_hdf5_load_dataset_into_tensor (aubio_file_hdf5_t *f, 31 33 const char_t *key, aubio_tensor_t *tensor);
Note: See TracChangeset
for help on using the changeset viewer.