1 // MED MEDMEM : MED files in memory
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : MEDMEM_GenDriver.cxx
28 #include "MEDMEM_GenDriver.hxx"
29 #include "MEDMEM_STRING.hxx"
30 #include "MEDMEM_Exception.hxx"
32 GENDRIVER::GENDRIVER(): _id(MED_INVALID),
34 _accessMode( (med_mode_acces) MED_INVALID ),
36 _driverType(NO_DRIVER) {}
38 GENDRIVER::GENDRIVER(const string & fileName,
39 med_mode_acces accessMode=(med_mode_acces) MED_INVALID): _id(MED_INVALID),
41 _accessMode(accessMode),
43 _driverType(NO_DRIVER) {}
45 GENDRIVER::GENDRIVER(const GENDRIVER & genDriver):
48 _fileName(genDriver._fileName),
49 _accessMode(genDriver._accessMode),
50 _status(genDriver._status),
51 _driverType(genDriver._driverType)
54 GENDRIVER::~GENDRIVER() {}
57 GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) {
58 const char * LOC = " GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) : ";
62 _fileName = genDriver._fileName;
63 _accessMode = genDriver._accessMode;
64 _status = genDriver._status;
71 void GENDRIVER::writeFrom ( void ) {};
72 void GENDRIVER::readFileStruct ( void ) {};
74 void GENDRIVER::setMeshName (const string & meshName) {};
75 void GENDRIVER::setFieldName (const string & fieldName) {};
77 void GENDRIVER::setId ( int id ) {
78 const char * LOC = "void GENDRIVER::setId ( int id ) : ";
82 if ( id >= 0 ) _id=id; else _id = MED_INVALID ;
87 int GENDRIVER::getId ( void) const {
88 const char * LOC = "int GENDRIVER::getId ( void) const ";
97 string GENDRIVER::getFileName() const {
99 const char * LOC = "string GENDRIVER::getFileName() const : ";
108 void GENDRIVER::setFileName(const string & fileName) {
110 const char * LOC = "void GENDRIVER::setFileName(const string & fileName) : ";
113 if ( _status == MED_OPENED )
114 throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<" File |" << _fileName
115 << "| is still openned, close it before openning : | " << fileName << "|"));
117 _fileName = fileName;
124 med_mode_acces GENDRIVER::getAccessMode() const {
126 const char * LOC = "med_mode_acces GENDRIVER::getAccessMode() const : ";
135 ostream & operator<<(ostream &os,const GENDRIVER & drv)
137 switch (drv._accessMode)
140 os<<"C'est un IO de READ"<<endl;
143 os<<"C'est un IO d'READ/WRITE"<<endl;
149 os<<"L'IO_Mesh_MED est open"<<endl;
152 os<<"L'IO_Mesh_MED est fermé"<<endl;
155 os<<"L'IO_Mesh_MED est non-valide"<<endl;
161 // Test if this driver has been created from MED driver
162 bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const {
164 const char * LOC = "bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const : ";
168 return ( _id == genDriver._id ) &&
169 ( _driverType == genDriver._driverType );