MEDmemFileOpen.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2013  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 #ifdef PPRO_NT
00024 #define F_OK 0
00025 #else
00026 #include <unistd.h>
00027 #endif
00028 
00042 med_idt
00043 MEDmemFileOpen(const char* const filename, med_memfile * const memfile, const med_bool filesync, const med_access_mode accessmode)
00044 {
00045   med_idt _fid = 0;
00046   med_err _ret = -1;
00047   /* med_bool file_exist = MED_FALSE; */
00048 
00049   /*
00050    * ON inhibe le gestionnaire d'erreur HDF
00051    */
00052   _MEDmodeErreurVerrouiller();
00053 
00054   /*
00055    * On ouvre le fichier MED sous HDF
00056    */
00057   switch(accessmode)
00058     {
00059     case MED_ACC_RDONLY :
00060     case MED_ACC_CREAT :
00061     case MED_ACC_RDWR :
00062         if ((_fid = _MEDmemFileCreate((char *) filename, memfile, filesync,  accessmode)) < 0) { 
00063           MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_MEMFILE,filename);
00064           goto ERROR;
00065         }
00066         break;
00067 
00068     case MED_ACC_RDEXT :
00069           MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_MEMFILE,filename);
00070       break;
00071 
00072     default :
00073       MED_ERR_(_ret,MED_ERR_INIT,MED_ERR_MEMFILE,filename);
00074       goto ERROR;
00075     }
00076 
00077   _ret=0;
00078  ERROR:
00079 
00080   if (_ret < 0)
00081     _fid = (med_idt) _ret;
00082 
00083   return _fid;
00084 }
00085 

Généré le Thu Oct 8 14:26:16 2015 pour MED fichier par  doxygen 1.6.1