0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / Interface / Interface_CheckIterator.hxx
1 // Created on: 1992-10-28
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-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_CheckIterator_HeaderFile
18 #define _Interface_CheckIterator_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Interface_HSequenceOfCheck.hxx>
25 #include <TColStd_HSequenceOfInteger.hxx>
26 #include <TCollection_AsciiString.hxx>
27 #include <Standard_CString.hxx>
28 #include <Standard_Integer.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <Interface_CheckStatus.hxx>
31 #include <TColStd_HSequenceOfTransient.hxx>
32 class Interface_InterfaceModel;
33 class Interface_IntVal;
34 class Standard_NoSuchObject;
35 class Interface_Check;
36 class Standard_Transient;
37 class Message_Messenger;
38
39
40 //! Result of a Check operation (especially from InterfaceModel)
41 class Interface_CheckIterator 
42 {
43 public:
44
45   DEFINE_STANDARD_ALLOC
46
47   
48   //! Creates an empty CheckIterator
49   Standard_EXPORT Interface_CheckIterator();
50   
51   //! Creates a CheckIterator with a name (displayed by Print as a
52   //! title)
53   Standard_EXPORT Interface_CheckIterator(const Standard_CString name);
54   
55   //! Sets / Changes the name
56   Standard_EXPORT void SetName (const Standard_CString name);
57   
58   //! Returns the recorded name (can be empty)
59   Standard_EXPORT Standard_CString Name() const;
60   
61   //! Defines a Model, used to locate entities (not required, if it
62   //! is absent, entities are simply less documented)
63   Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
64   
65   //! Returns the stored model (can be a null handle)
66   Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
67   
68   //! Clears the list of checks
69   Standard_EXPORT void Clear();
70   
71   //! Merges another CheckIterator into <me>, i.e. adds each of its
72   //! Checks. Content of <other> remains unchanged.
73   //! Takes also the Model but not the Name
74   Standard_EXPORT void Merge (Interface_CheckIterator& other);
75   
76   //! Adds a Check to the list to be iterated
77   //! This Check is Accompanied by Entity Number in the Model
78   //! (0 for Global Check or Entity unknown in the Model), if 0 and
79   //! Model is recorded in <me>, it is computed
80   Standard_EXPORT void Add (const Handle(Interface_Check)& ach, const Standard_Integer num = 0);
81   
82   //! Returns the Check which was attached to an Entity given its
83   //! Number in the Model. <num>=0 is for the Global Check.
84   //! If no Check was recorded for this Number, returns an empty
85   //! Check.
86   //! Remark : Works apart from the iteration methods (no interference)
87   Standard_EXPORT const Handle(Interface_Check)& Check (const Standard_Integer num) const;
88   
89   //! Returns the Check attached to an Entity
90   //! If no Check was recorded for this Entity, returns an empty
91   //! Check.
92   //! Remark : Works apart from the iteration methods (no interference)
93   Standard_EXPORT const Handle(Interface_Check)& Check (const Handle(Standard_Transient)& ent) const;
94   
95   //! Returns the Check bound to an Entity Number (0 : Global)
96   //! in order to be consulted or completed on the spot
97   //! I.e. returns the Check if is already exists, or adds it then
98   //! returns the new empty Check
99   Standard_EXPORT Handle(Interface_Check)& CCheck (const Standard_Integer num);
100   
101   //! Returns the Check bound to an Entity, in order to be consulted
102   //! or completed on the spot
103   //! I.e. returns the Check if is already exists, or adds it then
104   //! returns the new empty Check
105   Standard_EXPORT Handle(Interface_Check)& CCheck (const Handle(Standard_Transient)& ent);
106   
107   //! Returns True if : no Fail has been recorded if <failsonly> is
108   //! True, no Check at all if <failsonly> is False
109   Standard_EXPORT Standard_Boolean IsEmpty (const Standard_Boolean failsonly) const;
110   
111   //! Returns worst status among : OK, Warning, Fail
112   Standard_EXPORT Interface_CheckStatus Status() const;
113   
114   //! Tells if this check list complies with a given status :
115   //! OK (i.e. empty),  Warning (at least one Warning, but no Fail),
116   //! Fail (at least one), Message (not OK), NoFail, Any
117   Standard_EXPORT Standard_Boolean Complies (const Interface_CheckStatus status) const;
118   
119   //! Returns a CheckIterator which contains the checks which comply
120   //! with a given status
121   //! Each check is added completely (no split Warning/Fail)
122   Standard_EXPORT Interface_CheckIterator Extract (const Interface_CheckStatus status) const;
123   
124   //! Returns a CheckIterator which contains the check which comply
125   //! with a message, plus some conditions as follows :
126   //! <incl> = 0 : <mess> exactly matches one of the messages
127   //! <incl> < 0 : <mess> is contained by one of the messages
128   //! <incl> > 0 : <mess> contains one of the messages
129   //! For <status> : for CheckWarning and CheckFail, considers only
130   //! resp. Warning or Check messages. for CheckAny, considers all
131   //! other values are ignored (answer will be false)
132   //! Each Check which complies is entirely taken
133   Standard_EXPORT Interface_CheckIterator Extract (const Standard_CString mess, const Standard_Integer incl, const Interface_CheckStatus status) const;
134   
135   //! Removes the messages of all Checks, under these conditions :
136   //! <incl> = 0 : <mess> exactly matches one of the messages
137   //! <incl> < 0 : <mess> is contained by one of the messages
138   //! <incl> > 0 : <mess> contains one of the messages
139   //! For <status> : for CheckWarning and CheckFail, considers only
140   //! resp. Warning or Check messages. for CheckAny, considers all
141   //! other values are ignored (nothing is done)
142   //! Returns True if at least one message has been removed, False else
143   Standard_EXPORT Standard_Boolean Remove (const Standard_CString mess, const Standard_Integer incl, const Interface_CheckStatus status);
144   
145   //! Returns the list of entities concerned by a Check
146   //! Only fails if <failsonly> is True, else all non-empty checks
147   //! If <global> is true, adds the model for a global check
148   //! Else, global check is ignored
149   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Checkeds (const Standard_Boolean failsonly, const Standard_Boolean global) const;
150   
151   //! Starts Iteration. Thus, it is possible to restart it
152   //! Remark : an iteration may be done with a const Iterator
153   //! While its content is modified (through a pointer), this allows
154   //! to give it as a const argument to a function
155   Standard_EXPORT void Start() const;
156   
157   //! Returns True if there are more Checks to get
158   Standard_EXPORT Standard_Boolean More() const;
159   
160   //! Sets Iteration to next Item
161   Standard_EXPORT void Next() const;
162   
163   //! Returns Check currently Iterated
164   //! It brings all other informations (status, messages, ...)
165   //! The Number of the Entity in the Model is given by Number below
166   Standard_EXPORT const Handle(Interface_Check)& Value() const;
167   
168   //! Returns Number of Entity for the Check currently iterated
169   //! or 0 for GlobalCheck
170   Standard_EXPORT Standard_Integer Number() const;
171   
172   //! Prints the list of Checks with their attached Numbers
173   //! If <failsonly> is True, prints only Fail messages
174   //! If <failsonly> is False, prints all messages
175   //! If <final> = 0 (D), prints also original messages if different
176   //! If <final> < 0, prints only original messages
177   //! If <final> > 0, prints only final messages
178   //! It uses the recorded Model if it is defined
179   //! Remark : Works apart from the iteration methods (no interference)
180   Standard_EXPORT void Print (const Handle(Message_Messenger)& S, const Standard_Boolean failsonly, const Standard_Integer final = 0) const;
181   
182   //! Works as Print without a model, but for entities which have
183   //! no attached number (Number not positive), tries to compute
184   //! this Number from <model> and displays "original" or "computed"
185   Standard_EXPORT void Print (const Handle(Message_Messenger)& S, const Handle(Interface_InterfaceModel)& model, const Standard_Boolean failsonly, const Standard_Integer final = 0) const;
186   
187   //! Clears data of iteration
188   Standard_EXPORT void Destroy();
189 ~Interface_CheckIterator()
190 {
191   Destroy();
192 }
193
194
195
196
197 protected:
198
199
200
201
202
203 private:
204
205
206
207   Handle(Interface_HSequenceOfCheck) thelist;
208   Handle(TColStd_HSequenceOfInteger) thenums;
209   Handle(Interface_InterfaceModel) themod;
210   TCollection_AsciiString thename;
211   Handle(Interface_IntVal) thecurr;
212
213
214 };
215
216
217
218
219
220
221
222 #endif // _Interface_CheckIterator_HeaderFile