]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_MedMedDriver22.hxx
Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / MEDMEM / MEDMEM_MedMedDriver22.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef MED_MED_DRIVER22_HXX
23 #define MED_MED_DRIVER22_HXX
24
25 #include "MEDMEM_MedMedDriver.hxx"
26 #include <string>
27 #include "MEDMEM_Utilities.hxx"
28 #include "MEDMEM_Exception.hxx"
29 #include "MEDMEM_GenDriver.hxx"
30 #include "MEDMEM_define.hxx"
31
32 /*!
33
34   Driver Med for MED.
35
36   Generic part : implement open and close methods.
37
38 */
39
40 // This driver pilots within a MED class read/write accesses of fields/meshes
41 namespace MEDMEM {
42 class MESH;
43 class FIELD_;
44 class MED;
45
46 class MED_MED_DRIVER22 : public virtual MED_MED_DRIVER
47 {
48 protected:
49   
50   med_2_3::med_idt           _medIdt;         // The _medIdt used to write/read Meshes to ::_filename
51    
52   //private:
53   //  MED_MED_DRIVER();
54
55 public :
56   /*!
57     Constructor.
58   */
59   MED_MED_DRIVER22();
60   /*!
61     Constructor.
62   */
63   MED_MED_DRIVER22(const string & fileName,  MED * const ptrMed);
64   /*!
65     Constructor.
66   */
67   MED_MED_DRIVER22(const string & fileName,  MED * const ptrMed,
68                    MED_EN::med_mode_acces accessMode);
69
70   // OPERATEUR DE RECOPIE AVEC _medIdt ??
71   /*!
72     Copy constructor.
73   */
74   MED_MED_DRIVER22(const MED_MED_DRIVER22 & driver);
75
76   /*!
77     Destructor.
78   */
79   virtual ~MED_MED_DRIVER22() ;
80
81   void open() throw (MEDEXCEPTION) ;
82   void close();
83
84   //virtual void write          ( void ) const = 0 ;
85   virtual void write          ( void ) const ;
86   //virtual void writeFrom      ( void ) const = 0 ;
87   virtual void writeFrom      ( void ) const  ;
88   //virtual void read           ( void ) = 0 ;
89   virtual void read           ( void )  ;
90   //virtual void readFileStruct ( void ) = 0 ;
91   virtual void readFileStruct ( void ) ;
92
93 private:
94   //virtual GENDRIVER * copy ( void ) const = 0 ;
95   virtual GENDRIVER * copy ( void ) const  ;
96
97 };
98
99 /*!
100
101   Driver Med for MED : Read only.
102
103   Implement read method.
104
105 */
106
107   class MED_MED_RDONLY_DRIVER22 : public virtual IMED_MED_RDONLY_DRIVER, public virtual MED_MED_DRIVER22
108 {
109 public :
110   /*!
111     Constructor.
112   */
113   MED_MED_RDONLY_DRIVER22();
114   /*!
115     Constructor.
116   */
117   MED_MED_RDONLY_DRIVER22(const string & fileName,  MED * const ptrMed);
118   /*!
119     Copy constructor.
120   */
121   MED_MED_RDONLY_DRIVER22(const MED_MED_RDONLY_DRIVER22 & driver);
122
123   /*!
124     Destructor.
125   */
126   virtual ~MED_MED_RDONLY_DRIVER22();
127
128   /*!
129     Return a MEDEXCEPTION : it is the read-only driver.
130   */
131   void write          ( void ) const throw (MEDEXCEPTION) ;
132   /*!
133     Return a MEDEXCEPTION : it is the read-only driver.
134   */
135   void writeFrom      ( void ) const throw (MEDEXCEPTION) ;
136   /*!
137     Read all from the file.
138   */
139   void read           ( void ) throw (MEDEXCEPTION);
140   /*!
141     Read only table of contents of the file.
142
143     All objects are created but there values are not read.
144   */
145   void readFileStruct ( void ) throw (MEDEXCEPTION) ;
146
147 private:
148   virtual GENDRIVER * copy ( void ) const ;
149
150 };
151
152 /*!
153
154   Driver Med for MED : Write only.
155
156   Implement write method.
157
158 */
159
160 class MED_MED_WRONLY_DRIVER22 : public virtual IMED_MED_WRONLY_DRIVER, public virtual MED_MED_DRIVER22
161 {
162
163 public :
164   /*!
165     Constructor.
166   */
167   MED_MED_WRONLY_DRIVER22();
168   /*!
169     Constructor.
170   */
171   MED_MED_WRONLY_DRIVER22(const string & fileName,  MED * const ptrMed);
172   /*!
173     Copy constructor.
174   */
175   MED_MED_WRONLY_DRIVER22(const MED_MED_WRONLY_DRIVER22 & driver);
176
177   /*!
178     Destructor.
179   */
180   virtual ~MED_MED_WRONLY_DRIVER22();
181
182   /*!
183     Write all in file.
184   */
185   void write          ( void ) const throw (MEDEXCEPTION);
186   /*!
187     Write only objects created from this MED driver in file.
188   */
189   void writeFrom      ( void ) const throw (MEDEXCEPTION);
190   /*!
191     Return a MEDEXCEPTION : it is the write-only driver.
192   */
193   void read           ( void ) throw (MEDEXCEPTION) ;
194   /*!
195     Return a MEDEXCEPTION : it is the write-only driver.
196   */
197   void readFileStruct ( void ) throw (MEDEXCEPTION) ;
198
199 private:
200   virtual GENDRIVER * copy ( void ) const ;
201
202 };
203
204 /*!
205
206   Driver Med for MED : Read write.
207   - Use read method from MED_MED_RDONLY_DRIVER
208   - Use write method from MED_MED_WDONLY_DRIVER
209
210 */
211
212 class MED_MED_RDWR_DRIVER22 : public virtual MED_MED_RDONLY_DRIVER22,
213                               public virtual MED_MED_WRONLY_DRIVER22,
214                               public virtual IMED_MED_RDWR_DRIVER
215 {
216
217 public :
218   /*!
219     Constructor.
220   */
221   MED_MED_RDWR_DRIVER22();
222   /*!
223     Constructor.
224   */
225   MED_MED_RDWR_DRIVER22(const string & fileName,  MED * const ptrMed);
226   /*!
227     Copy constructor.
228   */
229   MED_MED_RDWR_DRIVER22(const MED_MED_RDWR_DRIVER22 & driver);
230
231   /*!
232     Destructor.
233   */
234   ~MED_MED_RDWR_DRIVER22();
235
236   /*!
237     Write all in file.
238   */
239   void write          ( void ) const throw (MEDEXCEPTION);
240   /*!
241     Write only objects created from this MED driver in file.
242   */
243   void writeFrom      ( void ) const throw (MEDEXCEPTION);
244   /*!
245     Read all from the file.
246   */
247   void read           ( void ) throw (MEDEXCEPTION);
248   /*!
249     Read only table of contents of the file.
250
251     All objects are created but there values are not read.
252   */
253   void readFileStruct ( void ) throw (MEDEXCEPTION);
254
255 private:
256   virtual GENDRIVER * copy ( void ) const ;
257
258 };
259 }
260
261 #endif /* MED_MED_DRIVER22_HXX */