Test for 0022778: Bug in BRepMesh
[occt.git] / src / Interface / Interface_InterfaceModel.cdl
CommitLineData
b311480e 1-- Created by: Christian CAILLET <cky@phobox>
2-- Copyright (c) 1992-1999 Matra Datavision
3-- Copyright (c) 1999-2012 OPEN CASCADE SAS
4--
5-- The content of this file is subject to the Open CASCADE Technology Public
6-- License Version 6.5 (the "License"). You may not use the content of this file
7-- except in compliance with the License. Please obtain a copy of the License
8-- at http://www.opencascade.org and read it completely before using this file.
9--
10-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12--
13-- The Original Code and all software distributed under the License is
14-- distributed on an "AS IS" basis, without warranty of any kind, and the
15-- Initial Developer hereby disclaims all such warranties, including without
16-- limitation, any warranties of merchantability, fitness for a particular
17-- purpose or non-infringement. Please see the License for the specific terms
18-- and conditions governing the rights and limitations under the License.
19
7fd59977 20-- Modified : David Carbonel Mon 4 january 1999
21-- Add of DENumber function. no. and of PrintToLog
7fd59977 22
23
24deferred class InterfaceModel from Interface inherits TShared
25
26 ---Purpose : Defines an (Indexed) Set of data corresponding to a complete
27 -- Transfer by a File Interface, i.e. File Header and Transient
28 -- Entities (Objects) contained in a File. Contained Entities are
29 -- identified in the Model by unique and consecutive Numbers.
30 --
31 -- In addition, a Model can attach to each entity, a specific
32 -- Label according to the norm (e.g. Name for VDA, #ident for
33 -- Step ...), intended to be output on a string or a stream
34 -- (remark : labels are not obliged to be unique)
35 --
36 -- InterfaceModel itself is not Transient, it is intended to
37 -- work on a set of Transient Data. The services offered are
38 -- basic Listing and Identification operations on Transient
39 -- Entities, storage of Error Reports, Copying.
40 --
41 -- Moreovere, it is possible to define and use templates. These
42 -- are empty Models, from which copies can be obtained in order
43 -- to be filled with effective data. This allows to record
44 -- standard definitions for headers, avoiding to recreate them
45 -- for each sendings, and assuring customisation of produced
46 -- files for a given site.
47 -- A template is attached to a name. It is possible to define a
48 -- template from another one (get it, edit it then record it
49 -- under another name).
50 --
51 -- See also Graph, ShareTool, CheckTool for more
52
53uses Transient, IndexedMapOfTransient,
54 DataMapOfIntegerTransient from TColStd,
55 HAsciiString from TCollection,
56 HSequenceOfHAsciiString from TColStd,
57 Messenger from Message,
58 ReportEntity, Check, CheckIterator,
59 EntityIterator, GeneralLib, Protocol, GTool,
60 DataState
61
62raises OutOfRange, NoSuchObject, InterfaceMismatch
63
64is
65
66 Initialize;
67 ---Purpose : Defines empty InterfaceModel, ready to be filled
68
69 Destroy (me : mutable);
70 ---Purpose : Clears the list of entities (service WhenDelete)
71 ---C++ : alias ~
72
73 SetProtocol (me : mutable; proto : Protocol from Interface);
74 ---Purpose : Sets a Protocol for this Model
75 -- It is also set by a call to AddWithRefs with Protocol
76 -- It is used for : DumpHeader (as required), ClearEntities ...
77
78 Protocol (me) returns Protocol from Interface is virtual;
79 ---Purpose : Returns the Protocol which has been set by SetProtocol, or
80 -- AddWithRefs with Protocol
81
82 SetGTool (me : mutable; gtool : GTool from Interface);
83 ---Purpose : Sets a GTool for this model, which already defines a Protocol
84
85 GTool (me) returns GTool;
86 ---Purpose : Returns the GTool, set by SetProtocol or by SetGTool
87
88 DispatchStatus (me : mutable) returns Boolean;
89 ---Purpose : Returns the Dispatch Status, either for get or set
90 -- A Model which is produced from Dispatch may share entities
91 -- with the original (according to the Protocol), hence these
92 -- non-copied entities should not be deleted
93 ---C++ : return &
94
95 Clear (me : mutable) is virtual;
96 ---Purpose : Erases contained data; used when a Model is copied to others :
97 -- the new copied ones begin from clear
98 -- Clear calls specific method ClearHeader (see below)
99
100 ClearEntities (me : mutable) is virtual;
101 ---Purpose : Clears the entities; uses the general service WhenDelete, in
102 -- addition to the standard Memory Manager; can be redefined
103
104 ClearLabels (me : mutable) is deferred;
105 ---Purpose : Erases informations about labels, if any : specific to each
106 -- norm
107
108 ClearHeader (me : mutable) is deferred;
109 ---Purpose : Clears Model's header : specific to each norm
110
111 -- -- Unitary Accesses to Entities -- --
112
113 NbEntities (me) returns Integer;
114 ---Purpose : Returns count of contained Entities
115
116 Contains (me; anentity : Transient) returns Boolean;
117 ---Purpose : Returns True if a Model contains an Entity (for a ReportEntity,
118 -- looks for the ReportEntity itself AND its Concerned Entity)
119
120 Number (me; anentity : Transient) returns Integer;
121 ---Purpose : Returns the Number of an Entity in the Model if it contains it.
122 -- Else returns 0. For a ReportEntity, looks at Concerned Entity.
123
124-- DENumber (me; anentity : Transient) returns Integer;
125 ---Purpose : Returns the Directory entry Number of an Entity in
126 -- the Model if it contains it. Else returns 0. For a
127 -- ReportEntity, looks at Concerned Entity.
128
129 Value (me; num : Integer) returns mutable Transient raises OutOfRange;
130 ---Purpose : Returns an Entity identified by its number in the Model
131 -- Each sub-class of InterfaceModel can define its own method
132 -- Entity to return its specific class of Entity (e.g. for VDA,
133 -- VDAModel returns a VDAEntity), working by calling Value
134 -- Remark : For a Reported Entity, (Erroneous, Corrected, Unknown), this
135 -- method returns this Reported Entity.
136 -- See ReportEntity for other questions.
137 ---C++ : return const &
138
139 NbTypes (me; ent : Transient) returns Integer;
140 ---Purpose : Returns the count of DISTINCT types under which an entity may
141 -- be processed. Defined by the Protocol, which gives default as
142 -- 1 (dynamic Type).
143
144 Type (me; ent : Transient; num : Integer = 1) returns Type;
145 ---Purpose : Returns a type, given its rank : defined by the Protocol
146 -- (by default, the first one)
147
148 TypeName (me; ent : Transient; complete : Boolean = Standard_True)
149 returns CString;
150 ---Purpose : Returns the type name of an entity, from the list of types
151 -- (one or more ...)
152 -- <complete> True (D) gives the complete type, else packages are
153 -- removed
154 -- WARNING : buffered, to be immediately copied or printed
155
156 ClassName (myclass; typnam : CString) returns CString;
157 ---Purpose : From a CDL Type Name, returns the Class part (package dropped)
158 -- WARNING : buffered, to be immediately copied or printed
159
160 -- -- Report Entities (for syntactic concerns) -- --
161
162 EntityState (me; num : Integer) returns DataState raises OutOfRange;
163 ---Purpose : Returns the State of an entity, given its number
164
165 IsReportEntity (me; num : Integer; semantic : Boolean = Standard_False)
166 returns Boolean raises OutOfRange;
167 ---Purpose : Returns True if <num> identifies a ReportEntity in the Model
168 -- Hence, ReportEntity can be called.
169 --
170 -- By default, queries main report, if <semantic> is True, it
171 -- queries report for semantic check
172 --
173 -- Remember that a Report Entity can be defined for an Unknown
174 -- Entity, or a Corrected or Erroneous (at read time) Entity.
175 -- The ReportEntity is defined before call to method AddEntity.
176
177 ReportEntity (me; num : Integer; semantic : Boolean = Standard_False)
178 returns mutable ReportEntity
179 ---Purpose : Returns a ReportEntity identified by its number in the Model,
180 -- or a Null Handle If <num> does not identify a ReportEntity.
181 --
182 -- By default, queries main report, if <semantic> is True, it
183 -- queries report for semantic check
184 raises OutOfRange;
185 -- Error if <num> is out of range
186
187 IsErrorEntity (me; num : Integer) returns Boolean raises OutOfRange;
188 ---Purpose : Returns True if <num> identifies an Error Entity : in this
189 -- case, a ReportEntity brings Fail Messages and possibly an
190 -- "undefined" Content, see IsRedefinedEntity
191
192 IsRedefinedContent (me; num : Integer) returns Boolean raises OutOfRange;
193 ---Purpose : Returns True if <num> identifies an Entity which content is
194 -- redefined through a ReportEntity (i.e. with literal data only)
195 -- This happens when an entity is syntactically erroneous in the
196 -- way that its basic content remains empty.
197 -- For more details (such as content itself), see ReportEntity
198
199 ClearReportEntity (me : mutable; num : Integer) returns Boolean
200 ---Purpose : Removes the ReportEntity attached to Entity <num>. Returns
201 -- True if done, False if no ReportEntity was attached to <num>.
202 -- Warning : the caller must assume that this clearing is meaningfull
203 raises OutOfRange;
204 -- Error if <num> is out of range
205
206 SetReportEntity (me : mutable; num : Integer; rep : mutable ReportEntity)
207 returns Boolean
208 ---Purpose : Sets or Replaces a ReportEntity for the Entity <num>. Returns
209 -- True if Report is replaced, False if it has been replaced
210 -- Warning : the caller must assume that this setting is meaningfull
211 raises OutOfRange, InterfaceMismatch;
212 -- Error if <num> is out of range, or if concerned Entity is
213 -- not equal to Value(num)
214
215 AddReportEntity (me : mutable; rep : mutable ReportEntity;
216 semantic : Boolean = Standard_False) returns Boolean;
217 ---Purpose : Adds a ReportEntity as such. Returns False if the concerned
218 -- entity is not recorded in the Model
219 -- Else, adds it into, either the main report list or the
220 -- list for semantic checks, then returns True
221
222 IsUnknownEntity (me; num : Integer) returns Boolean raises OutOfRange;
223 ---Purpose : Returns True if <num> identifies an Unknown Entity : in this
224 -- case, a ReportEntity with no Check Messages designates it.
225
226 -- -- Checks (semantic & syntactic) -- --
227
228 FillSemanticChecks (me : mutable; checks : CheckIterator;
229 clear : Boolean = Standard_True);
230 ---Purpose : Fills the list of semantic checks.
231 -- This list is computed (by CheckTool). Hence, it can be stored
232 -- in the model for later queries
233 -- <clear> True (D) : new list replaces
234 -- <clear> False : new list is cumulated
235
236 HasSemanticChecks (me) returns Boolean;
237 ---Purpose : Returns True if semantic checks have been filled
238
239 Check (me; num : Integer; syntactic : Boolean) returns Check;
240 ---Purpose : Returns the check attached to an entity, designated by its
241 -- Number. 0 for global check
242 -- <semantic> True : recorded semantic check
243 -- <semantic> False : recorded syntactic check (see ReportEntity)
244 -- If no check is recorded for <num>, returns an empty Check
245 ---C++ : return const &
246
247 -- -- Editions -- --
248
249 Reservate (me : mutable; nbent : Integer) is virtual;
250 ---Purpose : Does a reservation for the List of Entities (for optimized
251 -- storage management). If it is not called, storage management
252 -- can be less efficient. <nbent> is the expected count of
253 -- Entities to store
254
255 AddEntity (me : mutable; anentity : mutable Transient)
256 ---Purpose : Internal method for adding an Entity. Used by file reading
257 -- (defined by each Interface) and Transfer tools. It adds the
258 -- entity required to be added, not its refs : see AddWithRefs.
259 -- If <anentity> is a ReportEntity, it is added to the list of
260 -- Reports, its Concerned Entity (Erroneous or Corrected, else
261 -- Unknown) is added to the list of Entities.
262 -- That is, the ReportEntity must be created before Adding
263 raises InterfaceMismatch is virtual;
264 -- Error if anentity already recorded
265
266 AddWithRefs (me : mutable; anent : mutable Transient; proto : Protocol;
267 level : Integer = 0; listall : Boolean = Standard_False);
268 ---Purpose : Adds to the Model, an Entity with all its References, as they
269 -- are defined by General Services FillShared and ListImplied.
270 -- Process is recursive (any sub-levels) if <level> = 0 (Default)
271 -- Else, adds sub-entities until the required sub-level.
272 -- Especially, if <level> = 1, adds immediate subs and that's all
273 --
274 -- If <listall> is False (Default), an entity (<anentity> itself
275 -- or one of its subs at any level) which is already recorded in
276 -- the Model is not analysed, only the newly added ones are.
277 -- If <listall> is True, all items are analysed (this allows to
278 -- ensure the consistency of an adding made by steps)
279
280 AddWithRefs (me : mutable; anent : mutable Transient;
281 level : Integer = 0; listall : Boolean = Standard_False)
282 ---Purpose : Same as above, but works with the Protocol of the Model
283 raises InterfaceMismatch;
284 -- Error if no Protocol is defined in the Model
285
286 AddWithRefs (me : mutable; anent : mutable Transient; lib : GeneralLib;
287 level : Integer = 0; listall : Boolean = Standard_False);
288 ---Purpose : Same as above, but works with an already created GeneralLib
289
290
291 ReplaceEntity (me : mutable; nument : Integer; anent : mutable Transient);
292 ---Purpose : Replace Entity with Number=nument on other entity - "anent"
293
294 ReverseOrders (me : mutable; after : Integer = 0);
295 ---Purpose : Reverses the Numbers of the Entities, between <after> and the
296 -- total count of Entities. Thus, the entities :
297 -- 1,2 ... after, after+1 ... nb-1, nb become numbered as :
298 -- 1,2 ... after, nb, nb-1 ... after+1
299 -- By default (after = 0) the whole list of Entities is reversed
300
301 ChangeOrder (me : mutable; oldnum, newnum : Integer; count : Integer = 1)
302 ---Purpose : Changes the Numbers of some Entities : <oldnum> is moved to
303 -- <newnum>, same for <count> entities. Thus :
304 -- 1,2 ... newnum-1 newnum ... oldnum .. oldnum+count oldnum+count+1 .. gives
305 -- 1,2 ... newnum-1 oldnum .. oldnum+count newnum ... oldnum+count+1
306 -- (can be seen as a circular permutation)
307 raises OutOfRange;
308 -- Error if one of <oldnum,newnum, and + count> is out of range,
309 -- or if <count> is greater than Abs(newnum-oldnum)
310
311 GetFromTransfer (me : mutable; aniter : EntityIterator)
312 ---Purpose : Gets contents from an EntityIterator, prepared by a
313 -- Transfer tool (e.g TransferCopy). Starts from clear
314 raises InterfaceMismatch;
315 -- Error if InterfaceEntities to get are not free
316
317 GetFromAnother (me : mutable; other : InterfaceModel) is deferred;
318 ---Purpose : Gets header (data specific of a defined Interface) from
319 -- another InterfaceModel; called from TransferCopy
320
321 NewEmptyModel (me) returns mutable InterfaceModel is deferred;
322 ---Purpose : Returns a New Empty Model, same type as <me> (whatever its
323 -- Type); called to Copy parts a Model into other ones, then
324 -- followed by a call to GetFromAnother (Header) then filling
325 -- with specified Entities, themselves copied
326
327 -- -- Categories -- --
328
329 SetCategoryNumber (me : mutable; num : Integer; val : Integer)
330 returns Boolean;
331 ---Purpose : Records a category number for an entity number
332 -- Returns True when done, False if <num> is out of range
333
334 CategoryNumber (me; num : Integer) returns Integer;
335 ---Purpose : Returns the recorded category number for a given entity number
336 -- 0 if none was defined for this entity
337
338 -- -- Global Queries -- --
339
340 FillIterator (me; iter : in out EntityIterator);
341 ---Purpose : Allows an EntityIterator to get a list of Entities
342
343
344 Entities (me) returns EntityIterator;
345 ---Purpose : Returns the list of all Entities, as an Iterator on Entities
346 -- (the Entities themselves, not the Reports)
347
348 Reports (me; semantic : Boolean = Standard_False) returns EntityIterator;
349 ---Purpose : Returns the list of all ReportEntities, i.e. data about
350 -- Entities read with Error or Warning informations
351 -- (each item has to be casted to Report Entity then it can be
352 -- queried for Concerned Entity, Content, Check ...)
353 -- By default, returns the main reports, is <semantic> is True it
354 -- returns the list for sematic checks
355 ---See Also : classes ReportEntity (for contents) and CheckTool
356
357 Redefineds (me) returns EntityIterator;
358 ---Purpose : Returns the list of ReportEntities which redefine data
359 -- (generally, if concerned entity is "Error", a literal content
360 -- is added to it : this is a "redefined entity"
361
362
363 GlobalCheck (me; syntactic : Boolean = Standard_True) returns Check;
364 ---Purpose : Returns the GlobalCheck, which memorizes messages global to
365 -- the file (not specific to an Entity), especially Header
366 ---C++ : return const &
367
368 SetGlobalCheck (me : mutable; ach : Check);
369 ---Purpose : Allows to modify GlobalCheck, after getting then completing it
370 -- Remark : it is SYNTACTIC check. Semantics, see FillChecks
371
372 VerifyCheck (me; ach : in out Check) is virtual;
373 ---Purpose : Minimum Semantic Global Check on data in model (header)
374 -- Can only check basic Data. See also GlobalCheck from Protocol
375 -- for a check which takes the Graph into account
376 -- Default does nothing, can be redefined
377
378 DumpHeader (me; S : Messenger from Message; level : Integer = 0) is deferred;
379 ---Purpose : Dumps Header in a short, easy to read, form, onto a Stream
380 -- <level> allows to print more or less parts of the header,
381 -- if necessary. 0 for basic print
382
383 Print (me; ent : Transient; s : Messenger from Message; mode : Integer = 0);
384 ---Purpose : Prints identification of a given entity in <me>, in order to
385 -- be printed in a list or phrase
386 -- <mode> < 0 : prints only its number
387 -- <mode> = 1 : just calls PrintLabel
388 -- <mode> = 0 (D) : prints its number plus '/' plus PrintLabel
389 -- If <ent> == <me>, simply prints "Global"
390 -- If <ent> is unknown, prints "??/its type"
391
392 PrintLabel (me; ent : Transient; S : Messenger from Message) is deferred;
393 ---Purpose : Prints label specific to each norm, for a given entity.
394 -- Must only print label itself, in order to be included in a
395 -- phrase. Can call the result of StringLabel, but not obliged.
396
397 PrintToLog (me; ent : Transient; S : Messenger from Message) is virtual;
398 ---Purpose : Prints label specific to each norm in log format, for
399 -- a given entity.
400 -- By default, just calls PrintLabel, can be redefined
401
402 StringLabel (me; ent : Transient) returns HAsciiString from TCollection
403 is deferred;
404 ---Purpose : Returns a string with the label attached to a given entity.
405 -- Warning : While this string may be edited on the spot, if it is a read
406 -- field, the returned value must be copied before.
407
408 NextNumberForLabel (me; label : CString;
409 lastnum : Integer = 0; exact : Boolean = Standard_True)
410 returns Integer is virtual;
411 ---Purpose : Searches a label which matches with one entity.
412 -- Begins from <lastnum>+1 (default:1) and scans the entities
413 -- until <NbEntities>. For the first which matches <label>,
414 -- this method returns its Number. Returns 0 if nothing found
415 -- Can be called recursively (labels are not specified as unique)
416 -- <exact> : if True (default), exact match is required
417 -- else, checks the END of entity label
418 --
419 -- This method is virtual, hence it can be redefined for a more
420 -- efficient search (if exact is true).
421
422 -- -- Templates -- --
423
424 HasTemplate (myclass; name : CString) returns Boolean;
425 ---Purpose : Returns true if a template is attached to a given name
426
427 Template (myclass; name : CString) returns mutable InterfaceModel;
428 ---Purpose : Returns the template model attached to a name, or a Null Handle
429
430 SetTemplate (myclass; name : CString; model : mutable InterfaceModel)
431 returns Boolean;
432 ---Purpose : Records a new template model with a name. If the name was
433 -- already recorded, the corresponding template is replaced by
434 -- the new one. Then, WARNING : test HasTemplate to avoid
435 -- surprises
436
437 ListTemplates (myclass) returns HSequenceOfHAsciiString;
438 ---Purpose : Returns the complete list of names attached to template models
439
440fields
441
442 theentities : IndexedMapOfTransient;
443 thereports : DataMapOfIntegerTransient from TColStd; -- EntityNumber -> ReportEntity
444 therepch : DataMapOfIntegerTransient from TColStd; -- for semantic checks
445 thecheckstx : Check; -- it is GlobalCheck (Syntactic)
446 thechecksem : Check; -- it is GlobalCheck (Semantic)
447 haschecksem : Boolean; -- are semantic checks recorded
448 isdispatch : Boolean; -- is <me> produced for dispatch ?
449 thecategory : HAsciiString;
450 thegtool : GTool;
451-- theprotocol : Protocol;
452
453end InterfaceModel;