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
00027
00028 #ifndef SMESH_ComputeError_HeaderFile
00029 #define SMESH_ComputeError_HeaderFile
00030
00031 #include <string>
00032 #include <list>
00033 #include <boost/shared_ptr.hpp>
00034
00035 class SMESH_Algo;
00036 class SMDS_MeshElement;
00037 struct SMESH_ComputeError;
00038
00039 typedef boost::shared_ptr<SMESH_ComputeError> SMESH_ComputeErrorPtr;
00040
00041
00042
00043 enum SMESH_ComputeErrorName
00044 {
00045
00046
00047 COMPERR_OK = -1,
00048 COMPERR_BAD_INPUT_MESH = -2,
00049 COMPERR_STD_EXCEPTION = -3,
00050 COMPERR_OCC_EXCEPTION = -4,
00051 COMPERR_SLM_EXCEPTION = -5,
00052 COMPERR_EXCEPTION = -6,
00053 COMPERR_MEMORY_PB = -7,
00054 COMPERR_ALGO_FAILED = -8,
00055 COMPERR_BAD_SHAPE = -9
00056 };
00057
00058
00062
00063
00064 struct SMESH_ComputeError
00065 {
00066 int myName;
00067 std::string myComment;
00068 const SMESH_Algo* myAlgo;
00069
00070 std::list<const SMDS_MeshElement*> myBadElements;
00071
00072 static SMESH_ComputeErrorPtr New( int error = COMPERR_OK,
00073 std::string comment = "",
00074 const SMESH_Algo* algo = 0)
00075 { return SMESH_ComputeErrorPtr( new SMESH_ComputeError( error, comment, algo )); }
00076
00077 SMESH_ComputeError(int error = COMPERR_OK,
00078 std::string comment = "",
00079 const SMESH_Algo* algo = 0)
00080 :myName(error),myComment(comment),myAlgo(algo) {}
00081
00082 bool IsOK() { return myName == COMPERR_OK; }
00083 bool IsCommon() { return myName < 0; }
00084 inline std::string CommonName() const;
00085
00086 };
00087
00088 #define _case2char(err) case err: return #err;
00089
00090 std::string SMESH_ComputeError::CommonName() const
00091 {
00092 switch( myName ) {
00093 _case2char(COMPERR_OK );
00094 _case2char(COMPERR_BAD_INPUT_MESH);
00095 _case2char(COMPERR_STD_EXCEPTION );
00096 _case2char(COMPERR_OCC_EXCEPTION );
00097 _case2char(COMPERR_SLM_EXCEPTION );
00098 _case2char(COMPERR_EXCEPTION );
00099 _case2char(COMPERR_MEMORY_PB );
00100 _case2char(COMPERR_ALGO_FAILED );
00101 default:;
00102 }
00103 return "";
00104 }
00105
00106 #endif