1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2019 EDF R&D, CEA/DEN
4 * MED is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * MED is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with MED. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18
19 #include <med.h>
20 #include <med_config.h>
21 #include <med_outils.h>
22 #include <hdf5.h>
23
24
25 extern med_err _MEDcopyName(med_idt id,const char *lname, const H5L_info_t *linfo, void *data);
26
27 med_err
__MEDobjectGetName(const med_idt fid,const char * const path,const med_size ind,char * name,const H5_index_t index_type,const H5_iter_order_t order)28 __MEDobjectGetName(const med_idt fid, const char * const path, const med_size ind, char *name,
29 const H5_index_t index_type, const H5_iter_order_t order
30 )
31 {
32
33 med_err _ret=-1;
34 med_size _n;
35 med_idt _gid1=0;
36 hsize_t _ind=0;
37 /*
38 * On inhibe le gestionnaire d'erreur HDF 5
39 */
40 _MEDmodeErreurVerrouiller();
41
42 /* old fashion */
43 /* if ((idx = H5Giterate(fid,path,&ind,_MEDindiceInfo, */
44 /* nom)) < 0) */
45 /* return -1; */
46
47
48
49 /* if ( (_gid1 = H5Gopen(fid,path)) < 0 ) { */
50 /* MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,path); */
51 /* goto ERROR; */
52 /* } */
53
54 /* if ( H5Literate(_gid1, index_type, order, (hsize_t *) &ind, _MEDcopyName, name ) < 0 ) { */
55 /* MED_ERR_(_ret,MED_ERR_VISIT,MED_ERR_DATAGROUP,path); */
56 /* H5Eprint1(stderr); */
57 /* goto ERROR; */
58 /* } */
59
60 if ( H5Literate_by_name(fid,path, index_type, order, (hsize_t *) &ind, _MEDcopyName, name,H5P_DEFAULT ) < 0 ) {
61 MED_ERR_(_ret,MED_ERR_VISIT,MED_ERR_DATAGROUP,path);
62 /* H5Eprint1(stderr); */
63 goto ERROR;
64 }
65
66
67 /* Ne foctionne pas avec les liens soft */
68 /* _n = H5Lget_name_by_idx(fid, path, H5_INDEX_NAME, H5_ITER_NATIVE, */
69 /* ind, NULL, MED_NAME_SIZE,H5P_DEFAULT ); */
70
71 /* ISCRUTE_long(_n); */
72 /* if ( ((long ) _n ) < 0 ) { */
73 /* MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,path);ISCRUTE(ind); */
74 /* H5Eprint1(stderr); */
75 /* goto ERROR; */
76 /* } */
77 /* ISCRUTE_long(_n); */
78 /* _n++; */
79 /* if ( H5Lget_name_by_idx(fid, path, H5_INDEX_NAME, H5_ITER_NATIVE, */
80 /* ind, name, _n,H5P_DEFAULT ) < 0) { */
81 /* MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,path);ISCRUTE(ind); */
82 /* H5Eprint1(stderr); */
83 /* goto ERROR; */
84 /* } */
85 /* SSCRUTE(name); */
86
87 _ret = 0;
88 ERROR:
89
90 if (_gid1>0) if ( H5Gclose(_gid1) < 0) {
91 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,path);
92 ISCRUTE_id(_gid1);
93 }
94
95 return _ret;
96 }
97
98