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_MedMedDriver.hxx"
23 #include "MEDMEM_Compatibility21_22.hxx"
24 #include "MEDMEM_MedMedDriver21.hxx"
25 #include "MEDMEM_MedMedDriver22.hxx"
26 #include "MEDMEM_DriverFactory.hxx"
27 #include "MEDMEM_define.hxx"
30 using namespace MED_EN;
31 using namespace MEDMEM;
33 MED_MED_DRIVER::MED_MED_DRIVER(): GENDRIVER(MED_DRIVER),
38 MED_MED_DRIVER::MED_MED_DRIVER(const string & fileName, MED * const ptrMed):
39 GENDRIVER(fileName, MED_EN::RDWR, MED_DRIVER),
43 //_ptrMed->addDriver(*this); // The specific MED driver id is set within the addDriver method.
46 MED_MED_DRIVER::MED_MED_DRIVER(const string & fileName,
48 MED_EN::med_mode_acces accessMode):
49 GENDRIVER(fileName, accessMode, MED_DRIVER),
54 //REM : As t'on besoin du champ _status : _medIdt <-> _status ? Oui
56 MED_MED_DRIVER::MED_MED_DRIVER(const MED_MED_DRIVER & driver):
58 _ptrMed(driver._ptrMed)
59 // _concreteMedDrv(driver._concreteMedDrv->copy())
61 if ( driver._concreteMedDrv )
62 _concreteMedDrv = driver._concreteMedDrv->copy();
67 MED_MED_DRIVER::~MED_MED_DRIVER()
69 MESSAGE_MED("MED_MED_DRIVER::~MED_MED_DRIVER() has been destroyed");
70 if (_concreteMedDrv) delete _concreteMedDrv;
74 // ------------- Read Only Part --------------
76 IMED_MED_RDONLY_DRIVER::IMED_MED_RDONLY_DRIVER():MED_MED_DRIVER(),_fileStructIsRead(false)
80 IMED_MED_RDONLY_DRIVER::IMED_MED_RDONLY_DRIVER(const string & fileName, MED * const ptrMed):
81 MED_MED_DRIVER(fileName,ptrMed,MED_EN::RDONLY),_fileStructIsRead(false)
83 MESSAGE_MED("MED_MED_RDONLY_DRIVER::MED_MED_RDONLY_DRIVER(const string & fileName, MED * const ptrMed) Constructeur read only");
86 IMED_MED_RDONLY_DRIVER::IMED_MED_RDONLY_DRIVER(const IMED_MED_RDONLY_DRIVER & driver):
87 MED_MED_DRIVER(driver),_fileStructIsRead(false)
91 IMED_MED_RDONLY_DRIVER::~IMED_MED_RDONLY_DRIVER()
93 MESSAGE_MED("MED_MED_RDONLY_DRIVER::~MED_MED_RDONLY_DRIVER() has been destroyed");
96 void IMED_MED_RDONLY_DRIVER::write(void) const
99 throw MEDEXCEPTION("MED_MED_RDONLY_DRIVER::write : Can't write with a RDONLY driver !");
102 void IMED_MED_RDONLY_DRIVER::writeFrom(void) const
105 throw MEDEXCEPTION("MED_MED_RDONLY_DRIVER::writeFrom : Can't write with a RDONLY driver !");
108 // ------------- Write Only Part --------------
110 IMED_MED_WRONLY_DRIVER::IMED_MED_WRONLY_DRIVER()
114 IMED_MED_WRONLY_DRIVER::IMED_MED_WRONLY_DRIVER(const string & fileName, MED * const ptrMed):
115 MED_MED_DRIVER(fileName,ptrMed,MED_EN::WRONLY)
118 IMED_MED_WRONLY_DRIVER::IMED_MED_WRONLY_DRIVER(const IMED_MED_WRONLY_DRIVER & driver):
119 MED_MED_DRIVER(driver)
122 IMED_MED_WRONLY_DRIVER::~IMED_MED_WRONLY_DRIVER()
124 MESSAGE_MED("MED_MED_WRONLY_DRIVER::~MED_MED_WRONLY_DRIVER() has been destroyed");
127 void IMED_MED_WRONLY_DRIVER::read(void)
130 throw MEDEXCEPTION("MED_MED_WRONLY_DRIVER::read : Can't read with a WRONLY driver !");
133 void IMED_MED_WRONLY_DRIVER::readFileStruct(void)
136 throw MEDEXCEPTION("MED_MED_WRONLY_DRIVER::read : Can't read with a WRONLY driver !");
139 // ------------- Read Write Part --------------
141 IMED_MED_RDWR_DRIVER::IMED_MED_RDWR_DRIVER()
144 IMED_MED_RDWR_DRIVER::IMED_MED_RDWR_DRIVER(const string & fileName, MED * const ptrMed):
145 IMED_MED_RDONLY_DRIVER(fileName,ptrMed),IMED_MED_WRONLY_DRIVER(fileName,ptrMed),MED_MED_DRIVER(fileName,ptrMed,RDWR)
148 IMED_MED_RDWR_DRIVER::IMED_MED_RDWR_DRIVER(const IMED_MED_RDWR_DRIVER & driver):
149 IMED_MED_RDONLY_DRIVER(driver),IMED_MED_WRONLY_DRIVER(driver),MED_MED_DRIVER(driver)
152 IMED_MED_RDWR_DRIVER::~IMED_MED_RDWR_DRIVER() {
153 MESSAGE_MED("MED_MED_RDWR_DRIVER::~MED_MED_RDWR_DRIVER() has been destroyed");
156 MED_MED_RDONLY_DRIVER::MED_MED_RDONLY_DRIVER()
158 MESSAGE_MED("You are using the default constructor of the Med read only Driver and it is 2.1 one");
159 _concreteMedDrv = new MED_MED_RDONLY_DRIVER21();
162 MED_MED_RDONLY_DRIVER::MED_MED_RDONLY_DRIVER(const string & fileName, MED * const ptrMed):IMED_MED_RDONLY_DRIVER(fileName,ptrMed),MED_MED_DRIVER(fileName,ptrMed,RDONLY)
164 _concreteMedDrv = DRIVERFACTORY::buildMedDriverFromFile(fileName,ptrMed,RDONLY);
167 MED_MED_RDONLY_DRIVER::MED_MED_RDONLY_DRIVER(const MED_MED_RDONLY_DRIVER & driver):MED_MED_DRIVER(driver)
171 MED_MED_RDONLY_DRIVER::~MED_MED_RDONLY_DRIVER()
175 void MED_MED_RDONLY_DRIVER::write ( void ) const throw (MEDEXCEPTION)
177 _concreteMedDrv->write();
180 void MED_MED_RDONLY_DRIVER::writeFrom ( void ) const throw (MEDEXCEPTION)
182 _concreteMedDrv->writeFrom();
185 void MED_MED_RDONLY_DRIVER::open() throw (MEDEXCEPTION)
187 _concreteMedDrv->open();
190 void MED_MED_RDONLY_DRIVER::close()
192 _concreteMedDrv->close();
194 void MED_MED_RDONLY_DRIVER::read ( void )
196 _concreteMedDrv->read();
199 void MED_MED_RDONLY_DRIVER::readFileStruct ( void )
201 _concreteMedDrv->readFileStruct();
204 GENDRIVER * MED_MED_RDONLY_DRIVER::copy ( void ) const
206 return new MED_MED_RDONLY_DRIVER(*this);
209 MED_MED_WRONLY_DRIVER::MED_MED_WRONLY_DRIVER()
211 MESSAGE_MED("You are using the default constructor of the Med write only Driver and it is 2.1 one");
213 _concreteMedDrv = new MED_MED_WRONLY_DRIVER21();
216 MED_MED_WRONLY_DRIVER::MED_MED_WRONLY_DRIVER(const string & fileName, MED * const ptrMed):IMED_MED_WRONLY_DRIVER(fileName,ptrMed),MED_MED_DRIVER(fileName,ptrMed,WRONLY)
218 _concreteMedDrv = DRIVERFACTORY::buildMedDriverFromFile(fileName,ptrMed,WRONLY);
221 MED_MED_WRONLY_DRIVER::MED_MED_WRONLY_DRIVER(const MED_MED_WRONLY_DRIVER & driver):MED_MED_DRIVER(driver)
225 MED_MED_WRONLY_DRIVER::~MED_MED_WRONLY_DRIVER()
229 void MED_MED_WRONLY_DRIVER::write ( void ) const throw (MEDEXCEPTION)
231 _concreteMedDrv->write();
234 void MED_MED_WRONLY_DRIVER::writeFrom ( void ) const throw (MEDEXCEPTION)
236 _concreteMedDrv->writeFrom();
239 void MED_MED_WRONLY_DRIVER::open() throw (MEDEXCEPTION)
241 _concreteMedDrv->open();
244 void MED_MED_WRONLY_DRIVER::close()
246 _concreteMedDrv->close();
249 void MED_MED_WRONLY_DRIVER::read ( void ) throw (MEDEXCEPTION)
251 _concreteMedDrv->read();
254 void MED_MED_WRONLY_DRIVER::readFileStruct ( void ) throw (MEDEXCEPTION)
256 _concreteMedDrv->readFileStruct();
259 GENDRIVER * MED_MED_WRONLY_DRIVER::copy ( void ) const
261 return _concreteMedDrv->copy();
264 MED_MED_RDWR_DRIVER::MED_MED_RDWR_DRIVER()
266 MESSAGE_MED("You are using the default constructor of the Med read write Driver and it is 2.1 one");
267 _concreteMedDrv = new MED_MED_RDWR_DRIVER21();
270 MED_MED_RDWR_DRIVER::MED_MED_RDWR_DRIVER(const string & fileName, MED * const ptrMed):IMED_MED_RDWR_DRIVER(fileName,ptrMed),MED_MED_DRIVER(fileName,ptrMed,RDWR)
272 _concreteMedDrv = DRIVERFACTORY::buildMedDriverFromFile(fileName,ptrMed,RDWR);
275 MED_MED_RDWR_DRIVER::MED_MED_RDWR_DRIVER(const MED_MED_RDWR_DRIVER & driver):
276 MED_MED_DRIVER(driver)
280 MED_MED_RDWR_DRIVER::~MED_MED_RDWR_DRIVER()
284 void MED_MED_RDWR_DRIVER::write ( void ) const throw (MEDEXCEPTION)
286 _concreteMedDrv->write();
289 void MED_MED_RDWR_DRIVER::writeFrom ( void ) const throw (MEDEXCEPTION)
291 _concreteMedDrv->writeFrom();
294 void MED_MED_RDWR_DRIVER::open() throw (MEDEXCEPTION)
296 _concreteMedDrv->open();
299 void MED_MED_RDWR_DRIVER::close()
301 _concreteMedDrv->close();
304 void MED_MED_RDWR_DRIVER::read ( void ) throw (MEDEXCEPTION)
306 _concreteMedDrv->read();
309 void MED_MED_RDWR_DRIVER::readFileStruct ( void ) throw (MEDEXCEPTION)
311 _concreteMedDrv->readFileStruct();
314 GENDRIVER * MED_MED_RDWR_DRIVER::copy ( void ) const
316 return _concreteMedDrv->copy();