Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef SMESH_ComputeError_HeaderFile
00027 #define SMESH_ComputeError_HeaderFile
00028
00029 #include <string>
00030 #include <list>
00031 #include <boost/shared_ptr.hpp>
00032
00033 class SMESH_Algo;
00034 class SMDS_MeshElement;
00035 struct SMESH_ComputeError;
00036
00037 typedef boost::shared_ptr<SMESH_ComputeError> SMESH_ComputeErrorPtr;
00038
00039
00040
00041 enum SMESH_ComputeErrorName
00042 {
00043
00044
00045 COMPERR_OK = -1,
00046 COMPERR_BAD_INPUT_MESH = -2,
00047 COMPERR_STD_EXCEPTION = -3,
00048 COMPERR_OCC_EXCEPTION = -4,
00049 COMPERR_SLM_EXCEPTION = -5,
00050 COMPERR_EXCEPTION = -6,
00051 COMPERR_MEMORY_PB = -7,
00052 COMPERR_ALGO_FAILED = -8,
00053 COMPERR_BAD_SHAPE = -9
00054 };
00055
00056
00060
00061
00062 struct SMESH_ComputeError
00063 {
00064 int myName;
00065 std::string myComment;
00066 const SMESH_Algo* myAlgo;
00067
00068 std::list<const SMDS_MeshElement*> myBadElements;
00069
00070 static SMESH_ComputeErrorPtr New( int error = COMPERR_OK,
00071 std::string comment = "",
00072 const SMESH_Algo* algo = 0)
00073 { return SMESH_ComputeErrorPtr( new SMESH_ComputeError( error, comment, algo )); }
00074
00075 SMESH_ComputeError(int error = COMPERR_OK,
00076 std::string comment = "",
00077 const SMESH_Algo* algo = 0)
00078 :myName(error),myComment(comment),myAlgo(algo) {}
00079
00080 bool IsOK() { return myName == COMPERR_OK; }
00081 bool IsCommon() { return myName < 0; }
00082 inline std::string CommonName() const;
00083
00084 };
00085
00086 #define _case2char(err) case err: return #err;
00087
00088 std::string SMESH_ComputeError::CommonName() const
00089 {
00090 switch( myName ) {
00091 _case2char(COMPERR_OK );
00092 _case2char(COMPERR_BAD_INPUT_MESH);
00093 _case2char(COMPERR_STD_EXCEPTION );
00094 _case2char(COMPERR_OCC_EXCEPTION );
00095 _case2char(COMPERR_SLM_EXCEPTION );
00096 _case2char(COMPERR_EXCEPTION );
00097 _case2char(COMPERR_MEMORY_PB );
00098 _case2char(COMPERR_ALGO_FAILED );
00099 _case2char(COMPERR_BAD_SHAPE );
00100 default:;
00101 }
00102 return "";
00103 }
00104
00105 #endif