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/
20 #include "MEDMEM_GenDriver.hxx"
21 #include "MEDMEM_STRING.hxx"
22 #include "MEDMEM_Exception.hxx"
25 using namespace MEDMEM;
26 using namespace MED_EN;
28 GENDRIVER::GENDRIVER(): _id(MED_INVALID),
30 _accessMode( (med_mode_acces) MED_INVALID ),
32 _driverType(NO_DRIVER) {}
34 GENDRIVER::GENDRIVER(const string & fileName,
35 med_mode_acces accessMode=(med_mode_acces) MED_INVALID): _id(MED_INVALID),
37 _accessMode(accessMode),
39 _driverType(NO_DRIVER) {}
41 GENDRIVER::GENDRIVER(const GENDRIVER & genDriver):
44 _fileName(genDriver._fileName),
45 _accessMode(genDriver._accessMode),
46 _status(genDriver._status),
47 _driverType(genDriver._driverType)
50 GENDRIVER::~GENDRIVER() {}
53 GENDRIVER & MEDMEM::GENDRIVER::operator=(const GENDRIVER & genDriver)
55 const char * LOC = " GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) : ";
58 _fileName = genDriver._fileName;
59 _accessMode = genDriver._accessMode;
60 _status = genDriver._status;
65 void GENDRIVER::writeFrom ( void ) {};
66 void GENDRIVER::readFileStruct ( void ) {};
68 void GENDRIVER::setMeshName (const string & ) {};
69 void GENDRIVER::setFieldName (const string & ) {};
71 void GENDRIVER::openAppend ( void ) {};
72 void GENDRIVER::writeAppend ( void ) const {};
74 void GENDRIVER::setId ( int id ) {
75 const char * LOC = "void GENDRIVER::setId ( int id ) : ";
79 if ( id >= 0 ) _id=id; else _id = MED_INVALID ;
84 int GENDRIVER::getId ( void) const {
85 const char * LOC = "int GENDRIVER::getId ( void) const ";
92 string GENDRIVER::getFileName() const {
94 const char * LOC = "string GENDRIVER::getFileName() const : ";
101 void GENDRIVER::setFileName(const string & fileName) {
103 const char * LOC = "void GENDRIVER::setFileName(const string & fileName) : ";
106 if ( _status == MED_OPENED )
107 throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<" File |" << _fileName
108 << "| is still openned, close it before openning : | " << fileName << "|"));
110 _fileName = fileName;
117 med_mode_acces GENDRIVER::getAccessMode() const {
119 const char * LOC = "med_mode_acces GENDRIVER::getAccessMode() const : ";
126 ostream & MEDMEM::operator<<(ostream &os,const GENDRIVER & drv)
128 switch (drv._accessMode)
131 os<<"C'est un IO de READ"<<endl;
134 os<<"C'est un IO d'READ/WRITE"<<endl;
137 os <<"C'est un IO de remplacement"<<endl;
143 os<<"L'IO_Mesh_MED est open"<<endl;
146 os<<"L'IO_Mesh_MED est fermé"<<endl;
149 os<<"L'IO_Mesh_MED est non-valide"<<endl;
155 // Test if this driver has been created from MED driver
156 bool MEDMEM::GENDRIVER::operator ==(const GENDRIVER &genDriver) const {
158 const char * LOC = "bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const : ";
162 return ( _id == genDriver._id ) &&
163 ( _driverType == genDriver._driverType ) &&
164 (_accessMode == genDriver._accessMode);