MEDfileObjectExist.c
Aller à la documentation de ce fichier.
/* This file is part of MED.
*
* COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
* MED is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MED is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MED. If not, see <http://www.gnu.org/licenses/>.
*/
#include <med.h>
#include <med_config.h>
#include <med_outils.h>
#include <string.h>
/*
Les objets de class medclass dont il est ici question sont représentés par des noms de groupes
dans le modèle HDF.
*/
#define MY_CASE(OBJ)\
case MED_##OBJ :\
strcpy(_link,MED_##OBJ##_GRP);\
_objsize = MED_##OBJ##_GRP_SIZE;\
break;
med_err
MEDfileObjectExist(const med_idt fid,
const med_class medclass,
const char * const objectname,
med_bool * const objectexist )
{
med_idt _fid = 0;
med_err _ret = -1;
char _link[2*MED_NAME_SIZE+1]="";
med_bool _datagroupexist=MED_FALSE,_isasoftlink=MED_FALSE;
int _objsize = 0;
/*
* On inhibe le gestionnaire d'erreur HDF
*/
_MEDmodeErreurVerrouiller();
*objectexist = MED_FALSE;
/*
* Give access to the class object in the local file
*/
switch(medclass) {
MY_CASE(MESH);
MY_CASE(MESH_SUPPORT);
MY_CASE(ELSTRUCT);
MY_CASE(FAMILY);
MY_CASE(EQUIVALENCE);
MY_CASE(JOINT);
MY_CASE(FIELD);
MY_CASE(LOCALIZATION);
MY_CASE(PROFILE);
MY_CASE(INTERPOLATION);
MY_CASE(NUMERICAL_DATA);
default :
MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_CLASS,_link);
goto ERROR;
}
strncpy(_link+_objsize,objectname,MED_NAME_SIZE+1);
_link[2*MED_NAME_SIZE]='\0';
if( _MEDdatagroupExist(fid,_link,&_datagroupexist,&_isasoftlink) < 0 ) {
MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDdatagroupExist");
SSCRUTE(_link);goto ERROR;
}
if ( _datagroupexist ) *objectexist = MED_TRUE;
_ret=0;
ERROR:
return _ret;
}
MY_CASE
#define MY_CASE(OBJ)
Definition MEDfileObjectExist.c:30
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition build.python3.12/include/med.h:81
med_bool
med_bool
Definition build.python3.12/include/med.h:260
MED_FALSE
@ MED_FALSE
Definition build.python3.12/include/med.h:260
MED_TRUE
@ MED_TRUE
Definition build.python3.12/include/med.h:260
med_class
med_class
Definition build.python3.12/include/med.h:188
med_err
herr_t med_err
Definition build.python3.12/include/med.h:323
med_idt
hid_t med_idt
Definition build.python3.12/include/med.h:322
MED_ERR_
#define MED_ERR_(rt, r1, r2, r3)
Definition build.python3.12/include/med_utils.h:160
SSCRUTE
#define SSCRUTE(chaine)
Definition build.python3.12/include/med_utils.h:323
MEDfileObjectExist
med_err MEDfileObjectExist(const med_idt fid, const med_class medclass, const char *const objectname, med_bool *const objectexist)
Interroge le fichier fid pour tester l'existence de l'objet objectname de type medclass.
Definition MEDfileObjectExist.c:47
MED_ERR_CLASS
#define MED_ERR_CLASS
Definition med_err.h:130
MED_ERR_CALL
#define MED_ERR_CALL
Definition med_err.h:48
MED_ERR_API
#define MED_ERR_API
Definition med_err.h:111
MED_ERR_RANGE
#define MED_ERR_RANGE
Definition med_err.h:34
_MEDmodeErreurVerrouiller
MEDC_EXPORT void _MEDmodeErreurVerrouiller(void)
_MEDdatagroupExist
MEDC_EXPORT med_err _MEDdatagroupExist(const med_idt gid, const char *const datagroupname, med_bool *const datagroupexist, med_bool *const isasoftlink)
med_outils.h