_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   va_list params;
00032   va_start(params,dummy);
00033 
00034   const med_idt              fid         = va_arg(params,const med_idt               );
00035   const char   *       const paramname   = va_arg(params,const char   *       const  );
00036   med_parameter_type * const paramtype   = va_arg(params,med_parameter_type * const  );
00037   char *               const description = va_arg(params,char *               const  );
00038   char *               const dtunit      = va_arg(params,char *               const  );
00039   med_int *            const nstep       = va_arg(params,med_int *            const  );
00040   med_err *                  fret        = va_arg(params,med_err *);
00041 
00042 
00043   med_err  _ret=-1,_err=0;
00044   med_idt  _paramidt=0,_cpstid=0;
00045   char     _path[MED_TAILLE_NUM_DATA+MED_TAILLE_NOM+1+1]=MED_NUM_DATA;
00046   char     _cpstname[2*MED_MAX_PARA+1]="";
00047   med_size _nstep=0;
00048   med_int  _intparamtype=0;
00049   /*
00050    * On inhibe le gestionnaire d'erreur HDF 5
00051    */
00052   _MEDmodeErreurVerrouiller();
00053 
00054   /*
00055    * On construit le chemin d'acces
00056    */
00057   strcat(_path,paramname);
00058   strcat(_path,"/");
00059 
00060   if ((_err=_MEDnObjects(fid, _path, &_nstep)) < 0 )
00061     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
00062       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_path);
00063       goto ERROR;
00064     }
00065   *nstep=(med_int) _nstep;
00066 
00067   if ((_paramidt = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00068     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00069     goto ERROR;
00070   }
00071 
00072   /*
00073    * L'attribut "TYP"
00074    */
00075   if ( _MEDattrEntierLire(_paramidt, MED_NOM_TYP, &_intparamtype) < 0) {
00076     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00077     SSCRUTE(MED_NOM_TYP);ISCRUTE(_intparamtype);
00078     goto ERROR;
00079   }
00080   *paramtype = (med_parameter_type) _intparamtype;
00081 
00082   /*
00083    * L'attribut DES
00084    */
00085   if ( _MEDattrStringLire(_paramidt,MED_NOM_DES,MED_TAILLE_DESC,description) < 0) {
00086     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00087     SSCRUTE(MED_NOM_DES);SSCRUTE(description);
00088     goto ERROR;
00089   }
00090 
00091   if ( _MEDobjectGetName( _paramidt,".",0,_cpstname) < 0 ) {
00092     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);SSCRUTE(_cpstname);
00093     goto ERROR;
00094   }
00095 
00096 
00097   /* Lecture de l'attribut MED_NOM_UNI */
00098   if ( _MEDattributeStringRdByName(_paramidt,_cpstname,MED_NOM_UNI,MED_TAILLE_PNOM,dtunit) < 0) {
00099     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00100     SSCRUTE(_cpstname);SSCRUTE(MED_NOM_UNI);SSCRUTE(dtunit);goto ERROR;
00101   }
00102 
00103  _ret = 0;
00104 
00105  ERROR:
00106 
00107 
00108  if (_paramidt>0)         if (_MEDdatagroupFermer(_paramidt) < 0) {
00109    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00110    ISCRUTE_id(_paramidt);
00111  }
00112 
00113   va_end(params);
00114   *fret = _ret;
00115   return;
00116 }

Généré le Mon May 16 17:10:22 2011 pour MED fichier par  doxygen 1.6.1