f4ac23bedc2d847ccb497a63e52a959dd8481dcb
[occt.git] / src / Interface / Interface_CheckTool.hxx
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 Interface_CheckIterator;
37 class Interface_EntityIterator;
38
39
40 //! Performs Checks on Entities, using General Service Library and
41 //! Modules to work. Works on one Entity or on a complete Model
42 class Interface_CheckTool 
43 {
44 public:
45
46   DEFINE_STANDARD_ALLOC
47
48   
49   //! Creates a CheckTool, by calling the General Service Library
50   //! and Modules, selected through a Protocol, to work on a Model
51   //! Moreover, Protocol recognizes Unknown Entities
52   Standard_EXPORT Interface_CheckTool(const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& protocol);
53   
54   //! Creates a CheckTool, by calling the General Service Library
55   //! and Modules, selected through a Protocol, to work on a Model
56   //! Protocol and so on are taken from the Model (its GTool)
57   Standard_EXPORT Interface_CheckTool(const Handle(Interface_InterfaceModel)& model);
58   
59   //! Creates a CheckTool from a Graph. The Graph contains a Model
60   //! which designates a Protocol: they are used to create ShareTool
61   Standard_EXPORT Interface_CheckTool(const Interface_Graph& graph);
62   
63   Standard_EXPORT Interface_CheckTool(const Handle(Interface_HGraph)& hgraph);
64   
65   //! Fills as required a Check with the Error and Warning messages
66   //! produced by Checking a given Entity.
67   //! For an Erroneous or Corrected Entity : Check build at Analyse
68   //! time; else, Check computed for Entity (Verify integrity), can
69   //! use a Graph as required to control context
70   Standard_EXPORT void FillCheck (const Handle(Standard_Transient)& ent, const Interface_ShareTool& sh, Handle(Interface_Check)& ach);
71   
72   //! Utility method which Prints the content of a Check
73   Standard_EXPORT void Print (const Handle(Interface_Check)& ach, Standard_OStream& S) const;
74   
75   //! Simply Lists all the Checks and the Content (messages) and the
76   //! Entity, if there is, of each Check
77   //! (if all Checks are OK, nothing is Printed)
78   Standard_EXPORT void Print (const Interface_CheckIterator& list, Standard_OStream& S) const;
79   
80   //! Returns the Check associated to an Entity identified by
81   //! its Number in a Model.
82   Standard_EXPORT Handle(Interface_Check) Check (const Standard_Integer num);
83   
84   //! Checks if any Error has been detected (CheckList not empty)
85   //! Returns normally if none, raises exception if some exists.
86   //! It reuses the last computations from other checking methods,
87   //! unless the argument <resest> is given True
88   Standard_EXPORT void CheckSuccess (const Standard_Boolean reset = Standard_False);
89   
90   //! Returns list of all "remarkable" informations, which include :
91   //! - GlobalCheck, if not empty
92   //! - Error Checks, for all Errors (Verify + Analyse)
93   //! - also Corrected Entities
94   //! - and Unknown Entities : for those, each Unknown Entity is
95   //! associated to an empty Check (it is neither an Error nor a
96   //! Correction, but a remarkable information)
97   Standard_EXPORT Interface_CheckIterator CompleteCheckList();
98   
99   //! Returns list of all Errors detected
100   //! Note that presence of Unknown Entities is not an error
101   //! Cumulates : GlobalCheck if error +
102   //! AnalyseCheckList + VerifyCheckList
103   Standard_EXPORT Interface_CheckIterator CheckList();
104   
105   //! Returns list of errors dectected at Analyse time (syntactic)
106   //! (note that GlobalCheck is not in this list)
107   Standard_EXPORT Interface_CheckIterator AnalyseCheckList();
108   
109   //! Returns list of integrity constraints errors (semantic)
110   //! (note that GlobalCheck is not in this list)
111   Standard_EXPORT Interface_CheckIterator VerifyCheckList();
112   
113   //! Returns list of Corrections (includes GlobalCheck if corrected)
114   Standard_EXPORT Interface_CheckIterator WarningCheckList();
115   
116   //! Returns list of Unknown Entities
117   //! Note that Error and Erroneous Entities are not considered
118   //! as Unknown
119   Standard_EXPORT Interface_EntityIterator UnknownEntities();
120
121
122
123
124 protected:
125
126
127
128
129
130 private:
131
132
133
134   Handle(Interface_GTool) thegtool;
135   Interface_ShareTool theshare;
136   Standard_Integer thestat;
137
138
139 };
140
141
142
143
144
145
146
147 #endif // _Interface_CheckTool_HeaderFile