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/ or email : webmaster.salome@opencascade.com
27 #include "MEDMEM_define.hxx"
28 #include "MEDMEM_Utilities.hxx"
30 /* Generic Read/Write Driver Class for Meshes & Fields */
36 Virtual class GENDRIVER use by all driver.
41 /* Modify the following line to add a new driver type (step 1) */
42 typedef enum { MED_DRIVER = 0, GIBI_DRIVER = 1, PORFLOW_DRIVER = 2, ENSIGHT_DRIVER = 250, VTK_DRIVER = 254, ASCII_DRIVER = 3, NO_DRIVER = 255 } driverTypes;
44 ostream & operator<<(ostream &os,const GENDRIVER &genDriver);
46 class MEDMEM_EXPORT GENDRIVER {
50 int _id; // MED_INVALID : if the driver hasn't been created by a MedMedDriver
51 // the MedMedDriver index of the driver vector in the MED object where it has been created
53 string _fileName; // The name of the file currently in use.
54 MED_EN::med_mode_acces _accessMode; // The file access mode set by the adequate construtor.
55 int _status; // The file status {MED_INVALID, MED_OPENED, MED_CLOSED }
56 driverTypes _driverType; // A FAIRE LE POSITIONNER DS TOUTES LES SS CLASSES !!
67 GENDRIVER(const string & fileName,MED_EN::med_mode_acces accessMode);
71 GENDRIVER(const GENDRIVER & genDriver);
79 Operator = : duplicate the given genDriver.
81 GENDRIVER & operator=(const GENDRIVER & genDriver);
84 Operator << : put GENDRIVER object information to the given stream
86 friend MEDMEM_EXPORT ostream & operator<<(ostream &os,const GENDRIVER &genDriver);
88 bool operator ==(const GENDRIVER &genDriver) const;
92 virtual void open ( void ) = 0;
94 Open file with the append option. This method is used especially
95 on ASCII drivers (e.g. VTK_DRIVER).
97 virtual void openAppend ( void );
101 virtual void close( void ) = 0;
103 Write object in opened file.
105 virtual void write( void ) const = 0;
107 Write object in opened file. This method is used especially
108 on ASCII drivers (e.g. VTK_DRIVER).
110 virtual void writeAppend( void ) const;
112 Read object in opened file.
114 virtual void read ( void ) = 0;
116 // needed to duplicate arrays
117 virtual GENDRIVER * copy ( void ) const = 0 ;
120 virtual void writeFrom ( void );
121 virtual void readFileStruct ( void );
123 virtual void setMeshName ( const string & meshName);
124 virtual string getMeshName() const { return string(""); }
125 // FIELD related Part
126 virtual void setFieldName ( const string & fieldName);
128 void setId ( int id = MED_INVALID );
129 int getId ( void ) const ;
130 string getFileName () const;
131 void setFileName ( const string & fileName);
132 virtual MED_EN::med_mode_acces getAccessMode() const;
137 #endif /* GENDRIVER_HXX */