Salome HOME
0020511: EDF 1101 SMESH : Add CGNS to Mesh Format Supported
authoreap <eap@opencascade.com>
Wed, 10 Aug 2011 10:09:22 +0000 (10:09 +0000)
committereap <eap@opencascade.com>
Wed, 10 Aug 2011 10:09:22 +0000 (10:09 +0000)
+  virtual void SetMeshName(const std::string& theMeshName);
+  virtual std::string GetMeshName() const;
+  Status addMessage(const std::string& msg, const bool isFatal=false);

src/Driver/Driver_Mesh.cxx
src/Driver/Driver_Mesh.h

index 7ab7387c0043a447177feff5d98859a56c7c538f..cebe63593dc87f2e568bc4ff1d19d5016ab2045c 100644 (file)
@@ -26,6 +26,8 @@
 //
 #include "Driver_Mesh.h"
 
+#include <utilities.h>
+
 using namespace std;
 
 Driver_Mesh::Driver_Mesh():
@@ -39,8 +41,41 @@ void Driver_Mesh::SetMeshId(int theMeshId)
   myMeshId = theMeshId;
 }
 
+void Driver_Mesh::SetMeshName(const std::string& theMeshName)
+{
+  myMeshName = theMeshName;
+}
+
+std::string Driver_Mesh::GetMeshName() const
+{
+  return myMeshName;
+}
+
 
 void Driver_Mesh::SetFile(const std::string& theFileName)
 {
   myFile = theFileName;
 }
+
+
+//================================================================================
+/*!
+ * \brief Stores an error message
+ *
+ * We consider an error fatal if none mesh can be read
+ */
+//================================================================================
+
+Driver_Mesh::Status Driver_Mesh::addMessage(const std::string& msg,
+                                            const bool         isFatal/*=false*/)
+{
+  if ( isFatal )
+    myErrorMessages.clear(); // warnings are useless if a fatal error encounters
+
+  myErrorMessages.push_back( msg );
+
+  MESSAGE(msg);
+  cout << msg << endl;
+
+  return isFatal ? DRS_FAIL : DRS_WARN_SKIP_ELEM;
+}
index 0e30d2f3afa8d491cacba4e62b97bc60ba4ed046..08e59c8b5ce8e945f8fde9fcda804e021bbf9ae7 100644 (file)
@@ -28,6 +28,7 @@
 #define _INCLUDE_DRIVER_MESH
 
 #include <string>
+#include <vector>
 
 #ifdef WNT
  #if defined MESHDRIVER_EXPORTS || defined MeshDriver_EXPORTS
@@ -57,11 +58,16 @@ class MESHDRIVER_EXPORT Driver_Mesh
   virtual Status Perform() = 0;
   void SetMeshId(int theMeshId);
   void SetFile(const std::string& theFileName);
+  virtual void SetMeshName(const std::string& theMeshName);
+  virtual std::string GetMeshName() const;
 
  protected:
   std::string myFile;
+  std::string myMeshName;
   int myMeshId;
 
+  Status addMessage(const std::string& msg, const bool isFatal=false);
+  std::vector< std::string > myErrorMessages;
 };
 
 #endif