MED fichier
MEDfileObjectDescriptionExistByPath.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2  *
3  * COPYRIGHT (C) 1999 - 2023 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 
23 #include <string.h>
24 
25 
37 med_err
39  med_path * const medpath,
40  med_bool * const descriptionexist)
41 {
42  med_err _ret = -1;
43  /* int _i = 0; */
44  med_bool _descriptionexist=MED_FALSE;
45  med_bool _datagroupexist = MED_FALSE;
46  med_bool _isasoftlink = MED_FALSE;
47 
48  /*
49  * On inhibe le gestionnaire d'erreur HDF
50  */
52 
53  *descriptionexist = MED_FALSE;
54 
55  if ( _MEDgetObjectStringPath(medpath) < 0 ) {
56  MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDgetObjectStringPath");
57  ISCRUTE(medpath->medclass);
58  ISCRUTE(medpath->nname);
59  /* for (_i=0;_i<medpath->nname;++_i) { */
60  /* SSCRUTE(medpath->name[_i]); */
61  /* } */
62  goto ERROR;
63  }
64 
65  if (_MEDdatagroupExist(fid,
66  medpath->_datagroupname,
67  &_datagroupexist,
68  &_isasoftlink ) <0 ) {
69  MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDdatagroupExist");
70  SSCRUTE(medpath->_datagroupname);
71  goto ERROR;
72  }
73 
74  if ( !_datagroupexist ) goto SORTIE;
75 
76  if ( _MEDattributeExist(fid,
77  medpath->_datagroupname,
79  &_descriptionexist ) <0 ) {
80  /* MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDattributeExist"); */
81  /* SSCRUTE(medpath->_datagroupname); */
82  goto SORTIE;
83  }
84 
85  if ( _descriptionexist ) *descriptionexist = MED_TRUE;
86 
87 
88  SORTIE:
89 
90  _ret=0;
91 
92  ERROR:
93 
94  return _ret;
95 }
MED_ERR_API
#define MED_ERR_API
Definition: med_err.h:111
med_path
Aggrégation de noms medfichier pour définir un chemin d'accès aux objets med de type class med_class.
Definition: med.h:356
MEDfileObjectDescriptionExistByPath
med_err MEDfileObjectDescriptionExistByPath(const med_idt fid, med_path *const medpath, med_bool *const descriptionexist)
Interroge le fichier fid pour tester l'existence d'une description associée à l'objet accessible par ...
Definition: MEDfileObjectDescriptionExistByPath.c:38
med_err
herr_t med_err
Definition: med.h:336
MED_TRUE
Definition: med.h:264
med_config.h
MED_ERR_
#define MED_ERR_(rt, r1, r2, r3)
Definition: med_utils.h:160
med_idt
hid_t med_idt
Definition: med.h:335
med_path::nname
med_int nname
Definition: med.h:359
med_path::medclass
med_class medclass
Definition: med.h:358
ISCRUTE
#define ISCRUTE(entier)
Definition: med_utils.h:313
med_bool
med_bool
Definition: med.h:264
_MEDgetObjectStringPath
MEDC_EXPORT med_err _MEDgetObjectStringPath(med_path *const medpath)
MED_ERR_CALL
#define MED_ERR_CALL
Definition: med_err.h:48
med_outils.h
med_path::_datagroupname
char _datagroupname[MED_MAX_DATAGROUPNAME_IN_PATH+1]
Definition: med.h:362
SSCRUTE
#define SSCRUTE(chaine)
Definition: med_utils.h:323
_MEDattributeExist
MEDC_EXPORT med_err _MEDattributeExist(const med_idt gid, const char *const datagroupname, const char *const attributename, med_bool *const attributeexist)
med.h
MED_NOM_DES
#define MED_NOM_DES
Definition: med_outils.h:53
_MEDdatagroupExist
MEDC_EXPORT med_err _MEDdatagroupExist(const med_idt gid, const char *const datagroupname, med_bool *const datagroupexist, med_bool *const isasoftlink)
MED_FALSE
Definition: med.h:264
_MEDmodeErreurVerrouiller
MEDC_EXPORT void _MEDmodeErreurVerrouiller(void)