42cf5bc1 |
1 | // Created on: 1993-02-02 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Interface_CheckTool_HeaderFile |
18 | #define _Interface_CheckTool_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Interface_ShareTool.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | class Interface_GTool; |
28 | class Interface_CheckFailure; |
29 | class Interface_InterfaceModel; |
30 | class Interface_Protocol; |
31 | class Interface_Graph; |
32 | class Interface_HGraph; |
33 | class Standard_Transient; |
34 | class Interface_ShareTool; |
35 | class Interface_Check; |
36 | class Message_Messenger; |
37 | class Interface_CheckIterator; |
38 | class Interface_EntityIterator; |
39 | |
40 | |
41 | //! Performs Checks on Entities, using General Service Library and |
42 | //! Modules to work. Works on one Entity or on a complete Model |
43 | class Interface_CheckTool |
44 | { |
45 | public: |
46 | |
47 | DEFINE_STANDARD_ALLOC |
48 | |
49 | |
50 | //! Creates a CheckTool, by calling the General Service Library |
51 | //! and Modules, selected through a Protocol, to work on a Model |
52 | //! Moreover, Protocol recognizes Unknown Entities |
53 | Standard_EXPORT Interface_CheckTool(const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol); |
54 | |
55 | //! Creates a CheckTool, by calling the General Service Library |
56 | //! and Modules, selected through a Protocol, to work on a Model |
57 | //! Protocol and so on are taken from the Model (its GTool) |
58 | Standard_EXPORT Interface_CheckTool(const Handle(Interface_InterfaceModel)& model); |
59 | |
60 | //! Creates a CheckTool from a Graph. The Graph contains a Model |
61 | //! which designates a Protocol: they are used to create ShareTool |
62 | Standard_EXPORT Interface_CheckTool(const Interface_Graph& graph); |
63 | |
64 | Standard_EXPORT Interface_CheckTool(const Handle(Interface_HGraph)& hgraph); |
65 | |
66 | //! Fills as required a Check with the Error and Warning messages |
67 | //! produced by Checking a given Entity. |
68 | //! For an Erroneous or Corrected Entity : Check build at Analyse |
69 | //! time; else, Check computed for Entity (Verify integrity), can |
70 | //! use a Graph as required to control context |
71 | Standard_EXPORT void FillCheck (const Handle(Standard_Transient)& ent, const Interface_ShareTool& sh, Handle(Interface_Check)& ach); |
72 | |
73 | //! Utility method which Prints the content of a Check |
74 | Standard_EXPORT void Print (const Handle(Interface_Check)& ach, const Handle(Message_Messenger)& S) const; |
75 | |
76 | //! Simply Lists all the Checks and the Content (messages) and the |
77 | //! Entity, if there is, of each Check |
78 | //! (if all Checks are OK, nothing is Printed) |
79 | Standard_EXPORT void Print (const Interface_CheckIterator& list, const Handle(Message_Messenger)& S) const; |
80 | |
81 | //! Returns the Check associated to an Entity identified by |
82 | //! its Number in a Model. |
83 | Standard_EXPORT Handle(Interface_Check) Check (const Standard_Integer num); |
84 | |
85 | //! Checks if any Error has been detected (CheckList not empty) |
86 | //! Returns normally if none, raises exception if some exists. |
87 | //! It reuses the last computations from other checking methods, |
88 | //! unless the argument <resest> is given True |
89 | Standard_EXPORT void CheckSuccess (const Standard_Boolean reset = Standard_False); |
90 | |
91 | //! Returns list of all "remarkable" informations, which include : |
92 | //! - GlobalCheck, if not empty |
93 | //! - Error Checks, for all Errors (Verify + Analyse) |
94 | //! - also Corrected Entities |
95 | //! - and Unknown Entities : for those, each Unknown Entity is |
96 | //! associated to an empty Check (it is neither an Error nor a |
97 | //! Correction, but a remarkable information) |
98 | Standard_EXPORT Interface_CheckIterator CompleteCheckList(); |
99 | |
100 | //! Returns list of all Errors detected |
101 | //! Note that presence of Unknown Entities is not an error |
102 | //! Cumulates : GlobalCheck if error + |
103 | //! AnalyseCheckList + VerifyCheckList |
104 | Standard_EXPORT Interface_CheckIterator CheckList(); |
105 | |
106 | //! Returns list of errors dectected at Analyse time (syntactic) |
107 | //! (note that GlobalCheck is not in this list) |
108 | Standard_EXPORT Interface_CheckIterator AnalyseCheckList(); |
109 | |
110 | //! Returns list of integrity constraints errors (semantic) |
111 | //! (note that GlobalCheck is not in this list) |
112 | Standard_EXPORT Interface_CheckIterator VerifyCheckList(); |
113 | |
114 | //! Returns list of Corrections (includes GlobalCheck if corrected) |
115 | Standard_EXPORT Interface_CheckIterator WarningCheckList(); |
116 | |
117 | //! Returns list of Unknown Entities |
118 | //! Note that Error and Erroneous Entities are not considered |
119 | //! as Unknown |
120 | Standard_EXPORT Interface_EntityIterator UnknownEntities(); |
121 | |
122 | |
123 | |
124 | |
125 | protected: |
126 | |
127 | |
128 | |
129 | |
130 | |
131 | private: |
132 | |
133 | |
134 | |
135 | Handle(Interface_GTool) thegtool; |
136 | Interface_ShareTool theshare; |
137 | Standard_Integer thestat; |
138 | |
139 | |
140 | }; |
141 | |
142 | |
143 | |
144 | |
145 | |
146 | |
147 | |
148 | #endif // _Interface_CheckTool_HeaderFile |