2 #include "MEDMEM_GenDriver.hxx"
3 #include "MEDMEM_STRING.hxx"
4 #include "MEDMEM_Exception.hxx"
5 using namespace MEDMEM;
7 GENDRIVER::GENDRIVER(): _id(MED_INVALID),
9 _accessMode( (med_mode_acces) MED_INVALID ),
11 _driverType(NO_DRIVER) {}
13 GENDRIVER::GENDRIVER(const string & fileName,
14 med_mode_acces accessMode=(med_mode_acces) MED_INVALID): _id(MED_INVALID),
16 _accessMode(accessMode),
18 _driverType(NO_DRIVER) {}
20 GENDRIVER::GENDRIVER(const GENDRIVER & genDriver):
23 _fileName(genDriver._fileName),
24 _accessMode(genDriver._accessMode),
25 _status(genDriver._status),
26 _driverType(genDriver._driverType)
29 GENDRIVER::~GENDRIVER() {}
32 GENDRIVER & MEDMEM::GENDRIVER::operator=(const GENDRIVER & genDriver)
34 const char * LOC = " GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) : ";
37 _fileName = genDriver._fileName;
38 _accessMode = genDriver._accessMode;
39 _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 ";
75 string GENDRIVER::getFileName() const {
77 const char * LOC = "string GENDRIVER::getFileName() const : ";
86 void GENDRIVER::setFileName(const string & fileName) {
88 const char * LOC = "void GENDRIVER::setFileName(const string & fileName) : ";
91 if ( _status == MED_OPENED )
92 throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<" File |" << _fileName
93 << "| is still openned, close it before openning : | " << fileName << "|"));
102 med_mode_acces GENDRIVER::getAccessMode() const {
104 const char * LOC = "med_mode_acces GENDRIVER::getAccessMode() const : ";
113 ostream & MEDMEM::operator<<(ostream &os,const GENDRIVER & drv)
115 switch (drv._accessMode)
118 os<<"C'est un IO de READ"<<endl;
121 os<<"C'est un IO d'READ/WRITE"<<endl;
124 os <<"C'est un IO de remplacement"<<endl;
130 os<<"L'IO_Mesh_MED est open"<<endl;
133 os<<"L'IO_Mesh_MED est fermé"<<endl;
136 os<<"L'IO_Mesh_MED est non-valide"<<endl;
142 // Test if this driver has been created from MED driver
143 bool MEDMEM::GENDRIVER::operator ==(const GENDRIVER &genDriver) const {
145 const char * LOC = "bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const : ";
149 return ( _id == genDriver._id ) &&
150 ( _driverType == genDriver._driverType );