b311480e |
1 | -- Created on: 1994-10-03 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1994-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
973c2be1 |
8 | -- This library is free software; you can redistribute it and / or modify it |
9 | -- under the terms of the GNU Lesser General Public 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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class Reader from TransferBRep |
18 | |
19 | ---Purpose : This class offers a simple, easy to call, way of transferring |
20 | -- data from interface files to Shapes from CasCade |
21 | -- It must be specialized according to each norm/protocol, by : |
22 | -- - defining how to read a file (specific method with protocol) |
23 | -- - definig transfer, by providing an Actor |
24 | |
25 | uses CString, Transient, HSequenceOfTransient from TColStd, |
26 | Shape from TopoDS, HSequenceOfShape from TopTools, |
27 | InterfaceModel, Protocol from Interface, CheckIterator, |
28 | TransientProcess from Transfer, ActorOfTransientProcess from Transfer |
29 | |
30 | raises OutOfRange |
31 | |
32 | is |
33 | |
34 | Create returns Reader; |
35 | ---Purpose : Initializes a non-specialised Reader. Typically, for each norm |
36 | -- or protocol, is will be required to define a specific Create |
37 | -- to load a file and transfer it |
38 | |
39 | SetProtocol (me : in out; protocol : Protocol from Interface); |
40 | ---Purpose : Records the protocol to be used for read and transfer roots |
41 | |
42 | Protocol (me) returns Protocol from Interface is virtual; |
43 | ---Purpose : Returns the recorded Protocol |
44 | |
45 | SetActor (me : in out; actor : ActorOfTransientProcess from Transfer); |
46 | ---Purpose : Records the actor to be used for transfers |
47 | |
48 | Actor (me) returns ActorOfTransientProcess is virtual; |
49 | ---Purpose : Returns the recorded Actor |
50 | |
51 | |
52 | SetFileStatus (me : in out; status : Integer); |
53 | ---Purpose : Sets File Status to be interpreted as follows : |
54 | -- = 0 OK |
55 | -- < 0 file not found |
56 | -- > 0 read error, no Model could be created |
57 | |
58 | FileStatus (me) returns Integer; |
59 | ---Purpose : Returns the File Status |
60 | |
61 | FileNotFound (me) returns Boolean; |
62 | ---Purpose : Returns True if FileStatus is for FileNotFound |
63 | |
64 | SyntaxError (me) returns Boolean; |
65 | ---Purpose : Returns True if FileStatus is for Error during read |
66 | -- (major error; for local error, see CheckModel) |
67 | |
68 | SetModel (me : in out; model : InterfaceModel); |
69 | ---Purpose : Specifies a Model to work on |
70 | -- Also clears the result and Done status |
71 | |
72 | Model (me) returns InterfaceModel; |
73 | ---Purpose : Returns the Model to be worked on |
74 | |
75 | Clear (me : in out); |
76 | ---Purpose : clears the result and Done status. But not the Model. |
77 | |
78 | CheckStatusModel (me; withprint : Boolean) returns Boolean; |
79 | ---Purpose : Checks the Model. Returns True if there is NO FAIL at all |
80 | -- (regardless Warnings) |
81 | -- If <withprint> is True, also sends Checks on standard output |
82 | |
83 | CheckListModel (me) returns CheckIterator; |
84 | ---Purpose : Checks the Model (complete : syntax + semantic) and returns |
85 | -- the produced Check List |
86 | |
87 | ModeNewTransfer (me : in out) returns Boolean; |
88 | ---Purpose : Returns (by Reference, hence can be changed) the Mode for new |
89 | -- Transfer : True (D) means that each new Transfer produces a |
90 | -- new TransferProcess. Else keeps the original one but each |
91 | -- Transfer clears its (former results are not kept) |
92 | ---C++ : return & |
93 | |
94 | BeginTransfer (me : in out) returns Boolean; |
95 | ---Purpose : Initializes the Reader for a Transfer (one,roots, or list) |
96 | -- Also calls PrepareTransfer |
97 | -- Returns True when done, False if could not be done |
98 | |
99 | EndTransfer (me : in out); |
100 | ---Purpose : Ebds a Transfer (one, roots or list) by recording its result |
101 | |
102 | PrepareTransfer (me : in out) is virtual; |
103 | ---Purpose : Prepares the Transfer. Also can act on the Actor or change the |
104 | -- TransientProcess if required. |
105 | -- Should not set the Actor into the TransientProcess, it is done |
106 | -- by caller. The provided default does nothing. |
107 | |
108 | TransferRoots (me : in out) is virtual; |
109 | ---Purpose : Transfers all Root Entities which are recognized as Geom-Topol |
110 | -- The result will be a list of Shapes. |
111 | -- This method calls user redefinable PrepareTransfer |
112 | -- Remark : former result is cleared |
113 | |
114 | Transfer (me : in out; num : Integer) returns Boolean is virtual; |
115 | ---Purpose : Transfers an Entity given its rank in the Model (Root or not) |
116 | -- Returns True if it is recognized as Geom-Topol. |
117 | -- (But it can have failed : see IsDone) |
118 | |
119 | TransferList (me : in out; list : HSequenceOfTransient) is virtual; |
120 | ---Purpose : Transfers a list of Entities (only the ones also in the Model) |
121 | -- Remark : former result is cleared |
122 | |
123 | IsDone (me) returns Boolean; |
124 | ---Purpose : Returns True if the LAST Transfer/TransferRoots was a success |
125 | |
126 | NbShapes (me) returns Integer; |
127 | ---Purpose : Returns the count of produced Shapes (roots) |
128 | |
129 | Shapes (me) returns HSequenceOfShape; |
130 | ---Purpose : Returns the complete list of produced Shapes |
131 | |
132 | Shape (me; num : Integer = 1) returns Shape from TopoDS |
133 | ---Purpose : Returns a Shape given its rank, by default the first one |
134 | raises OutOfRange; |
135 | -- Error if num < 1 or num > NbShapes |
136 | ---C++ : return const & |
137 | |
138 | ShapeResult (me; ent : Transient) returns Shape from TopoDS; |
139 | ---Purpose : Returns a Shape produced from a given entity (if it was |
140 | -- individually transferred or if an intermediate result is |
141 | -- known). If no Shape is bound with <ent>, returns a Null Shape |
142 | -- Warning : Runs on the last call to Transfer,TransferRoots,TransferList |
143 | |
144 | OneShape (me) returns Shape from TopoDS; |
145 | ---Purpose : Returns a unique Shape for the result : |
146 | -- - a void Shape (type = SHAPE) if result is empty |
147 | -- - a simple Shape if result has only one : returns this one |
148 | -- - a Compound if result has more than one Shape |
149 | |
150 | NbTransients (me) returns Integer; |
151 | ---Purpose : Returns the count of produced Transient Results (roots) |
152 | |
153 | Transients (me) returns HSequenceOfTransient; |
154 | ---Purpose : Returns the complete list of produced Transient Results |
155 | |
156 | Transient (me; num : Integer = 1) returns any Transient |
157 | ---Purpose : Returns a Transient Root Result, given its rank (by default |
158 | -- the first one) |
159 | raises OutOfRange; |
160 | -- Error if num < 1 or num > NbShapes |
161 | |
162 | |
163 | CheckStatusResult (me; withprints : Boolean) returns Boolean; |
164 | ---Purpose : Checks the Result of last Transfer (individual or roots, no |
165 | -- cumulation on several transfers). Returns True if NO fail |
166 | -- occured during Transfer (queries the TransientProcess) |
167 | |
168 | CheckListResult (me) returns CheckIterator; |
169 | ---Purpose : Checks the Result of last Transfer (individual or roots, no |
170 | -- cumulation on several transfers) and returns the produced list |
171 | |
172 | TransientProcess (me) returns TransientProcess; |
173 | ---Purpose : Returns the TransientProcess. It records informations about |
174 | -- the very last transfer done. Null if no transfer yet done. |
175 | -- Can be used for queries more accurate than the default ones. |
176 | |
177 | Destroy (me: in out) is virtual; |
178 | ---C++ : alias "Standard_EXPORT virtual ~TransferBRep_Reader() { Destroy(); }" |
179 | |
180 | |
181 | fields |
182 | |
183 | theProto : Protocol from Interface; |
184 | theActor : ActorOfTransientProcess from Transfer; |
185 | theModel : InterfaceModel; |
186 | theFilest : Integer; |
187 | theDone : Boolean is protected; |
188 | theNewpr : Boolean; |
189 | theProc : TransientProcess is protected; |
190 | theShapes : HSequenceOfShape; |
191 | theTransi : HSequenceOfTransient; |
192 | |
193 | end Reader; |