1 // SMESH SMESH : implementaion of SMESH idl descriptions
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SMESH_Hypothesis.hxx
25 // Author : Edward AGAPOV (eap)
29 #ifndef SMESH_ComputeError_HeaderFile
30 #define SMESH_ComputeError_HeaderFile
33 #include <boost/shared_ptr.hpp>
36 struct SMESH_ComputeError;
38 typedef boost::shared_ptr<SMESH_ComputeError> SMESH_ComputeErrorPtr;
40 // =============================================================
42 enum SMESH_ComputeErrorName
44 // If you modify it, pls update SMESH_ComputeError::CommonName() below.
45 // Positive values are for algo specific errors
47 COMPERR_BAD_INPUT_MESH = -2, //!< wrong mesh on lower submesh
48 COMPERR_STD_EXCEPTION = -3, //!< some std exception raised
49 COMPERR_OCC_EXCEPTION = -4, //!< OCC exception raised
50 COMPERR_SLM_EXCEPTION = -5, //!< SALOME exception raised
51 COMPERR_EXCEPTION = -6, //!< other exception raised
52 COMPERR_MEMORY_PB = -7, //!< std::bad_alloc exception
53 COMPERR_ALGO_FAILED = -8, //!< algo failed for some reason
54 COMPERR_BAD_SHAPE = -9 //!< bad geometry
57 // =============================================================
59 * \brief Contains algorithm and description of occured error
61 // =============================================================
63 struct SMESH_ComputeError
65 int myName; //!< SMESH_ComputeErrorName or anything algo specific
66 std::string myComment;
67 const SMESH_Algo* myAlgo;
69 static SMESH_ComputeErrorPtr New( int error = COMPERR_OK,
70 std::string comment = "",
71 const SMESH_Algo* algo = 0)
72 { return SMESH_ComputeErrorPtr( new SMESH_ComputeError( error, comment, algo )); }
74 SMESH_ComputeError(int error = COMPERR_OK,
75 std::string comment = "",
76 const SMESH_Algo* algo = 0)
77 :myName(error),myComment(comment),myAlgo(algo) {}
79 bool IsOK() { return myName == COMPERR_OK; }
80 bool IsCommon() { return myName < 0; }
81 inline std::string CommonName() const;
85 #define case2char(err) case err: return #err;
87 std::string SMESH_ComputeError::CommonName() const
90 case2char(COMPERR_OK );
91 case2char(COMPERR_BAD_INPUT_MESH);
92 case2char(COMPERR_STD_EXCEPTION );
93 case2char(COMPERR_OCC_EXCEPTION );
94 case2char(COMPERR_SLM_EXCEPTION );
95 case2char(COMPERR_EXCEPTION );
96 case2char(COMPERR_MEMORY_PB );
97 case2char(COMPERR_ALGO_FAILED );