_MEDparameterInfoByName236.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2011  EDF R&D, CEA/DEN
00004  *  MED is free software: you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation, either version 3 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  MED is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 
00019 #include "med_config.h"
00020 #include <med.h>
00021 #include "med_outils.h"
00022 #include <string.h>
00023 
00024 #include <2.3.6/med23v30.h>
00025 #include <2.3.6/med23v30_proto.h>
00026 #include "2.3.6/med23v30_misc.h"
00027 
00028 
00029 void _MEDparameterInfoByName236(int dummy, ...) {
00030 
00031 
00032   med_err  _ret=-1,_err=0;
00033   med_idt  _paramidt=0,_cpstid=0;
00034   char     _path[MED_TAILLE_NUM_DATA+MED_TAILLE_NOM+1+1]=MED_NUM_DATA;
00035   char     _cpstname[2*MED_MAX_PARA+1]="";
00036   med_size _nstep=0;
00037   med_int  _intparamtype=0;
00038 
00039   MED_VARGS_DECL(const, med_idt              , , fid         );
00040   MED_VARGS_DECL(const, char   *       , const , paramname   );
00041   MED_VARGS_DECL(, med_parameter_type *, const , paramtype   );
00042   MED_VARGS_DECL(, char *              , const , description );
00043   MED_VARGS_DECL(, char *              , const , dtunit      );
00044   MED_VARGS_DECL(, med_int *           , const , nstep       );
00045   MED_VARGS_DECL(, med_err *                  ,, fret        );
00046 
00047   va_list params;
00048   va_start(params,dummy);
00049 
00050   MED_VARGS_DEF(const, med_idt              , , fid         );
00051   MED_VARGS_DEF(const, char   *       , const , paramname   );
00052   MED_VARGS_DEF(, med_parameter_type *, const , paramtype   );
00053   MED_VARGS_DEF(, char *              , const , description );
00054   MED_VARGS_DEF(, char *              , const , dtunit      );
00055   MED_VARGS_DEF(, med_int *           , const , nstep       );
00056   MED_VARGS_DEF(, med_err *                  ,, fret        );
00057 
00058   /*
00059    * On inhibe le gestionnaire d'erreur HDF 5
00060    */
00061   _MEDmodeErreurVerrouiller();
00062 
00063   /*
00064    * On construit le chemin d'acces
00065    */
00066   strcat(_path,paramname);
00067   strcat(_path,"/");
00068 
00069   if ((_err=_MEDnObjects(fid, _path, &_nstep)) < 0 )
00070     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
00071       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_path);
00072       goto ERROR;
00073     }
00074   *nstep=(med_int) _nstep;
00075 
00076   if ((_paramidt = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00077     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00078     goto ERROR;
00079   }
00080 
00081   /*
00082    * L'attribut "TYP"
00083    */
00084   if ( _MEDattrEntierLire(_paramidt, MED_NOM_TYP, &_intparamtype) < 0) {
00085     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00086     SSCRUTE(MED_NOM_TYP);ISCRUTE(_intparamtype);
00087     goto ERROR;
00088   }
00089   *paramtype = (med_parameter_type) _intparamtype;
00090 
00091   /*
00092    * L'attribut DES
00093    */
00094   if ( _MEDattrStringLire(_paramidt,MED_NOM_DES,MED_TAILLE_DESC,description) < 0) {
00095     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00096     SSCRUTE(MED_NOM_DES);SSCRUTE(description);
00097     goto ERROR;
00098   }
00099 
00100   if ( _MEDobjectGetName( _paramidt,".",0,_cpstname) < 0 ) {
00101     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);SSCRUTE(_cpstname);
00102     goto ERROR;
00103   }
00104 
00105 
00106   /* Lecture de l'attribut MED_NOM_UNI */
00107   if ( _MEDattributeStringRdByName(_paramidt,_cpstname,MED_NOM_UNI,MED_TAILLE_PNOM,dtunit) < 0) {
00108     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00109     SSCRUTE(_cpstname);SSCRUTE(MED_NOM_UNI);SSCRUTE(dtunit);goto ERROR;
00110   }
00111 
00112  _ret = 0;
00113 
00114  ERROR:
00115 
00116 
00117  if (_paramidt>0)         if (_MEDdatagroupFermer(_paramidt) < 0) {
00118    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00119    ISCRUTE_id(_paramidt);
00120  }
00121 
00122   va_end(params);
00123   *fret = _ret;
00124   return;
00125 }

Généré le Mon Nov 7 16:21:23 2011 pour MED fichier par  doxygen 1.6.1