]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_MedMedDriver.hxx
Salome HOME
correct small problem from the version in the MedFileV2_2 branch.
[modules/med.git] / src / MEDMEM / MEDMEM_MedMedDriver.hxx
1 #ifndef MED_MED_DRIVER_HXX
2 #define MED_MED_DRIVER_HXX
3
4 #include <string>
5 #include "MEDMEM_STRING.hxx"
6 #include "utilities.h"
7 #include "MEDMEM_Exception.hxx"
8 #include "MEDMEM_GenDriver.hxx"
9 #include "MEDMEM_define.hxx"
10
11 /*!
12
13   Driver Med for MED.
14
15   Generic part : implement open and close methods.
16
17 */
18
19 // This driver pilots within a MED class read/write accesses of fields/meshes
20 namespace MEDMEM {
21 class MESH;
22 class FIELD_;
23 class MED;
24
25 class MED_MED_DRIVER : public GENDRIVER
26 {
27 protected:
28   
29   MED * const       _ptrMed;         // Store 'MED_DRIVER (0..n)----(1) MED' associations
30   med_idt           _medIdt;         // The _medIdt used to write/read Meshes to ::_filename
31    
32   //private:
33   //  MED_MED_DRIVER();
34
35 public :
36   /*!
37     Constructor.
38   */
39   MED_MED_DRIVER();
40   /*!
41     Constructor.
42   */
43   MED_MED_DRIVER(const string & fileName,  MED * const ptrMed);
44   /*!
45     Constructor.
46   */
47   MED_MED_DRIVER(const string & fileName,  MED * const ptrMed,
48                  MED_EN::med_mode_acces accessMode);
49
50   // OPERATEUR DE RECOPIE AVEC _medIdt ??
51   /*!
52     Copy constructor.
53   */
54   MED_MED_DRIVER(const MED_MED_DRIVER & driver);
55
56   /*!
57     Destructor.
58   */
59   virtual ~MED_MED_DRIVER() ;
60
61   void open() throw (MEDEXCEPTION) ;
62   void close();
63
64   //virtual void write          ( void ) const = 0 ;
65   virtual void write          ( void ) const ;
66   //virtual void writeFrom      ( void ) const = 0 ;
67   virtual void writeFrom      ( void ) const  ;
68   //virtual void read           ( void ) = 0 ;
69   virtual void read           ( void )  ;
70   //virtual void readFileStruct ( void ) = 0 ;
71   virtual void readFileStruct ( void ) ;
72
73 private:
74   //virtual GENDRIVER * copy ( void ) const = 0 ;
75   virtual GENDRIVER * copy ( void ) const  ;
76
77 };
78
79 /*!
80
81   Driver Med for MED : Read only.
82
83   Implement read method.
84
85 */
86
87 class MED_MED_RDONLY_DRIVER : public virtual MED_MED_DRIVER
88 {
89 public :
90   /*!
91     Constructor.
92   */
93   MED_MED_RDONLY_DRIVER();
94   /*!
95     Constructor.
96   */
97   MED_MED_RDONLY_DRIVER(const string & fileName,  MED * const ptrMed);
98   /*!
99     Copy constructor.
100   */
101   MED_MED_RDONLY_DRIVER(const MED_MED_RDONLY_DRIVER & driver);
102
103   /*!
104     Destructor.
105   */
106   virtual ~MED_MED_RDONLY_DRIVER();
107
108   /*!
109     Return a MEDEXCEPTION : it is the read-only driver.
110   */
111   void write          ( void ) const throw (MEDEXCEPTION) ;
112   /*!
113     Return a MEDEXCEPTION : it is the read-only driver.
114   */
115   void writeFrom      ( void ) const throw (MEDEXCEPTION) ;
116   /*!
117     Read all from the file.
118   */
119   void read           ( void ) throw (MEDEXCEPTION);
120   /*!
121     Read only table of contents of the file.
122
123     All objects are created but there values are not read.
124   */
125   void readFileStruct ( void ) throw (MEDEXCEPTION) ;
126
127 private:
128   virtual GENDRIVER * copy ( void ) const ;
129
130 };
131
132 /*!
133
134   Driver Med for MED : Write only.
135
136   Implement write method.
137
138 */
139
140 class MED_MED_WRONLY_DRIVER : public virtual MED_MED_DRIVER
141 {
142
143 public :
144   /*!
145     Constructor.
146   */
147   MED_MED_WRONLY_DRIVER();
148   /*!
149     Constructor.
150   */
151   MED_MED_WRONLY_DRIVER(const string & fileName,  MED * const ptrMed);
152   /*!
153     Copy constructor.
154   */
155   MED_MED_WRONLY_DRIVER(const MED_MED_WRONLY_DRIVER & driver);
156
157   /*!
158     Destructor.
159   */
160   virtual ~MED_MED_WRONLY_DRIVER();
161
162   /*!
163     Write all in file.
164   */
165   void write          ( void ) const throw (MEDEXCEPTION);
166   /*!
167     Write only objects created from this MED driver in file.
168   */
169   void writeFrom      ( void ) const throw (MEDEXCEPTION);
170   /*!
171     Return a MEDEXCEPTION : it is the write-only driver.
172   */
173   void read           ( void ) throw (MEDEXCEPTION) ;
174   /*!
175     Return a MEDEXCEPTION : it is the write-only driver.
176   */
177   void readFileStruct ( void ) throw (MEDEXCEPTION) ;
178
179 private:
180   virtual GENDRIVER * copy ( void ) const ;
181
182 };
183
184 /*!
185
186   Driver Med for MED : Read write.
187   - Use read method from MED_MED_RDONLY_DRIVER
188   - Use write method from MED_MED_WDONLY_DRIVER
189
190 */
191
192 class MED_MED_RDWR_DRIVER : public virtual MED_MED_RDONLY_DRIVER,
193                             public virtual MED_MED_WRONLY_DRIVER
194 {
195
196 public :
197   /*!
198     Constructor.
199   */
200   MED_MED_RDWR_DRIVER();
201   /*!
202     Constructor.
203   */
204   MED_MED_RDWR_DRIVER(const string & fileName,  MED * const ptrMed);
205   /*!
206     Copy constructor.
207   */
208   MED_MED_RDWR_DRIVER(const MED_MED_RDWR_DRIVER & driver);
209
210   /*!
211     Destructor.
212   */
213   ~MED_MED_RDWR_DRIVER();
214
215   /*!
216     Write all in file.
217   */
218   void write          ( void ) const throw (MEDEXCEPTION);
219   /*!
220     Write only objects created from this MED driver in file.
221   */
222   void writeFrom      ( void ) const throw (MEDEXCEPTION);
223   /*!
224     Read all from the file.
225   */
226   void read           ( void ) throw (MEDEXCEPTION);
227   /*!
228     Read only table of contents of the file.
229
230     All objects are created but there values are not read.
231   */
232   void readFileStruct ( void ) throw (MEDEXCEPTION);
233
234 private:
235   virtual GENDRIVER * copy ( void ) const ;
236
237 };
238 };
239
240 #endif /* MED_MED_DRIVER_HXX */