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 #ifndef MED_MED_DRIVER_HXX
23 #define MED_MED_DRIVER_HXX
28 #include "MEDMEM_STRING.hxx"
29 #include "MEDMEM_Utilities.hxx"
30 #include "MEDMEM_Exception.hxx"
31 #include "MEDMEM_GenDriver.hxx"
32 #include "MEDMEM_define.hxx"
38 Generic part : implement open and close methods.
42 // This driver pilots within a MED class read/write accesses of fields/meshes
48 class MEDMEM_EXPORT MED_MED_DRIVER : public GENDRIVER
52 MED * const _ptrMed; // Store 'MED_DRIVER (0..n)----(1) MED' associations
53 GENDRIVER * _concreteMedDrv;
63 MED_MED_DRIVER(const string & fileName, MED * const ptrMed);
67 MED_MED_DRIVER(const string & fileName, MED * const ptrMed,
68 MED_EN::med_mode_acces accessMode);
70 // OPERATEUR DE RECOPIE AVEC _medIdt ??
74 MED_MED_DRIVER(const MED_MED_DRIVER & driver);
79 virtual ~MED_MED_DRIVER() ;
81 virtual void open() throw (MEDEXCEPTION) = 0 ;
82 virtual void close() = 0 ;
83 virtual void write ( void ) const = 0 ;
84 virtual void writeFrom ( void ) const = 0 ;
85 virtual void read ( void ) = 0 ;
86 virtual void readFileStruct ( void ) = 0 ;
87 virtual void setFileName ( const string & fileName) {_concreteMedDrv->setFileName(fileName); }
90 virtual GENDRIVER * copy ( void ) const = 0 ;
92 friend class MED_MED_RDONLY_DRIVER;
93 friend class MED_MED_WRONLY_DRIVER;
94 friend class MED_MED_RDWR_DRIVER;
99 Driver Med for MED : Read only.
101 Implement read method.
105 class MEDMEM_EXPORT IMED_MED_RDONLY_DRIVER : public virtual MED_MED_DRIVER
111 IMED_MED_RDONLY_DRIVER();
115 IMED_MED_RDONLY_DRIVER(const string & fileName, MED * const ptrMed);
119 IMED_MED_RDONLY_DRIVER(const IMED_MED_RDONLY_DRIVER & driver);
124 virtual ~IMED_MED_RDONLY_DRIVER();
127 Return a MEDEXCEPTION : it is the read-only driver.
129 void write ( void ) const throw (MEDEXCEPTION) ;
131 Return a MEDEXCEPTION : it is the read-only driver.
133 void writeFrom ( void ) const throw (MEDEXCEPTION) ;
136 // PAL14192: to allow painless repeated readFileStruct() calls
137 bool _fileStructIsRead;
142 Driver Med for MED : Write only.
144 Implement write method.
148 class MEDMEM_EXPORT IMED_MED_WRONLY_DRIVER : public virtual MED_MED_DRIVER
155 IMED_MED_WRONLY_DRIVER();
159 IMED_MED_WRONLY_DRIVER(const string & fileName, MED * const ptrMed);
163 IMED_MED_WRONLY_DRIVER(const IMED_MED_WRONLY_DRIVER & driver);
168 virtual ~IMED_MED_WRONLY_DRIVER();
171 Return a MEDEXCEPTION : it is the write-only driver.
173 void read ( void ) throw (MEDEXCEPTION) ;
175 Return a MEDEXCEPTION : it is the write-only driver.
177 void readFileStruct ( void ) throw (MEDEXCEPTION) ;
183 Driver Med for MED : Read write.
184 - Use read method from MED_MED_RDONLY_DRIVER
185 - Use write method from MED_MED_WDONLY_DRIVER
189 class MEDMEM_EXPORT IMED_MED_RDWR_DRIVER : public virtual IMED_MED_RDONLY_DRIVER,
190 public virtual IMED_MED_WRONLY_DRIVER
197 IMED_MED_RDWR_DRIVER();
201 IMED_MED_RDWR_DRIVER(const string & fileName, MED * const ptrMed);
205 IMED_MED_RDWR_DRIVER(const IMED_MED_RDWR_DRIVER & driver);
210 ~IMED_MED_RDWR_DRIVER();
214 class MEDMEM_EXPORT MED_MED_RDONLY_DRIVER : public virtual IMED_MED_RDONLY_DRIVER
217 MED_MED_RDONLY_DRIVER();
218 MED_MED_RDONLY_DRIVER(const string & fileName, MED * const ptrMed);
219 MED_MED_RDONLY_DRIVER(const MED_MED_RDONLY_DRIVER & driver);
220 virtual ~MED_MED_RDONLY_DRIVER();
221 void write ( void ) const throw (MEDEXCEPTION) ;
222 void writeFrom ( void ) const throw (MEDEXCEPTION) ;
223 virtual void open() throw (MEDEXCEPTION) ;
224 virtual void close() ;
225 virtual void read ( void ) ;
226 virtual void readFileStruct ( void ) ;
228 GENDRIVER * copy ( void ) const;
231 class MEDMEM_EXPORT MED_MED_WRONLY_DRIVER : public virtual IMED_MED_WRONLY_DRIVER
235 MED_MED_WRONLY_DRIVER();
236 MED_MED_WRONLY_DRIVER(const string & fileName, MED * const ptrMed);
237 MED_MED_WRONLY_DRIVER(const MED_MED_WRONLY_DRIVER & driver);
238 virtual ~MED_MED_WRONLY_DRIVER();
239 void write ( void ) const throw (MEDEXCEPTION) ;
240 void writeFrom ( void ) const throw (MEDEXCEPTION) ;
241 virtual void open() throw (MEDEXCEPTION) ;
242 virtual void close() ;
243 virtual void read ( void ) throw (MEDEXCEPTION) ;
244 virtual void readFileStruct ( void ) throw (MEDEXCEPTION) ;
246 GENDRIVER * copy ( void ) const;
249 class MEDMEM_EXPORT MED_MED_RDWR_DRIVER : public IMED_MED_RDWR_DRIVER
253 MED_MED_RDWR_DRIVER();
254 MED_MED_RDWR_DRIVER(const string & fileName, MED * const ptrMed);
255 MED_MED_RDWR_DRIVER(const MED_MED_RDWR_DRIVER & driver);
256 ~MED_MED_RDWR_DRIVER();
257 void write ( void ) const throw (MEDEXCEPTION) ;
258 void writeFrom ( void ) const throw (MEDEXCEPTION) ;
259 virtual void open() throw (MEDEXCEPTION) ;
260 virtual void close() ;
261 virtual void read ( void ) throw (MEDEXCEPTION) ;
262 virtual void readFileStruct ( void ) throw (MEDEXCEPTION) ;
264 GENDRIVER * copy ( void ) const;
268 #endif /* MED_MED_DRIVER_HXX */