# MEDprofileInfo.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.h>
    00020 #include <med_config.h>
    00021 #include <med_outils.h>
    00022
    00023 #include <string.h>
    00024 #include <stdlib.h>
    00025
    00039 med_err
    00040 MEDprofileInfo(const med_idt          fid,
    00041                const int              profileit,
    00042                char    *     const    profilename,
    00043                med_int *     const    profilesize )
    00044 {
    00045   med_idt        _pfid=0;
    00046   med_err        _ret=-1;
    00047   char           _path[MED_TAILLE_PROFILS+MED_NAME_SIZE+1]=MED_PROFILS;
    00048   int            _num=profileit-1;
    00049
    00050   /*
    00051    * On inhibe le gestionnaire d'erreur HDF 5
    00052    */
    00053   _MEDmodeErreurVerrouiller();
    00054
    00055   /*
    00056    * ouverture du groupe /PROFILS/"nom"
    00057    */
    00058   if ( _MEDobjectGetName(fid, _path ,_num, profilename) < 0 ) {
    00059     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);
    00060     ISCRUTE_int(profileit);
    00061     goto ERROR;
    00062   }
    00063
    00064   strcat(_path,profilename);
    00065   if ((_pfid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    00066     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_PROFILE_MSG);
    00067     SSCRUTE(_path);
    00068     goto ERROR;
    00069   }
    00070
    00071   /*
    00072    * Lecture de l'attribut MED_NOM_NBR
    00073    */
    00074   if (_MEDattrEntierLire(_pfid,MED_NOM_NBR,profilesize) < 0) {
    00075     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_PROFILE_MSG);
    00076     SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*profilesize);
    00077     goto ERROR;
    00078   }
    00079
    00080   _ret = 0;
    00081  ERROR:
    00082
    00083   if ( _pfid > 0 ) if ( _MEDdatagroupFermer(_pfid) < 0) {
    00084     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_PROFILS);
    00085     ISCRUTE_id(_pfid);
    00086   }
    00087
    00088   return _ret;
    00089 }