Salome HOME
PAL18696 SMESH : version of MED export
authoreap <eap@opencascade.com>
Tue, 29 Jan 2008 13:43:39 +0000 (13:43 +0000)
committereap <eap@opencascade.com>
Tue, 29 Jan 2008 13:43:39 +0000 (13:43 +0000)
+  static std::string GetVersionString(const MED::EVersion theVersion, int theNbDigits=2);

src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.h

index cf9381ce9b1519bbe3c1dd95920f74a49c84f6cf..c0315233da06de6f5c0dd1483abdacf8e2aedea1 100644 (file)
@@ -66,6 +66,24 @@ void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName)
   return SetFile(theFileName,MED::eV2_2);
 }
 
+string DriverMED_W_SMESHDS_Mesh::GetVersionString(const MED::EVersion theVersion, int theNbDigits)
+{
+  TInt majeur, mineur, release;
+  majeur =  mineur = release = 0;
+  if ( theVersion == eV2_1 )
+    MED::GetVersionRelease<eV2_1>(majeur, mineur, release);
+  else
+    MED::GetVersionRelease<eV2_2>(majeur, mineur, release);
+  ostringstream name;
+  if ( theNbDigits > 0 )
+    name << majeur;
+  if ( theNbDigits > 1 )
+    name << "." << mineur;
+  if ( theNbDigits > 2 )
+    name << "." << release;
+  return name.str();
+}
+
 void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName)
 {
   myMeshName = theMeshName;
index 80f79229893c93003dce191abdcba74c5320ce6e..899c4375bd13644293b859d0034718421873a88a 100644 (file)
@@ -48,6 +48,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
 
   virtual void SetFile(const std::string& theFileName);
   void SetFile(const std::string& theFileName, MED::EVersion theId);
+  static std::string GetVersionString(const MED::EVersion theVersion, int theNbDigits=2);
 
   /*! sets file name; only for usage with Add(), not Write()
    */