]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_GibiMeshDriver.hxx
Salome HOME
sources v1.2
[modules/med.git] / src / MEDMEM / MEDMEM_GibiMeshDriver.hxx
1 //  MED MEDMEM : MED files in memory
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : MEDMEM_GibiMeshDriver.hxx
8 //  Module : MED
9
10 #ifndef GIBI_MESH_DRIVER_HXX
11 #define GIBI_MESH_DRIVER_HXX
12
13 #include <string>
14 #include <vector>
15
16 #include "MEDMEM_define.hxx"
17 #include "MEDMEM_GenDriver.hxx"
18
19 #include "MEDMEM_STRING.hxx"
20 #include "MEDMEM_Exception.hxx"
21 #include "utilities.h"
22
23 class MESH;
24 class FAMILY;
25 class GROUP;
26 class CONNECTIVITY;
27
28 /*!
29
30   Driver GIBI for MESH.
31
32   Generic part : implement the readopen and close methods.
33   
34 */
35
36
37 class GIBI_MESH_DRIVER : public GENDRIVER
38 {
39 protected:
40   
41   MESH *          _ptrMesh;
42   // A VOIR FILE DESCRIPTEUR ? MED_FR::med_idt _medIdt;
43   string          _meshName;    
44   
45 public :
46
47   /*!
48     Constructor.
49   */
50   GIBI_MESH_DRIVER() ;
51   /*!
52     Constructor.
53   */
54   GIBI_MESH_DRIVER(const string & fileName,  
55                   MESH * ptrMesh, 
56                   med_mode_acces accessMode) ;
57   /*!
58     Copy constructor.
59   */
60   GIBI_MESH_DRIVER(const GIBI_MESH_DRIVER & driver) ;
61
62   /*!
63     Destructor.
64   */
65   virtual ~GIBI_MESH_DRIVER() ;
66
67   void open() throw (MEDEXCEPTION);
68   void close() throw (MEDEXCEPTION);
69
70   virtual void write( void ) const = 0 ;
71   virtual void read ( void ) = 0 ;
72
73   /*!
74     Set the name of the MESH asked in file.
75
76     It could be different than the name of the MESH object.
77   */
78   void   setMeshName(const string & meshName) ;
79   /*!
80     Get the name of the MESH asked in file.
81   */
82   string getMeshName() const ;
83
84 private:
85   virtual GENDRIVER * copy ( void ) const = 0 ;
86
87 };
88
89
90 class GIBI_MESH_RDONLY_DRIVER : public virtual GIBI_MESH_DRIVER
91 {
92  
93 public :
94   
95   /*!
96     Constructor.
97   */
98   GIBI_MESH_RDONLY_DRIVER() ;
99   /*!
100     Constructor.
101   */
102   GIBI_MESH_RDONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
103   /*!
104     Copy constructor.
105   */
106   GIBI_MESH_RDONLY_DRIVER(const GIBI_MESH_RDONLY_DRIVER & driver) ;
107
108   /*!
109     Destructor.
110   */
111   virtual ~GIBI_MESH_RDONLY_DRIVER() ;
112   
113   /*!
114     Return a MEDEXCEPTION : it is the read-only driver.
115   */
116   void write( void ) const throw (MEDEXCEPTION);
117   /*!
118     Read MESH in the specified file.
119   */
120   void read ( void ) throw (MEDEXCEPTION);
121
122 private:
123  
124   GENDRIVER * copy ( void ) const ;
125
126 };
127
128 /*!
129
130   Driver Med for MESH : Write only.
131
132   Implement write method.
133
134 */
135
136 class GIBI_MESH_WRONLY_DRIVER : public virtual GIBI_MESH_DRIVER {
137   
138 public :
139   
140   /*!
141     Constructor.
142   */
143   GIBI_MESH_WRONLY_DRIVER() ;
144   /*!
145     Constructor.
146   */
147   GIBI_MESH_WRONLY_DRIVER(const string & fileName, MESH * ptrMesh) ;
148   /*!
149     Copy constructor.
150   */
151   GIBI_MESH_WRONLY_DRIVER(const GIBI_MESH_WRONLY_DRIVER & driver) ;
152
153   /*!
154     Destructor.
155   */
156   virtual ~GIBI_MESH_WRONLY_DRIVER() ;
157
158   /*!
159     Write MESH in the specified file.
160   */
161   void write( void ) const throw (MEDEXCEPTION);
162   /*!
163     Return a MEDEXCEPTION : it is the write-only driver.
164   */
165   void read ( void ) throw (MEDEXCEPTION);
166
167 private:
168
169   GENDRIVER * copy ( void ) const ;
170 };
171
172
173 /*!
174
175   Driver GIBI for MESH : Read write.
176   - Use read method from GIBI_MESH_RDONLY_DRIVER
177   - Use write method from GIBI_MESH_WRONLY_DRIVER
178
179 */
180
181 class GIBI_MESH_RDWR_DRIVER : public GIBI_MESH_RDONLY_DRIVER, public GIBI_MESH_WRONLY_DRIVER {
182
183 public :
184
185   /*!
186     Constructor.
187   */
188   GIBI_MESH_RDWR_DRIVER() ;
189   /*!
190     Constructor.
191   */
192   GIBI_MESH_RDWR_DRIVER(const string & fileName, MESH * ptrMesh) ;
193   /*!
194     Copy constructor.
195   */
196   GIBI_MESH_RDWR_DRIVER(const GIBI_MESH_RDWR_DRIVER & driver) ;
197
198   /*!
199     Destructor.
200   */
201   ~GIBI_MESH_RDWR_DRIVER() ;
202
203   /*!
204     Write MESH in the specified file.
205   */
206   void write(void) const throw (MEDEXCEPTION);
207   /*!
208     Read MESH in the specified file.
209   */
210   void read (void) throw (MEDEXCEPTION);
211
212 private:
213   GENDRIVER * copy(void) const ;
214
215 };
216
217
218 #endif /* GIBI_MESH_DRIVER_HXX */