Test for 0022778: Bug in BRepMesh
[occt.git] / src / XSControl / XSControl_Reader.cdl
CommitLineData
b311480e 1-- Created on: 1997-05-14
2-- Created by: Christian CAILLET
3-- Copyright (c) 1997-1999 Matra Datavision
4-- Copyright (c) 1999-2012 OPEN CASCADE SAS
5--
6-- The content of this file is subject to the Open CASCADE Technology Public
7-- License Version 6.5 (the "License"). You may not use the content of this file
8-- except in compliance with the License. Please obtain a copy of the License
9-- at http://www.opencascade.org and read it completely before using this file.
10--
11-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13--
14-- The Original Code and all software distributed under the License is
15-- distributed on an "AS IS" basis, without warranty of any kind, and the
16-- Initial Developer hereby disclaims all such warranties, including without
17-- limitation, any warranties of merchantability, fitness for a particular
18-- purpose or non-infringement. Please see the License for the specific terms
19-- and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23class Reader from XSControl
24
25 ---Purpose :
26 -- A groundwork to convert a shape to data which complies
27 -- with a particular norm. This data can be that of a whole
28 -- model or that of a specific list of entities in the model.
29 -- You specify the list using a single selection or a
30 -- combination of selections. A selection is an operator which
31 -- computes a list of entities from a list given in input. To
32 -- specify the input, you can use:
33 -- - A predefined selection such as "xst-transferrable-roots"
34 -- - A filter based on a signature.
35 -- A signature is an operator which returns a string from an
36 -- entity according to its type.
37 -- For example:
38 -- - "xst-type" (CDL)
39 -- - "iges-level"
40 -- - "step-type".
41 -- A filter can be based on a signature by giving a value to
42 -- be matched by the string returned. For example,
43 -- "xst-type(Curve)".
44 -- If no list is specified, the selection computes its list of
45 -- entities from the whole model. To use this class, you have to
46 -- initialize the transfer norm first, as shown in the example below.
47 -- Example:
48 -- Control_Reader reader;
49 -- IFSelect_ReturnStatus status = reader.ReadFile (filename.);
50 -- When using IGESControl_Reader or STEPControl_Reader - as the
51 -- above example shows - the reader initializes the norm directly.
52 -- Note that loading the file only stores the data. It does
53 -- not translate this data. Shapes are accumulated by
54 -- successive transfers. The last shape is cleared by:
55 -- - ClearShapes which allows you to handle a new batch
56 -- - TransferRoots which restarts the list of shapes from scratch.
57
58uses CString, OStream, Transient,
59 SequenceOfTransient from TColStd, HSequenceOfTransient from TColStd,
60 InterfaceModel from Interface, WorkSession from XSControl,
61 ReturnStatus from IFSelect, PrintCount from IFSelect,
62 Shape from TopoDS, SequenceOfShape from TopTools
63
64is
65
66 Create returns Reader;
67 ---Purpose : Creates a Reader from scratch (creates an empty WorkSession)
68 -- A WorkSession or a Controller must be provided before running
69
70 Create (norm : CString) returns Reader;
71 ---Purpose : Creates a Reader from scratch, with a norm name which
72 -- identifies a Controller
73
74 Create (WS : mutable WorkSession from XSControl;
75 scratch : Boolean = Standard_True) returns Reader;
76 ---Purpose : Creates a Reader from an already existing Session, with a
77 -- Controller already set
78
79 ---Purpose: Virtual destructor
80 ---C++ : alias "Standard_EXPORT virtual ~XSControl_Reader() {}"
81
82 SetNorm (me : in out; norm : CString) returns Boolean;
83 ---Purpose : Sets a specific norm to <me>
84 -- Returns True if done, False if <norm> is not available
85
86 SetWS (me : in out; WS : mutable WorkSession from XSControl;
87 scratch : Boolean = Standard_True);
88 ---Purpose : Sets a specific session to <me>
89
90 WS (me) returns WorkSession from XSControl;
91 ---Purpose : Returns the session used in <me>
92
93
94 ReadFile (me : in out; filename : CString) returns ReturnStatus;
95 ---Purpose : Loads a file and returns the read status
96 -- Zero for a Model which compies with the Controller
97
98 Model (me) returns InterfaceModel;
99 ---Purpose : Returns the model. It can then be consulted (header, product)
100
101 GiveList (me : in out; first, second : CString = "")
102 returns HSequenceOfTransient from TColStd;
103 ---Purpose : Returns a list of entities from the IGES or STEP file
104 -- according to the following rules:
105 -- - if first and second are empty strings, the whole file is selected.
106 -- - if first is an entity number or label, the entity referred to is selected.
107 -- - if first is a list of entity numbers/labels separated by commas, the entities referred to are selected,
108 -- - if first is the name of a selection in the worksession and second is not defined,
109 -- the list contains the standard output for that selection.
110 -- - if first is the name of a selection and second is defined, the criterion defined
111 -- by second is applied to the result of the first selection.
112 -- A selection is an operator which computes a list of entities from a list given in
113 -- input according to its type. If no list is specified, the selection computes its
114 -- list of entities from the whole model.
115 -- A selection can be:
116 -- - A predefined selection (xst-transferrable-mode)
117 -- - A filter based on a signature
118 -- A Signature is an operator which returns a string from an entity according to its type. For example:
119 -- - "xst-type" (CDL)
120 -- - "iges-level"
121 -- - "step-type".
122 -- For example, if you wanted to select only the advanced_faces in a STEP file you
123 -- would use the following code:
124 -- Example
125 -- Reader.GiveList("xst-transferrable-roots","step-type(ADVANCED_FACE)");
126 -- Warning
127 -- If the value given to second is incorrect, it will simply be ignored.
128
129 GiveList (me : in out; first : CString; ent : Transient)
130 returns HSequenceOfTransient from TColStd;
131 ---Purpose : Computes a List of entities from the model as follows
132 -- <first> beeing a Selection, <ent> beeing an entity or a list
133 -- of entities (as a HSequenceOfTransient) :
134 -- the standard result of this selection applied to this list
135 -- if <first> is erroneous, a null handle is returned
136
137
138 NbRootsForTransfer (me : in out) returns Integer is virtual ;
139 ---Purpose : Determines the list of root entities which are candidate for
140 -- a transfer to a Shape, and returns the number
141 -- of entities in the list
142
143 RootForTransfer (me : in out; num : Integer = 1) returns Transient;
144 ---Purpose : Returns an IGES or STEP root
145 -- entity for translation. The entity is identified by its
146 -- rank in a list.
147
148 TransferOneRoot (me : in out; num : Integer = 1) returns Boolean ;
149 ---Purpose : Translates a root identified by the rank num in the model.
150 -- false is returned if no shape is produced.
151
152 TransferOne (me : in out; num : Integer) returns Boolean;
153 ---Purpose : Translates an IGES or STEP
154 -- entity identified by the rank num in the model.
155 -- false is returned if no shape is produced.
156
157 TransferEntity (me : in out; start : Transient) returns Boolean;
158 ---Purpose : Translates an IGES or STEP
159 -- entity in the model. true is returned if a shape is
160 -- produced; otherwise, false is returned.
161
162 TransferList (me : in out; list : HSequenceOfTransient from TColStd)
163 returns Integer;
164 ---Purpose : Translates a list of entities.
165 -- Returns the number of IGES or STEP entities that were
166 -- successfully translated. The list can be produced with GiveList.
167 -- Warning - This function does not clear the existing output shapes.
168
169 TransferRoots (me : in out) returns Integer;
170 ---Purpose : Translates all translatable
171 -- roots and returns the number of successful translations.
172 -- Warning - This function clears existing output shapes first.
173
174
175 ClearShapes (me : in out);
176 ---Purpose : Clears the list of shapes that
177 -- may have accumulated in calls to TransferOne or TransferRoot.C
178
179 NbShapes (me) returns Integer;
180 ---Purpose : Returns the number of shapes produced by translation.
181
182 Shapes (me: in out) returns SequenceOfShape from TopTools is protected;
183 ---Purpose : Returns a sequence of produced shapes
184 ---C++: return &
185
186 Shape (me; num : Integer = 1) returns Shape from TopoDS;
187 ---Purpose : Returns the shape resulting
188 -- from a translation and identified by the rank num.
189 -- num equals 1 by default. In other words, the first shape
190 -- resulting from the translation is returned.
191
192 OneShape (me) returns Shape from TopoDS;
193 ---Purpose : Returns all of the results in
194 -- a single shape which is:
195 -- - a null shape if there are no results,
196 -- - a shape if there is one result,
197 -- - a compound containing the resulting shapes if there are more than one.
198
199 PrintCheckLoad (me; failsonly : Boolean; mode : PrintCount);
200 ---Purpose : Prints the check list attached to loaded data, on the Standard
201 -- Trace File (starts at cout)
202 -- All messages or fails only, according to <failsonly>
203 -- mode = 0 : per entity, prints messages
204 -- mode = 1 : per message, just gives count of entities per check
205 -- mode = 2 : also gives entity numbers
206
207 PrintCheckTransfer (me; failsonly : Boolean; mode : PrintCount);
208 ---Purpose : Displays check results for the
209 -- last translation of IGES or STEP entities to Open CASCADE
210 -- entities. Only fail messages are displayed if failsonly is
211 -- true. All messages are displayed if failsonly is
212 -- false. mode determines the contents and the order of the
213 -- messages according to the terms of the IFSelect_PrintCount enumeration.
214
215 PrintStatsTransfer (me; what : Integer; mode : Integer = 0);
216 ---Purpose : Displays the statistics for
217 -- the last translation. what defines the kind of
218 -- statistics that are displayed as follows:
219 -- - 0 gives general statistics (number of translated roots,
220 -- number of warnings, number of fail messages),
221 -- - 1 gives root results,
222 -- - 2 gives statistics for all checked entities,
223 -- - 3 gives the list of translated entities,
224 -- - 4 gives warning and fail messages,
225 -- - 5 gives fail messages only.
226 -- The use of mode depends on the value of what. If what is 0,
227 -- mode is ignored. If what is 1, 2 or 3, mode defines the following:
228 -- - 0 lists the numbers of IGES or STEP entities in the respective model
229 -- - 1 gives the number, identifier, type and result
230 -- type for each IGES or STEP entity and/or its status
231 -- (fail, warning, etc.)
232 -- - 2 gives maximum information for each IGES or STEP entity (i.e. checks)
233 -- - 3 gives the number of entities per type of IGES or STEP entity
234 -- - 4 gives the number of IGES or STEP entities per result type and/or status
235 -- - 5 gives the number of pairs (IGES or STEP or result type and status)
236 -- - 6 gives the number of pairs (IGES or STEP or result type
237 -- and status) AND the list of entity numbers in the IGES or STEP model.
238 -- If what is 4 or 5, mode defines the warning and fail
239 -- messages as follows:
240 -- - if mode is 0 all warnings and checks per entity are returned
241 -- - if mode is 2 the list of entities per warning is returned.
242 -- If mode is not set, only the list of all entities per warning is given.
243
244 GetStatsTransfer (me; list: HSequenceOfTransient from TColStd;
245 nbMapped : out Integer;
246 nbWithResult: out Integer;
247 nbWithFail : out Integer);
248 ---Purpose: Gives statistics about Transfer
249
250fields
251
252 thesession : WorkSession from XSControl;
253 therootsta : Boolean is protected; -- are roots determined
254 theroots : SequenceOfTransient is protected; -- only roots available for Transfer
255 theshapes : SequenceOfShape;
256
257end Reader;