Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / SketchSolver / SketchSolver_Error.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef SketchSolver_Error_H_
22 #define SketchSolver_Error_H_
23
24 #include <string>
25
26 /** \class SketchSolver_Error
27  *  \ingroup Plugins
28  *  \brief Collects all sketch solver error' codes
29  *         as inline static functions
30  */
31 class SketchSolver_Error
32 {
33  public:
34   /// The value parameter for the constraint
35   inline static const std::string& CONSTRAINTS()
36   {
37     static const std::string MY_ERROR_VALUE("The constraint is conflicting with others. "
38       "To fix this, you can either undo your operation or remove a conflicting constraint.");
39     return MY_ERROR_VALUE;
40   }
41   /// Cyclic dependency of copied features with their originals
42   inline static const std::string& INFINITE_LOOP()
43   {
44     static const std::string MY_ERROR_VALUE(
45       "There is a circular reference between copied sketch entities and their originals. "
46       "To fix this, you can either undo your operation or remove wrong constraint.");
47     return MY_ERROR_VALUE;
48   }
49   /// Constraints should use objects instead of features as attributes
50   inline static const std::string& NEED_OBJECT_NOT_FEATURE()
51   {
52     static const std::string
53       MY_ERROR_VALUE("Constraint should be based on object instead of feature");
54     return MY_ERROR_VALUE;
55   }
56   /// The entities need to have shared point, but they have not
57   inline static const std::string& NO_COINCIDENT_POINTS()
58   {
59     static const std::string MY_ERROR_VALUE("Objects should have coincident point");
60     return MY_ERROR_VALUE;
61   }
62   /// Attribute of a feature is not initialized
63   inline static const std::string& NOT_INITIALIZED()
64   {
65     static const std::string MY_ERROR_VALUE("Attribute is not initialized");
66     return MY_ERROR_VALUE;
67   }
68   /// Constraint has wrong attributes
69   inline static const std::string& INCORRECT_ATTRIBUTE()
70   {
71     static const std::string MY_ERROR_VALUE("Incorrect attribute");
72     return MY_ERROR_VALUE;
73   }
74   /// Tangency constraint has wrong attributes
75   inline static const std::string& INCORRECT_TANGENCY_ATTRIBUTE()
76   {
77     static const std::string MY_ERROR_VALUE("An arc should be an attribute of tangency constraint");
78     return MY_ERROR_VALUE;
79   }
80   /// Mirror constraint has wrong attributes
81   inline static const std::string& INCORRECT_MIRROR_ATTRIBUTE()
82   {
83     static const std::string MY_ERROR_VALUE("Mirror constraint has wrong attributes");
84     return MY_ERROR_VALUE;
85   }
86   /// Entity is already fixed
87   inline static const std::string& ALREADY_FIXED()
88   {
89     static const std::string MY_ERROR_VALUE("Entity already fixed");
90     return MY_ERROR_VALUE;
91   }
92   /// Tangency constraint has been built with wrong attributes
93   /// (for example, line and arc have two coincident points)
94   inline static const std::string& TANGENCY_FAILED()
95   {
96     static const std::string
97       MY_ERROR_VALUE("Unable to create tangency constraint on given attributes");
98     return MY_ERROR_VALUE;
99   }
100   /// Crash in SolveSpace
101   inline static const std::string& SOLVESPACE_CRASH()
102   {
103     static const std::string MY_ERROR_VALUE("Caution: SolveSpace crash! Constraints are wrong");
104     return MY_ERROR_VALUE;
105   }
106 };
107
108 #endif