From: eap Date: Wed, 10 Aug 2011 10:09:22 +0000 (+0000) Subject: 0020511: EDF 1101 SMESH : Add CGNS to Mesh Format Supported X-Git-Tag: V6_4_0a1~134 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6725a9aa576adc69dfbe6a905fcc7751489398f4;p=modules%2Fsmesh.git 0020511: EDF 1101 SMESH : Add CGNS to Mesh Format Supported + virtual void SetMeshName(const std::string& theMeshName); + virtual std::string GetMeshName() const; + Status addMessage(const std::string& msg, const bool isFatal=false); --- diff --git a/src/Driver/Driver_Mesh.cxx b/src/Driver/Driver_Mesh.cxx index 7ab7387c0..cebe63593 100644 --- a/src/Driver/Driver_Mesh.cxx +++ b/src/Driver/Driver_Mesh.cxx @@ -26,6 +26,8 @@ // #include "Driver_Mesh.h" +#include + 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; +} diff --git a/src/Driver/Driver_Mesh.h b/src/Driver/Driver_Mesh.h index 0e30d2f3a..08e59c8b5 100644 --- a/src/Driver/Driver_Mesh.h +++ b/src/Driver/Driver_Mesh.h @@ -28,6 +28,7 @@ #define _INCLUDE_DRIVER_MESH #include +#include #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