Salome HOME
update after merging trhe branches CEA_V3_0_x, OCC_V3_1_0_a1_x, and the main
[modules/med.git] / src / MEDMEM / MEDMEM_MedMedDriver22.hxx
1 #ifndef MED_MED_DRIVER22_HXX
2 #define MED_MED_DRIVER22_HXX
3
4 #include "MEDMEM_MedMedDriver.hxx"
5 #include <string>
6 #include "MEDMEM_Utilities.hxx"
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_DRIVER22 : public virtual MED_MED_DRIVER
26 {
27 protected:
28   
29   med_2_2::med_idt           _medIdt;         // The _medIdt used to write/read Meshes to ::_filename
30    
31   //private:
32   //  MED_MED_DRIVER();
33
34 public :
35   /*!
36     Constructor.
37   */
38   MED_MED_DRIVER22();
39   /*!
40     Constructor.
41   */
42   MED_MED_DRIVER22(const string & fileName,  MED * const ptrMed);
43   /*!
44     Constructor.
45   */
46   MED_MED_DRIVER22(const string & fileName,  MED * const ptrMed,
47                    MED_EN::med_mode_acces accessMode);
48
49   // OPERATEUR DE RECOPIE AVEC _medIdt ??
50   /*!
51     Copy constructor.
52   */
53   MED_MED_DRIVER22(const MED_MED_DRIVER22 & driver);
54
55   /*!
56     Destructor.
57   */
58   virtual ~MED_MED_DRIVER22() ;
59
60   void open() throw (MEDEXCEPTION) ;
61   void close();
62
63   //virtual void write          ( void ) const = 0 ;
64   virtual void write          ( void ) const ;
65   //virtual void writeFrom      ( void ) const = 0 ;
66   virtual void writeFrom      ( void ) const  ;
67   //virtual void read           ( void ) = 0 ;
68   virtual void read           ( void )  ;
69   //virtual void readFileStruct ( void ) = 0 ;
70   virtual void readFileStruct ( void ) ;
71
72 private:
73   //virtual GENDRIVER * copy ( void ) const = 0 ;
74   virtual GENDRIVER * copy ( void ) const  ;
75
76 };
77
78 /*!
79
80   Driver Med for MED : Read only.
81
82   Implement read method.
83
84 */
85
86   class MED_MED_RDONLY_DRIVER22 : public virtual IMED_MED_RDONLY_DRIVER, public virtual MED_MED_DRIVER22
87 {
88 public :
89   /*!
90     Constructor.
91   */
92   MED_MED_RDONLY_DRIVER22();
93   /*!
94     Constructor.
95   */
96   MED_MED_RDONLY_DRIVER22(const string & fileName,  MED * const ptrMed);
97   /*!
98     Copy constructor.
99   */
100   MED_MED_RDONLY_DRIVER22(const MED_MED_RDONLY_DRIVER22 & driver);
101
102   /*!
103     Destructor.
104   */
105   virtual ~MED_MED_RDONLY_DRIVER22();
106
107   /*!
108     Return a MEDEXCEPTION : it is the read-only driver.
109   */
110   void write          ( void ) const throw (MEDEXCEPTION) ;
111   /*!
112     Return a MEDEXCEPTION : it is the read-only driver.
113   */
114   void writeFrom      ( void ) const throw (MEDEXCEPTION) ;
115   /*!
116     Read all from the file.
117   */
118   void read           ( void ) throw (MEDEXCEPTION);
119   /*!
120     Read only table of contents of the file.
121
122     All objects are created but there values are not read.
123   */
124   void readFileStruct ( void ) throw (MEDEXCEPTION) ;
125
126 private:
127   virtual GENDRIVER * copy ( void ) const ;
128
129 };
130
131 /*!
132
133   Driver Med for MED : Write only.
134
135   Implement write method.
136
137 */
138
139 class MED_MED_WRONLY_DRIVER22 : public virtual IMED_MED_WRONLY_DRIVER, public virtual MED_MED_DRIVER22
140 {
141
142 public :
143   /*!
144     Constructor.
145   */
146   MED_MED_WRONLY_DRIVER22();
147   /*!
148     Constructor.
149   */
150   MED_MED_WRONLY_DRIVER22(const string & fileName,  MED * const ptrMed);
151   /*!
152     Copy constructor.
153   */
154   MED_MED_WRONLY_DRIVER22(const MED_MED_WRONLY_DRIVER22 & driver);
155
156   /*!
157     Destructor.
158   */
159   virtual ~MED_MED_WRONLY_DRIVER22();
160
161   /*!
162     Write all in file.
163   */
164   void write          ( void ) const throw (MEDEXCEPTION);
165   /*!
166     Write only objects created from this MED driver in file.
167   */
168   void writeFrom      ( void ) const throw (MEDEXCEPTION);
169   /*!
170     Return a MEDEXCEPTION : it is the write-only driver.
171   */
172   void read           ( void ) throw (MEDEXCEPTION) ;
173   /*!
174     Return a MEDEXCEPTION : it is the write-only driver.
175   */
176   void readFileStruct ( void ) throw (MEDEXCEPTION) ;
177
178 private:
179   virtual GENDRIVER * copy ( void ) const ;
180
181 };
182
183 /*!
184
185   Driver Med for MED : Read write.
186   - Use read method from MED_MED_RDONLY_DRIVER
187   - Use write method from MED_MED_WDONLY_DRIVER
188
189 */
190
191 class MED_MED_RDWR_DRIVER22 : public virtual MED_MED_RDONLY_DRIVER22,
192                               public virtual MED_MED_WRONLY_DRIVER22,
193                               public virtual IMED_MED_RDWR_DRIVER
194 {
195
196 public :
197   /*!
198     Constructor.
199   */
200   MED_MED_RDWR_DRIVER22();
201   /*!
202     Constructor.
203   */
204   MED_MED_RDWR_DRIVER22(const string & fileName,  MED * const ptrMed);
205   /*!
206     Copy constructor.
207   */
208   MED_MED_RDWR_DRIVER22(const MED_MED_RDWR_DRIVER22 & driver);
209
210   /*!
211     Destructor.
212   */
213   ~MED_MED_RDWR_DRIVER22();
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_DRIVER22_HXX */