1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "MEDMEM_Compatibility21_22.hxx"
24 using namespace MEDMEM;
25 using namespace MED_EN;
27 //================================================================================
29 * \brief return file mode access corresponding to MED_EN::med_mode_acces in given med version
30 * \param mode - either MED_LECT, MED_ECRI or MED_REMP
31 * \param medVersion - V21 or V22 or ??
32 * \retval int - file mode access
34 * To be used in MEDouvrir() call
36 //================================================================================
38 int MEDMEM::getMedAccessMode(MED_EN::med_mode_acces mode,
39 MED_EN::medFileVersion medVersion)
42 switch ( medVersion ) {
52 if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
59 if ((fid = _MEDfichierCreer(nom)) < 0)
63 if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
68 if ((fid = _MEDfichierCreer(nom)) < 0)
73 case MED_EN::WRONLY: return med_2_1::MED_ECRI;
74 case MED_EN::RDONLY: return med_2_1::MED_LECT;
75 case MED_EN::RDWR: return med_2_1::MED_ECRI; //REMP; -- pb with RDWR drivers
77 throw MEDEXCEPTION("getMedAccessMode(): Wrong access mode");
82 MED_LECTURE : Ouverture en lecture seule
83 MED_LECTURE_ECRITURE : Ouverture en lecture/ecriture, si un élément existe il est écrasé
84 MED_LECTURE_AJOUT : Ouverture en lecture/ecriture, si un élément existe une erreur est générée
85 MED_CREATION : Créer le fichier s'il n'existe pas, l'écrase sinon
88 case MED_EN::WRONLY: return med_2_3::MED_LECTURE_ECRITURE;// be coherent with V21 /*MED_CREATION;*/
89 case MED_EN::RDONLY: return med_2_3::MED_LECTURE;
90 case MED_EN::RDWR: return med_2_3::MED_LECTURE_ECRITURE;
92 throw MEDEXCEPTION("getMedAccessMode(): Wrong access mode");
96 throw MEDEXCEPTION("getMedAccessMode(): Unknown med version");