From 6725a9aa576adc69dfbe6a905fcc7751489398f4 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 10 Aug 2011 10:09:22 +0000 Subject: [PATCH] 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); --- src/Driver/Driver_Mesh.cxx | 35 +++++++++++++++++++++++++++++++++++ src/Driver/Driver_Mesh.h | 6 ++++++ 2 files changed, 41 insertions(+) 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 -- 2.39.2