From: eap Date: Mon, 24 Sep 2012 11:13:16 +0000 (+0000) Subject: 021382: EDF 1985 SMESH: Read/write of .mesh files (GMF format) X-Git-Tag: V6_6_0a1~99 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=553185b191aa860ed8e52dee29ac30e5a13c391b;p=modules%2Fsmesh.git 021382: EDF 1985 SMESH: Read/write of .mesh files (GMF format) + virtual void SetOption(const std::string& optionName, + const std::string& optionValue) {} + virtual SMESH_ComputeErrorPtr GetError(); --- diff --git a/src/Driver/Driver_Mesh.cxx b/src/Driver/Driver_Mesh.cxx index 73895176f..c04008f94 100644 --- a/src/Driver/Driver_Mesh.cxx +++ b/src/Driver/Driver_Mesh.cxx @@ -26,13 +26,16 @@ // #include "Driver_Mesh.h" +#include "SMESH_Comment.hxx" + #include using namespace std; Driver_Mesh::Driver_Mesh(): myFile(""), - myMeshId(-1) + myMeshId(-1), + myStatus( DRS_OK ) {} @@ -78,5 +81,23 @@ Driver_Mesh::Status Driver_Mesh::addMessage(const std::string& msg, #ifdef _DEBUG_ cout << msg << endl; #endif - return isFatal ? DRS_FAIL : DRS_WARN_SKIP_ELEM; + return ( myStatus = isFatal ? DRS_FAIL : DRS_WARN_SKIP_ELEM ); +} + +//================================================================================ +/*! + * \brief Return a structure containing description of errors + */ +//================================================================================ + +SMESH_ComputeErrorPtr Driver_Mesh::GetError() +{ + SMESH_Comment msg; + for ( size_t i = 0; i < myErrorMessages.size(); ++i ) + { + msg << myErrorMessages[i]; + if ( i+1 < myErrorMessages.size() ) + msg << "\n"; + } + return SMESH_ComputeError::New( myStatus == DRS_OK ? int(COMPERR_OK) : int(myStatus), msg ); } diff --git a/src/Driver/Driver_Mesh.h b/src/Driver/Driver_Mesh.h index 45861a82a..fcaea2b3e 100644 --- a/src/Driver/Driver_Mesh.h +++ b/src/Driver/Driver_Mesh.h @@ -27,6 +27,8 @@ #ifndef _INCLUDE_DRIVER_MESH #define _INCLUDE_DRIVER_MESH +#include "SMESH_ComputeError.hxx" + #include #include @@ -55,19 +57,26 @@ class MESHDRIVER_EXPORT Driver_Mesh DRS_FAIL // general failure (exception etc.) }; - virtual Status Perform() = 0; - void SetMeshId(int theMeshId); - void SetFile(const std::string& theFileName); - virtual void SetMeshName(const std::string& theMeshName); + void SetMeshId(int theMeshId); + void SetFile(const std::string& theFileName); + virtual void SetMeshName(const std::string& theMeshName); virtual std::string GetMeshName() const; + virtual void SetOption(const std::string& optionName, + const std::string& optionValue) {} + + virtual Status Perform() = 0; + + virtual SMESH_ComputeErrorPtr GetError(); + protected: std::string myFile; std::string myMeshName; - int myMeshId; + int myMeshId; Status addMessage(const std::string& msg, const bool isFatal=false); std::vector< std::string > myErrorMessages; + Status myStatus; }; #endif