1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/
25 #include "MEDMEM_define.hxx"
26 #include "MEDMEM_Utilities.hxx"
28 /* Generic Read/Write Driver Class for Meshes & Fields */
34 Virtual class GENDRIVER use by all driver.
39 /* Modify the following line to add a new driver type (step 1) */
40 typedef enum { MED_DRIVER = 0, GIBI_DRIVER = 1, PORFLOW_DRIVER = 2, VTK_DRIVER = 254, ASCII_DRIVER = 3, NO_DRIVER = 255 } driverTypes;
45 int _id; // MED_INVALID : if the driver hasn't been created by a MedMedDriver
46 // the MedMedDriver index of the driver vector in the MED object where it has been created
48 string _fileName; // The name of the file currently in use.
49 MED_EN::med_mode_acces _accessMode; // The file access mode set by the adequate construtor.
50 int _status; // The file status {MED_INVALID, MED_OPENED, MED_CLOSED }
51 driverTypes _driverType; // A FAIRE LE POSITIONNER DS TOUTES LES SS CLASSES !!
62 GENDRIVER(const string & fileName,MED_EN::med_mode_acces accessMode);
66 GENDRIVER(const GENDRIVER & genDriver);
74 Operator = : duplicate the given genDriver.
76 GENDRIVER & operator=(const GENDRIVER & genDriver);
79 Operator << : put GENDRIVER object information to the given stream
81 friend ostream & operator<<(ostream &os,const GENDRIVER &genDriver);
83 bool operator ==(const GENDRIVER &genDriver) const;
87 virtual void open ( void ) = 0;
89 Open file with the append option. This method is used especially
90 on ASCII drivers (e.g. VTK_DRIVER).
92 virtual void openAppend ( void );
96 virtual void close( void ) = 0;
98 Write object in opened file.
100 virtual void write( void ) const = 0;
102 Write object in opened file. This method is used especially
103 on ASCII drivers (e.g. VTK_DRIVER).
105 virtual void writeAppend( void ) const;
107 Read object in opened file.
109 virtual void read ( void ) = 0;
111 // needed to duplicate arrays
112 virtual GENDRIVER * copy ( void ) const = 0 ;
115 virtual void writeFrom ( void );
116 virtual void readFileStruct ( void );
118 virtual void setMeshName ( const string & meshName);
119 // FIELD related Part
120 virtual void setFieldName ( const string & fieldName);
122 void setId ( int id = MED_INVALID );
123 int getId ( void ) const ;
124 string getFileName () const;
125 void setFileName ( const string & fileName);
126 MED_EN::med_mode_acces getAccessMode() const;
131 #endif /* GENDRIVER_HXX */