1 #include "MEDMEM_GenDriver.hxx"
2 #include "MEDMEM_STRING.hxx"
3 #include "MEDMEM_Exception.hxx"
6 using namespace MEDMEM;
7 using namespace MED_EN;
9 GENDRIVER::GENDRIVER(): _id(MED_INVALID),
11 _accessMode( (med_mode_acces) MED_INVALID ),
13 _driverType(NO_DRIVER) {}
15 GENDRIVER::GENDRIVER(const string & fileName,
16 med_mode_acces accessMode=(med_mode_acces) MED_INVALID): _id(MED_INVALID),
18 _accessMode(accessMode),
20 _driverType(NO_DRIVER) {}
22 GENDRIVER::GENDRIVER(const GENDRIVER & genDriver):
25 _fileName(genDriver._fileName),
26 _accessMode(genDriver._accessMode),
27 _status(genDriver._status),
28 _driverType(genDriver._driverType)
31 GENDRIVER::~GENDRIVER() {}
34 GENDRIVER & MEDMEM::GENDRIVER::operator=(const GENDRIVER & genDriver)
36 const char * LOC = " GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) : ";
39 _fileName = genDriver._fileName;
40 _accessMode = genDriver._accessMode;
41 _status = genDriver._status;
46 void GENDRIVER::writeFrom ( void ) {};
47 void GENDRIVER::readFileStruct ( void ) {};
49 void GENDRIVER::setMeshName (const string & ) {};
50 void GENDRIVER::setFieldName (const string & ) {};
52 void GENDRIVER::openAppend ( void ) {};
53 void GENDRIVER::writeAppend ( void ) const {};
55 void GENDRIVER::setId ( int id ) {
56 const char * LOC = "void GENDRIVER::setId ( int id ) : ";
60 if ( id >= 0 ) _id=id; else _id = MED_INVALID ;
65 int GENDRIVER::getId ( void) const {
66 const char * LOC = "int GENDRIVER::getId ( void) const ";
73 string GENDRIVER::getFileName() const {
75 const char * LOC = "string GENDRIVER::getFileName() const : ";
82 void GENDRIVER::setFileName(const string & fileName) {
84 const char * LOC = "void GENDRIVER::setFileName(const string & fileName) : ";
87 if ( _status == MED_OPENED )
88 throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<" File |" << _fileName
89 << "| is still openned, close it before openning : | " << fileName << "|"));
98 med_mode_acces GENDRIVER::getAccessMode() const {
100 const char * LOC = "med_mode_acces GENDRIVER::getAccessMode() const : ";
107 ostream & MEDMEM::operator<<(ostream &os,const GENDRIVER & drv)
109 switch (drv._accessMode)
112 os<<"C'est un IO de READ"<<endl;
115 os<<"C'est un IO d'READ/WRITE"<<endl;
118 os <<"C'est un IO de remplacement"<<endl;
124 os<<"L'IO_Mesh_MED est open"<<endl;
127 os<<"L'IO_Mesh_MED est fermé"<<endl;
130 os<<"L'IO_Mesh_MED est non-valide"<<endl;
136 // Test if this driver has been created from MED driver
137 bool MEDMEM::GENDRIVER::operator ==(const GENDRIVER &genDriver) const {
139 const char * LOC = "bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const : ";
143 return ( _id == genDriver._id ) &&
144 ( _driverType == genDriver._driverType );