Salome HOME
update after merging trhe branches CEA_V3_0_x, OCC_V3_1_0_a1_x, and the main
[modules/med.git] / src / MEDMEM / MEDMEM_GenDriver.hxx
index b24d4882d19dd86d9a0cb42706e8a5aeb19517de..19e5f9084944903741b6cb476a2d2120b6f77998 100644 (file)
@@ -4,15 +4,21 @@
 #include <string>
 
 #include "MEDMEM_define.hxx"
-#include "utilities.h"
+#include "MEDMEM_Utilities.hxx"
 
 /* Generic Read/Write Driver Class for Meshes & Fields */
 
-typedef enum { MED_DRIVER = 0, VTK_DRIVER = 1, NO_DRIVER = 255 } driverTypes;
-
-using namespace MED_EN;
 using namespace std;
 
+/*!
+
+  Virtual class GENDRIVER use by all driver.
+
+*/
+namespace MEDMEM {
+
+/* Modify the following line to add a new driver type (step 1) */
+typedef enum { MED_DRIVER = 0, GIBI_DRIVER = 1, PORFLOW_DRIVER = 2, VTK_DRIVER = 254, ASCII_DRIVER = 3, NO_DRIVER = 255 } driverTypes;
 class GENDRIVER {
 
 protected :
@@ -20,29 +26,72 @@ protected :
   int            _id;         // MED_INVALID : if the driver hasn't been created by a MedMedDriver
                               // the MedMedDriver index of the driver vector in the MED object where it has been created
   /*File related part*/
-  string         _fileName;
-  med_mode_acces _accessMode; 
-  int            _status;
+  string         _fileName;   // The name of the file currently in use.
+  MED_EN::med_mode_acces _accessMode; // The file access mode set by the adequate construtor.
+  int            _status;     // The file status {MED_INVALID, MED_OPENED, MED_CLOSED } 
   driverTypes    _driverType; //  A FAIRE LE POSITIONNER DS TOUTES LES SS CLASSES !!
 
+
 public:
+  /*!
+    Constructor.
+  */
   GENDRIVER();
-  
-  GENDRIVER(const string & fileName,med_mode_acces accessMode);
+  /*!
+    Constructor.
+  */
+  GENDRIVER(const string & fileName,MED_EN::med_mode_acces accessMode);
+  /*!
+    Copy constructor.
+  */
   GENDRIVER(const GENDRIVER & genDriver);
-  ~GENDRIVER();
 
+  /*!
+    Destructor.
+  */
+  virtual ~GENDRIVER();
+
+  /*!
+    Operator = : duplicate the given genDriver.
+  */
   GENDRIVER & operator=(const GENDRIVER & genDriver);
 
+  /*!
+    Operator << : put GENDRIVER object information to the given stream
+  */
   friend ostream & operator<<(ostream &os,const GENDRIVER &genDriver);
 
   bool operator ==(const GENDRIVER &genDriver) const;
+  /*!
+    Open file.
+  */
   virtual void open ( void ) = 0;
+  /*!
+    Open file with the append option. This method is used especially
+    on ASCII drivers (e.g. VTK_DRIVER).
+  */
+  virtual void openAppend ( void );
+  /*!
+    Close file.
+  */
   virtual void close( void ) = 0;
+  /*!
+    Write object in opened file.
+  */
   virtual void write( void ) const = 0;
+  /*!
+    Write object in opened file. This method is used especially
+    on ASCII drivers (e.g. VTK_DRIVER).
+  */
+  virtual void writeAppend( void ) const;
+  /*!
+    Read object in opened file.
+  */
   virtual void read ( void ) = 0;
   
+  // needed to duplicate arrays 
+  virtual GENDRIVER * copy ( void ) const = 0 ;
+
   // MED  related part
   virtual void writeFrom      ( void );
   virtual void readFileStruct ( void );
@@ -55,9 +104,9 @@ public:
   int    getId       ( void ) const ;
   string getFileName () const;
   void   setFileName ( const string & fileName);
-  med_mode_acces getAccessMode() const;
+  MED_EN::med_mode_acces getAccessMode() const;
+};
 };
-
 
 
 #endif /* GENDRIVER_HXX */