b311480e |
1 | -- Created on: 1995-06-01 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1995-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 | -- |
d5f74e42 |
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 |
973c2be1 |
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 WorkSession from XSControl inherits WorkSession from IFSelect |
18 | |
19 | ---Purpose : This WorkSession completes the basic one, by adding : |
20 | -- - use of Controller, with norm selection... |
21 | -- - management of transfers (both ways) with auxiliary classes |
22 | -- TransferReader and TransferWriter |
23 | -- -> these transfers may work with a Context List : its items |
24 | -- are given by the user, according to the transfer to be |
25 | -- i.e. it is interpreted by the Actors |
26 | -- Each item is accessed by a Name |
27 | |
28 | uses CString, Transient, DictionaryOfTransient, |
29 | InterfaceModel, CheckIterator, |
30 | TransientProcess, FinderProcess, |
31 | TransferReader, TransferWriter, Controller, Vars, ReturnStatus, |
32 | Messenger from Message, |
33 | Shape from TopoDS |
34 | |
35 | is |
36 | |
6e33d3ce |
37 | Create returns WorkSession from XSControl; |
7fd59977 |
38 | |
39 | ClearData (me : mutable; mode : Integer) is redefined; |
40 | ---Purpose : In addition to basic ClearData, clears Transfer and Management |
41 | -- for interactive use, for mode = 0,1,2 and over 4 |
42 | -- Plus : mode = 5 to clear Transfers (both ways) only |
43 | -- mode = 6 to clear enforced results |
44 | -- mode = 7 to clear transfers, results |
45 | |
46 | |
47 | -- Norm Management -- |
48 | |
49 | SelectNorm (me : mutable; normname : CString; profile : CString = "") |
50 | returns Boolean; |
51 | ---Purpose : Selects a Norm defined by its name. |
52 | -- A Norm is described and handled by a Controller |
53 | -- Returns True if done, False if <normname> is unknown |
54 | -- |
55 | -- A Profile may be set too. If no Profile is provided, the |
56 | -- current Profile for this Norm is taken |
57 | -- If the asked Profile is not defined for this Norm, it remains |
58 | -- in current Profile, returned value is True |
59 | |
60 | SelectProfile (me : mutable; profile : CString) returns Boolean; |
61 | ---Purpose : Sets a Profile as current for the current Norm |
62 | -- Returns True if done, False if <profile> is unknown for this norm |
63 | -- |
64 | -- For more infos on Profile, query the Profile of the Controller |
65 | |
6e33d3ce |
66 | SetController (me : mutable; ctl : Controller); |
7fd59977 |
67 | ---Purpose : Selects a Norm defined by its Controller itself |
68 | |
69 | AdaptNorm (me : mutable) is virtual; |
70 | ---Purpose : This method is called once a new norm has been successfully |
71 | -- selected. It can be redefined, default does nothing |
72 | |
73 | SelectedNorm (me; rsc : Boolean = Standard_False) returns CString; |
74 | ---Purpose : Returns the name of the last Selected Norm. If none is |
75 | -- defined, returns an empty string |
76 | -- By default, returns the complete name of the norm |
77 | -- If <rsc> is True, returns the short name used for resource |
78 | |
6e33d3ce |
79 | NormAdaptor (me) returns Controller; |
7fd59977 |
80 | ---Purpose : Returns the norm controller itself |
81 | |
82 | -- Context used for Transfer : it is a DictionaryOfTransient (no control here) |
83 | |
84 | Context (me) returns DictionaryOfTransient; |
85 | ---Purpose : Returns the current Context List, Null if not defined |
86 | -- The Context is given to the TransientProcess for TransferRead |
87 | |
88 | SetAllContext (me : mutable; context : DictionaryOfTransient); |
89 | ---Purpose : Sets the current Context List, as a whole |
90 | -- Sets it to the TransferReader |
91 | |
92 | ClearContext (me : mutable); |
93 | ---Purpose : Clears the whole current Context (nullifies it) |
94 | |
95 | -- Management and Actions of Transfer (Read) -- |
96 | -- performed by TransferReader |
97 | -- WorkSession adds some useful accesses |
98 | -- It is actually oriented to shapes and transient objects |
99 | |
100 | PrintTransferStatus (me; num : Integer; wri : Boolean; S : Messenger from Message) |
101 | returns Boolean; |
102 | ---Purpose : Prints the transfer status of a transferred item, as beeing |
103 | -- the Mapped n0 <num>, from MapWriter if <wri> is True, or |
104 | -- from MapReader if <wri> is False |
105 | -- Returns True when done, False else (i.e. num out of range) |
106 | |
107 | InitTransferReader (me : mutable; mode : Integer); |
108 | ---Purpose : Sets a Transfer Reader, by internal ways, according mode : |
109 | -- 0 recreates it clear, 1 clears it (does not recreate) |
110 | -- 2 aligns Roots of TransientProcess from final Results |
111 | -- 3 aligns final Results from Roots of TransientProcess |
112 | -- 4 begins a new transfer (by BeginTransfer) |
113 | -- 5 recreates TransferReader then begins a new transfer |
114 | |
6e33d3ce |
115 | SetTransferReader (me : mutable; TR : TransferReader); |
7fd59977 |
116 | ---Purpose : Sets a Transfer Reader, which manages transfers on reading |
117 | |
6e33d3ce |
118 | TransferReader (me) returns TransferReader; |
7fd59977 |
119 | ---Purpose : Returns the Transfer Reader, Null if not set |
120 | |
6e33d3ce |
121 | MapReader (me) returns TransientProcess; |
7fd59977 |
122 | ---Purpose : Returns the TransientProcess(internal data for TransferReader) |
123 | |
6e33d3ce |
124 | SetMapReader (me : mutable; TP : TransientProcess) returns Boolean; |
7fd59977 |
125 | ---Purpose : Changes the Map Reader, i.e. considers that the new one |
126 | -- defines the relevant read results (forgets the former ones) |
127 | -- Returns True when done, False in case of bad definition, i.e. |
128 | -- if Model from TP differs from that of Session |
129 | |
130 | Result (me; ent : Transient; mode : Integer) |
6e33d3ce |
131 | returns Transient; |
7fd59977 |
132 | ---Purpose : Returns the result attached to a starting entity |
133 | -- If <mode> = 0, returns Final Result |
134 | -- If <mode> = 1, considers Last Result |
135 | -- If <mode> = 2, considers Final, else if absent, Last |
136 | -- returns it as Transient, if result is not transient returns |
137 | -- the Binder |
138 | -- <mode> = 10,11,12 idem but returns the Binder itself |
139 | -- (if it is not, e.g. Shape, returns the Binder) |
140 | -- <mode> = 20, returns the ResultFromModel |
141 | |
142 | TransferReadOne (me : mutable; ents : Transient) returns Integer; |
143 | ---Purpose : Commands the transfer of, either one entity, or a list |
144 | -- I.E. calls the TransferReader after having analysed <ents> |
145 | -- It is cumulated from the last BeginTransfer |
146 | -- <ents> is processed by GiveList, hence : |
147 | -- - <ents> a Selection : its SelectionResult |
148 | -- - <ents> a HSequenceOfTransient : this list |
149 | -- - <ents> the Model : in this specific case, all the roots, |
150 | -- with no cumulation of former transfers (TransferReadRoots) |
151 | |
152 | TransferReadRoots (me : mutable) returns Integer; |
153 | ---Purpose : Commands the transfer of all the root entities of the model |
154 | -- i.e. calls TransferRoot from the TransferReader with the Graph |
155 | -- No cumulation with former calls to TransferReadOne |
156 | |
157 | -- Other actions : see the class TransferReader |
158 | |
159 | -- BeginTransferRead (me : mutable) returns Boolean; and |
160 | -- RecognizeRead (me : mutable; ent : Transient) see TransferReader |
161 | -- TransferReadOne (me : mutable; ents : Transient) -> TransferOne/List |
162 | -- TransferReadRoots (me : mutable) returns Integer; |
163 | -- TransferReadCheckList (me) returns CheckIterator; -> LastCheckList |
164 | -- TransferReadCheckOne (me; ent : Transient; level : Integer = 0) |
165 | -- -> CheckList avec en plus level = -1 (last) |
166 | -- TransferredReadList (me; ents : Transient; -> CheckedList |
167 | -- withcheck : Integer = 0; level : Integer = 0) withcheck a change |
168 | -- TransferReadClear (me : mutable; ents : Transient; level : Integer = 0); |
169 | -- ShapeResultList (me : mutable) returns HSequenceOfShape from TopTools; |
170 | -- + rec : Boolean (recorded/last) |
171 | |
172 | |
173 | -- Management of Transfer (Write) -- |
174 | -- It is actually oriented to shapes |
175 | |
6e33d3ce |
176 | NewModel (me : mutable) returns InterfaceModel from Interface; |
7fd59977 |
177 | ---Purpose : produces and returns a new Model well conditionned |
178 | -- It is produced by the Norm Controller |
179 | -- It can be Null (if this function is not implemented) |
180 | |
6e33d3ce |
181 | TransferWriter (me) returns TransferWriter; |
7fd59977 |
182 | ---Purpose : Returns the Transfer Reader, Null if not set |
183 | |
6e33d3ce |
184 | MapWriter (me) returns FinderProcess; |
7fd59977 |
185 | ---Purpose : Returns the FinderProcess (internal data for TransferWriter) |
186 | |
6e33d3ce |
187 | SetMapWriter (me : mutable; FP : FinderProcess) returns Boolean; |
7fd59977 |
188 | ---Purpose : Changes the Map Reader, i.e. considers that the new one |
189 | -- defines the relevant read results (forgets the former ones) |
190 | -- Returns True when done, False if <FP> is Null |
191 | |
192 | SetModeWriteShape (me : mutable; mode : Integer); |
193 | ---Purpose : Sets a mode to transfer Shapes from CasCade to entities of the |
194 | -- current norm, which interprets it (see various Controllers) |
195 | -- This call form could be later replaced by a more general one |
196 | |
197 | ModeWriteShape (me) returns Integer; |
198 | ---Purpose : Records the current Mode to Write Shapes |
199 | |
200 | TransferWriteShape (me : mutable; shape : Shape from TopoDS; |
201 | compgraph : Boolean = Standard_True) |
202 | returns ReturnStatus; |
203 | ---Purpose : Transfers a Shape from CasCade to a model of current norm, |
204 | -- according to the last call to SetModeWriteShape |
205 | -- Returns status :Done if OK, Fail if error during transfer, |
206 | -- Error if transfer badly initialised |
207 | |
208 | TransferWriteCheckList (me) returns CheckIterator; |
209 | ---Purpose : Returns the check-list of last transfer (write) |
210 | -- It is recorded in the FinderProcess, but it must be bound with |
211 | -- resulting entities (in the resulting file model) rather than |
212 | -- with original objects (in fact, their mappers) |
213 | |
214 | |
215 | Vars (me) returns Vars; |
216 | |
217 | SetVars (me : mutable; newvars : Vars); |
218 | |
219 | ClearBinders (me : mutable); |
220 | ---Purpose : Clears binders |
221 | |
222 | Destroy(me: mutable) |
223 | ---C++: alias ~ |
224 | is static; |
225 | |
226 | fields |
227 | |
228 | theController : Controller; |
229 | theTransferRead : TransferReader from XSControl; |
230 | theTransferWrite : TransferWriter from XSControl; |
231 | theContext : DictionaryOfTransient; |
232 | theModeWriteShape : Integer; |
233 | theVars : Vars; |
234 | |
235 | end WorkSession; |