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