2 #include "MEDMEM_GenDriver.hxx"
3 #include "MEDMEM_STRING.hxx"
4 #include "MEDMEM_Exception.hxx"
6 GENDRIVER::GENDRIVER(): _id(MED_INVALID),
8 _accessMode( (med_mode_acces) MED_INVALID ),
10 _driverType(NO_DRIVER) {}
12 GENDRIVER::GENDRIVER(const string & fileName,
13 med_mode_acces accessMode=(med_mode_acces) MED_INVALID): _id(MED_INVALID),
15 _accessMode(accessMode),
17 _driverType(NO_DRIVER) {}
19 GENDRIVER::GENDRIVER(const GENDRIVER & genDriver):
22 _fileName(genDriver._fileName),
23 _accessMode(genDriver._accessMode),
24 _status(genDriver._status),
25 _driverType(genDriver._driverType)
28 GENDRIVER::~GENDRIVER() {}
31 GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) {
32 const char * LOC = " GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) : ";
36 _fileName = genDriver._fileName;
37 _accessMode = genDriver._accessMode;
38 _status = genDriver._status;
45 void GENDRIVER::writeFrom ( void ) {};
46 void GENDRIVER::readFileStruct ( void ) {};
48 void GENDRIVER::setMeshName (const string & ) {};
49 void GENDRIVER::setFieldName (const string & ) {};
51 void GENDRIVER::openAppend ( void ) {};
52 void GENDRIVER::writeAppend ( void ) const {};
54 void GENDRIVER::setId ( int id ) {
55 const char * LOC = "void GENDRIVER::setId ( int id ) : ";
59 if ( id >= 0 ) _id=id; else _id = MED_INVALID ;
64 int GENDRIVER::getId ( void) const {
65 const char * LOC = "int GENDRIVER::getId ( void) const ";
74 string GENDRIVER::getFileName() const {
76 const char * LOC = "string GENDRIVER::getFileName() const : ";
85 void GENDRIVER::setFileName(const string & fileName) {
87 const char * LOC = "void GENDRIVER::setFileName(const string & fileName) : ";
90 if ( _status == MED_OPENED )
91 throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<" File |" << _fileName
92 << "| is still openned, close it before openning : | " << fileName << "|"));
101 med_mode_acces GENDRIVER::getAccessMode() const {
103 const char * LOC = "med_mode_acces GENDRIVER::getAccessMode() const : ";
112 ostream & operator<<(ostream &os,const GENDRIVER & drv)
114 switch (drv._accessMode)
117 os<<"C'est un IO de READ"<<endl;
120 os<<"C'est un IO d'READ/WRITE"<<endl;
123 os <<"C'est un IO de remplacement"<<endl;
129 os<<"L'IO_Mesh_MED est open"<<endl;
132 os<<"L'IO_Mesh_MED est fermé"<<endl;
135 os<<"L'IO_Mesh_MED est non-valide"<<endl;
141 // Test if this driver has been created from MED driver
142 bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const {
144 const char * LOC = "bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const : ";
148 return ( _id == genDriver._id ) &&
149 ( _driverType == genDriver._driverType );