0022807: Loading of STEP entities in model during reading of STEP file requires redun...
[occt.git] / src / Interface / Interface_Check.cdl
1 -- File:        Check.cdl
2 -- Created:     Mon Feb  3 15:20:02 1992
3 -- Author:      Christian CAILLET
4 --              <cky@phobox>
5 ---Copyright:    Matra Datavision 1992
6
7
8 class Check  from Interface inherits TShared
9
10     ---Purpose : Defines a Check, as a list of Fail or Warning Messages under
11     --           a literal form, which can be empty. A Check can also bring an
12     --           Entity, which is the Entity to which the messages apply
13     --           (this Entity may be any Transient Object).
14     --           
15     --           Messages can be stored in two forms : the definitive form
16     --           (the only one by default), and another form, the original
17     --           form, which can be different if it contains values to be
18     --           inserted (integers, reals, strings)
19     --           The original form can be more suitable for some operations
20     --           such as counting messages
21
22 uses Integer, Boolean, Transient from Standard,
23      CString, HAsciiString from TCollection,
24      HSequenceOfHAsciiString from TColStd,
25      Msg from Message, 
26      Messenger from Message,
27      CheckStatus from Interface
28
29 raises OutOfRange
30
31 is
32
33     Create returns Check;
34     ---Purpose : Allows definition of a Sequence. Used also for Global Check
35     --           of an InterfaceModel (which stores global messages for file)
36
37     Create (anentity : Transient) returns Check;
38     ---Purpose : Defines a Check on an Entity
39
40
41     SendFail (me : mutable; amsg : Msg from Message);
42     ---Purpose : New name for AddFail (Msg)
43
44     AddFail (me : mutable; amess : HAsciiString from TCollection)  is static;
45     ---Purpose : Records a new Fail message
46
47     AddFail (me : mutable; amess,orig : HAsciiString from TCollection)  is static;
48     ---Purpose : Records a new Fail message under two forms : final,original
49
50     AddFail (me : mutable; amess : CString; orig : CString = "")  is static;
51     ---Purpose : Records a new Fail message given as "error text" directly
52     --           If <orig> is given, a distinct original form is recorded
53     --           else (D), the original form equates <amess>
54
55     AddFail (me : mutable; amsg : Msg from Message);
56     ---Purpose : Records a new Fail from the definition of a Msg (Original+Value)
57
58     HasFailed (me) returns Boolean  is static;
59     ---Purpose : Returns True if Check brings at least one Fail Message
60
61     NbFails (me) returns Integer  is static;
62     ---Purpose : Returns count of recorded Fails
63
64     Fail (me; num : Integer; final : Boolean = Standard_True)
65         returns HAsciiString from TCollection
66     ---Purpose : Returns Fail Message as a String
67     --           Final form by default, Original form if <final> is False
68         raises OutOfRange  is static;
69     --           Error if <num> is out of range
70     ---C++ : return const &
71
72     CFail (me; num : Integer; final : Boolean = Standard_True) returns CString
73     ---Purpose : Same as above, but returns a CString (to be printed ...)
74     --           Final form by default, Original form if <final> is False
75         raises OutOfRange  is static;
76
77     Fails (me; final : Boolean = Standard_True) returns HSequenceOfHAsciiString
78         is static;
79     ---Purpose : Returns the list of Fails, for a frontal-engine logic
80     --           Final forms by default, Original forms if <final> is False
81     --           Can be empty
82
83
84     SendWarning (me : mutable; amsg : Msg from Message);
85     ---Purpose : New name for AddWarning
86
87     AddWarning (me : mutable; amess : HAsciiString from TCollection)  is static;
88     ---Purpose : Records a new Warning message
89
90     AddWarning (me : mutable; amess,orig : HAsciiString from TCollection)  is static;
91     ---Purpose : Records a new Warning message under two forms : final,original
92
93     AddWarning (me : mutable; amess : CString; orig : CString = "")  is static;
94     ---Purpose : Records a Warning message given as "warning message" directly
95     --           If <orig> is given, a distinct original form is recorded
96     --           else (D), the original form equates <amess>
97
98     AddWarning (me : mutable; amsg : Msg from Message);
99     ---Purpose : Records a new Warning from the definition of a Msg (Original+Value)
100
101     HasWarnings (me) returns Boolean  is static;
102     ---Purpose : Returns True if Check brings at least one Warning Message
103
104     NbWarnings (me) returns Integer  is static;
105     ---Purpose : Returns count of recorded Warning messages
106
107     Warning (me; num : Integer; final : Boolean = Standard_True)
108         returns HAsciiString from TCollection
109     ---Purpose : Returns Warning message as a String
110     --           Final form by default, Original form if <final> is False
111         raises OutOfRange is static;
112     --           Error if <num> is out of range
113     ---C++ : return const &
114
115     CWarning (me; num : Integer; final : Boolean = Standard_True) returns CString
116         raises OutOfRange is static;
117     ---Purpose : Same as above, but returns a CString (to be printed ...)
118     --           Final form by default, Original form if <final> is False
119
120     Warnings (me; final : Boolean = Standard_True) returns HSequenceOfHAsciiString
121         is static;
122     ---Purpose : Returns the list of Warnings, for a frontal-engine logic
123     --           Final forms by default, Original forms if <final> is False
124     --           Can be empty
125
126     SendMsg (me : mutable; amsg : Msg from Message);
127     ---Purpose : Records an information message
128     --           This does not change the status of the Check
129
130     NbInfoMsgs (me) returns Integer;
131     ---Purpose : Returns the count of recorded information messages
132
133     InfoMsg (me; num : Integer; final : Boolean = Standard_True)
134         returns HAsciiString from TCollection;
135     ---Purpose : Returns information message as a String
136     ---C++: return const &
137
138     CInfoMsg (me; num : Integer; final : Boolean = Standard_True) returns CString
139         raises OutOfRange is static;
140     ---Purpose : Same as above, but returns a CString (to be printed ...)
141     --           Final form by default, Original form if <final> is False
142
143     InfoMsgs(me; final : Boolean = Standard_True) returns HSequenceOfHAsciiString;
144     ---Purpose : Returns the list of Info Msg, for a frontal-engine logic
145     --           Final forms by default, Original forms if <final> is False
146     --           Can be empty
147
148
149     Status (me) returns CheckStatus is static;
150     ---Purpose : Returns the Check Status : OK, Warning or Fail
151
152     Complies (me; status : CheckStatus) returns Boolean  is static;
153     ---Purpose : Tells if Check Status complies with a given one
154     --           (i.e. also status for query)
155
156     Complies (me; mess : HAsciiString; incl : Integer; status : CheckStatus)
157         returns Boolean   is static;
158     ---Purpose : Tells if a message is brought by a Check, as follows :
159     --           <incl> = 0 : <mess> exactly matches one of the messages
160     --           <incl> < 0 : <mess> is contained by one of the messages
161     --           <incl> > 0 : <mess> contains one of the messages
162     --           For <status> : for CheckWarning and CheckFail, considers only
163     --             resp. Warning or Check messages. for CheckAny, considers all
164     --             other values are ignored (answer will be false)
165
166     HasEntity (me) returns Boolean  is static;
167     ---Purpose : Returns True if a Check is devoted to an entity; else, it is
168     --           global (for InterfaceModel's storing of global error messages)
169
170     Entity (me) returns any Transient  is static;
171     ---Purpose : Returns the entity on which the Check has been defined
172     ---C++ : return const &
173
174
175     Clear (me : mutable)  is static;
176     ---Purpose : Clears a check, in order to receive informations from transfer
177     --           (Messages and Entity)
178
179     ClearFails (me : mutable)  is static;
180     ---Purpose : Clears the Fail Messages (for instance to keep only Warnings)
181
182     ClearWarnings (me : mutable)  is static;
183     ---Purpose : Clears the Warning Messages (for instance to keep only Fails)
184
185     ClearInfoMsgs (me : mutable)  is static;
186     ---Purpose : Clears the Info Messages
187
188     Remove (me : mutable; mess : HAsciiString;
189             incl : Integer; status : CheckStatus)
190         returns Boolean  is static;
191     ---Purpose : Removes the messages which comply with <mess>, as follows :
192     --           <incl> = 0 : <mess> exactly matches one of the messages
193     --           <incl> < 0 : <mess> is contained by one of the messages
194     --           <incl> > 0 : <mess> contains one of the messages
195     --           For <status> : for CheckWarning and CheckFail, considers only
196     --             resp. Warning or Check messages. for CheckAny, considers all
197     --             other values are ignored (nothing is done)
198     --           Returns True if at least one message has been removed, False else
199
200     Mend   (me : mutable; pref : CString; num : Integer = 0)
201         returns Boolean  is static;
202     ---Purpose : Mends messages, according <pref> and <num>
203     --           According to <num>, works on the whole list of Fails if = 0(D)
204     --             or only one Fail message, given its rank
205     --           If <pref> is empty, converts Fail(s) to Warning(s)
206     --           Else, does the conversion but prefixes the new Warning(s) but
207     --           <pref> followed by a semi-column
208     --           Some reserved values of <pref> are :
209     --           "FM" : standard prefix "Mended" (can be translated)
210     --           "CF" : clears Fail(s)
211     --           "CW" : clears Warning(s) : here, <num> refers to Warning list
212     --           "CA" : clears all messages : here, <num> is ignored
213
214     SetEntity (me : mutable; anentity : any Transient)  is static;
215     ---Purpose : Receives an entity result of a Transfer
216
217     GetEntity (me : mutable; anentity : any Transient)  is static;
218     ---Purpose : same as SetEntity (old form kept for compatibility)
219     -- Warning : Does nothing if Entity field is not yet clear
220
221     GetMessages (me : mutable; other : Check)  is static;
222     ---Purpose : Copies messages stored in another Check, cumulating
223     --           Does not regard other's Entity. Used to cumulate messages
224
225     GetAsWarning (me : mutable; other : Check; failsonly : Boolean)  is static;
226     ---Purpose : Copies messages converted into Warning messages
227     --           If failsonly is true, only Fails are taken, and converted
228     --           else, Warnings are taken too. Does not regard Entity
229     --           Used to keep Fail messages as Warning, after a recovery
230
231
232     Print (me; S: Messenger from Message; level : Integer; final : Integer = 1);
233     ---Purpose : Prints the messages of the check to an Messenger
234     --           <level> = 1 : only fails
235     --           <level> = 2 : fails and warnings
236     --           <level> = 3 : all (fails, warnings, info msg)
237     --           <final> : if positive (D) prints final values of messages
238     --           if negative, prints originals
239     --           if null, prints both forms
240
241     Trace (me; level : Integer = -1; final : Integer = 1);
242     ---Purpose : Prints the messages of the check to the default trace file
243     --           By default, according to the default standard level
244     --           Else, according level (see method Print)
245
246 fields
247
248     thefails : HSequenceOfHAsciiString;
249     thefailo : HSequenceOfHAsciiString;
250     thewarns : HSequenceOfHAsciiString;
251     thewarno : HSequenceOfHAsciiString;
252     theinfos : HSequenceOfHAsciiString;
253     theinfoo : HSequenceOfHAsciiString;
254     theent   : Transient;  -- the checked entity
255
256 end Check;