3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
29 #include "MED_Factory.hxx"
30 #include "MED_Utilities.hxx"
31 #include "MED_V2_2_Wrapper.hxx"
32 #include "MED_V2_1_Wrapper.hxx"
41 static int MYDEBUG = 0;
43 static int MYDEBUG = 0;
48 EVersion GetVersionId(const std::string& theFileName)
50 EVersion aVersion = eVUnknown;
51 char* aFileName = const_cast<char*>(theFileName.c_str());
52 med_idt aFid = MEDouvrir(aFileName,MED_LECTURE);
53 MSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aFid = "<<aFid<<endl);
55 med_int aMajor, aMinor, aRelease;
56 med_err aRet = MEDversionLire(aFid,&aMajor,&aMinor,&aRelease);
57 INITMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aRet = "<<aRet<<endl);
59 if(aMajor >= 2 && aMinor >= 2)
65 INITMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aVersion = "<<aVersion<<endl);
69 PWrapper CrWrapper(const std::string& theFileName)
72 EVersion aVersion = GetVersionId(theFileName);
75 aWrapper.reset(new MED::V2_2::TVWrapper(theFileName));
79 aWrapper.reset(new MED::V2_1::TVWrapper(theFileName));
84 PWrapper CrWrapper(const std::string& theFileName, EVersion theId)
86 EVersion aVersion = GetVersionId(theFileName);
89 remove(theFileName.c_str());
94 aWrapper.reset(new MED::V2_2::TVWrapper(theFileName));
97 aWrapper.reset(new MED::V2_1::TVWrapper(theFileName));