973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | |
42cf5bc1 |
15 | #include <Dico_IteratorOfDictionaryOfInteger.hxx> |
7fd59977 |
16 | #include <IFSelect_Act.hxx> |
42cf5bc1 |
17 | #include <IFSelect_CheckCounter.hxx> |
7fd59977 |
18 | #include <IFSelect_Functions.hxx> |
42cf5bc1 |
19 | #include <IFSelect_SessionPilot.hxx> |
20 | #include <Interface_CheckIterator.hxx> |
21 | #include <Interface_InterfaceModel.hxx> |
22 | #include <Interface_Macros.hxx> |
23 | #include <Interface_Static.hxx> |
24 | #include <Message.hxx> |
25 | #include <Message_Messenger.hxx> |
7fd59977 |
26 | #include <TColStd_HSequenceOfHAsciiString.hxx> |
42cf5bc1 |
27 | #include <TColStd_HSequenceOfTransient.hxx> |
7fd59977 |
28 | #include <Transfer_Binder.hxx> |
42cf5bc1 |
29 | #include <Transfer_FinderProcess.hxx> |
7fd59977 |
30 | #include <Transfer_IteratorOfProcessForTransient.hxx> |
42cf5bc1 |
31 | #include <Transfer_ResultFromModel.hxx> |
32 | #include <Transfer_TransferIterator.hxx> |
33 | #include <Transfer_TransientProcess.hxx> |
34 | #include <XSControl.hxx> |
35 | #include <XSControl_Controller.hxx> |
36 | #include <XSControl_Functions.hxx> |
37 | #include <XSControl_SelectForTransfer.hxx> |
38 | #include <XSControl_TransferReader.hxx> |
39 | #include <XSControl_TransferWriter.hxx> |
40 | #include <XSControl_WorkSession.hxx> |
7fd59977 |
41 | |
7fd59977 |
42 | // ####################################################################### |
43 | // ## ## |
44 | // ## ## |
45 | // ## FUNCTIONS ## |
46 | // ## ## |
47 | // ## ## |
48 | // ####################################################################### |
7fd59977 |
49 | //======================================================================= |
50 | //function : xinit |
51 | //======================================================================= |
52 | static IFSelect_ReturnStatus XSControl_xinit(const Handle(IFSelect_SessionPilot)& pilot) |
53 | { |
54 | Standard_Integer argc = pilot->NbWords(); |
55 | const Standard_CString arg1 = pilot->Arg(1); |
56 | // **** xinit **** |
57 | if (argc > 1) return (XSControl::Session(pilot)->SelectNorm(arg1) ? |
58 | IFSelect_RetDone : IFSelect_RetFail); |
59 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
60 | sout<<"Selected Norm:"<<XSControl::Session(pilot)->SelectedNorm()<<endl; |
61 | return IFSelect_RetVoid; |
62 | } |
63 | |
64 | |
65 | //======================================================================= |
66 | //function : xnorm |
67 | //======================================================================= |
68 | static IFSelect_ReturnStatus XSControl_xnorm(const Handle(IFSelect_SessionPilot)& pilot) |
69 | { |
70 | Standard_Integer argc = pilot->NbWords(); |
71 | const Standard_CString arg1 = pilot->Arg(1); |
72 | // **** xnorm **** |
73 | Handle(XSControl_WorkSession) WS = XSControl::Session(pilot); |
74 | Handle(XSControl_Controller) control = WS->NormAdaptor(); |
75 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
76 | if (argc == 1) |
7f56eba8 |
77 | sout<<"Current Norm. xnorm newnorm to change"<<endl; |
7fd59977 |
78 | else sout<<"Current Norm :"<<endl; |
79 | if (control.IsNull()) sout<<"no norm currently defined"<<endl; |
80 | else |
81 | sout<<" Long Name (complete) : "<<control->Name(Standard_False)<<endl |
82 | << " Short name (resource) : "<<control->Name(Standard_True)<<endl; |
83 | if (argc == 1) return IFSelect_RetVoid; |
84 | |
7fd59977 |
85 | control = XSControl_Controller::Recorded(arg1); |
7f56eba8 |
86 | if (control.IsNull()) { |
87 | sout<<" No norm named : "<<arg1<<endl; |
88 | return IFSelect_RetError; |
7fd59977 |
89 | } |
90 | |
7f56eba8 |
91 | WS->SetController(control); |
92 | sout<<"new norm : "<<control->Name()<<endl; |
93 | return IFSelect_RetDone; |
7fd59977 |
94 | } |
95 | |
96 | |
97 | //======================================================================= |
98 | //function : newmodel |
99 | //======================================================================= |
100 | static IFSelect_ReturnStatus XSControl_newmodel(const Handle(IFSelect_SessionPilot)& pilot) |
101 | { |
102 | // **** newmodel **** |
103 | if (!XSControl::Session(pilot)->NewModel().IsNull()) return IFSelect_RetDone; |
104 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
105 | sout<<"No new Model produced"<<endl; |
106 | return IFSelect_RetFail; |
107 | } |
108 | |
109 | |
110 | //======================================================================= |
111 | //function : tpclear |
112 | //======================================================================= |
113 | static IFSelect_ReturnStatus XSControl_tpclear(const Handle(IFSelect_SessionPilot)& pilot) |
114 | { |
115 | // **** tpclear/twclear **** |
7f56eba8 |
116 | const Standard_Boolean modew = (pilot->Word(0).Value(2) == 'w'); |
117 | const Handle(Transfer_FinderProcess) &FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess(); |
118 | const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); |
7fd59977 |
119 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
7f56eba8 |
120 | if (modew) { if(!FP.IsNull()) FP->Clear(); else sout<<"No Transfer Write"<<endl; } |
121 | else { if(!TP.IsNull()) TP->Clear(); else sout<<"No Transfer Read"<<endl; } |
7fd59977 |
122 | return IFSelect_RetDone; |
123 | } |
124 | |
125 | |
126 | //======================================================================= |
127 | //function : tpstat |
128 | //======================================================================= |
129 | static IFSelect_ReturnStatus XSControl_tpstat(const Handle(IFSelect_SessionPilot)& pilot) |
130 | { |
131 | Standard_Integer argc = pilot->NbWords(); |
132 | const Standard_CString arg1 = pilot->Arg(1); |
133 | //const Standard_CString arg2 = pilot->Arg(2); |
7f56eba8 |
134 | const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); |
7fd59977 |
135 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
136 | if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;} |
137 | // **** tpstat **** |
138 | |
139 | Standard_Integer mod1 = -1; |
140 | Standard_Integer mod2 = 0; |
141 | // g : general c : check (compte) C (liste) f : fails(compte) F (liste) |
142 | // resultats racines : n : n0s entites s : status b : binders |
143 | // t : compte par type r : compte par resultat l : liste(type-resultat) |
144 | // *n *s *b *t *r *l : idem sur tout |
145 | // ?n etc.. : idem sur resultats anormaux |
146 | // ? tout court pour help |
147 | |
148 | if (argc > 1) { |
149 | char a2 = arg1[1]; if (a2 == '\0') a2 = '!'; |
150 | switch (arg1[0]) { |
151 | case 'g' : mod1 = 0; break; |
152 | case 'c' : mod1 = 4; mod2 = 4; break; |
153 | case 'C' : mod1 = 4; mod2 = 2; break; |
154 | case 'f' : mod1 = 5; mod2 = 4; break; |
155 | case 'F' : mod1 = 5; mod2 = 2; break; |
156 | case '*' : mod1 = 2; break; |
157 | case '?' : mod1 = 3; break; |
158 | default : mod1 = 1; if (argc > 2) mod1 = 2; a2 = arg1[0]; break; |
159 | } |
160 | if (mod1 < 1 || mod1 > 3) a2 = '!'; |
161 | switch (a2) { |
162 | case 'n' : mod2 = 0; break; |
163 | case 's' : mod2 = 1; break; |
164 | case 'b' : mod2 = 2; break; |
165 | case 't' : mod2 = 3; break; |
166 | case 'r' : mod2 = 4; break; |
167 | case 'l' : mod2 = 5; break; |
168 | case 'L' : mod2 = 6; break; |
169 | case '!' : break; |
170 | case '?' : mod1 = -1; break; |
171 | default : mod1 = -2; break; |
172 | } |
173 | } |
174 | // A present help eventuel |
175 | if (mod1 < -1) sout<<"Unknown Mode"<<endl; |
176 | if (mod1 < 0) { |
177 | sout<<"Modes available :\n" |
586db386 |
178 | <<"g : general c : checks (count) C (list)\n" |
179 | <<" f : fails (count) F (list)\n" |
180 | <<" n : numbers of transferred entities (on TRANSFER ROOTS)\n" |
181 | <<" s : their status (type entity-result , presence checks)\n" |
182 | <<" b : detail of binders\n" |
183 | <<" t : count per entity type r : per type/status result\n" |
184 | <<" l : count per couple type entity/result\n" |
185 | <<" L : list per couple type entity/result\n" |
186 | <<" *n *s *b *t *r *l *L : idem on ALL recorded items\n" |
187 | <<" ?n ?s ?b ?t ... : idem on abnormal items\n" |
7fd59977 |
188 | <<" n select : n applied on a selection idem for s b t r l"<<endl; |
189 | if (mod1 < -1) return IFSelect_RetError; |
190 | return IFSelect_RetVoid; |
191 | } |
192 | |
193 | if (!TP.IsNull()) { |
194 | sout<<"TransferRead :"; |
195 | if (TP->Model() != pilot->Session()->Model()) sout<<"Model differs from the session"; |
196 | Handle(TColStd_HSequenceOfTransient) list = |
197 | IFSelect_Functions::GiveList(pilot->Session(),pilot->CommandPart(2)); |
198 | XSControl_TransferReader::PrintStatsOnList (TP,list,mod1,mod2); |
199 | // TP->PrintStats (1,sout); |
200 | } |
201 | else sout<<"TransferRead : not defined"<<endl; |
202 | return IFSelect_RetVoid; |
203 | } |
204 | |
205 | |
206 | //======================================================================= |
207 | //function : tpent |
208 | //======================================================================= |
209 | static IFSelect_ReturnStatus XSControl_tpent(const Handle(IFSelect_SessionPilot)& pilot) |
210 | { |
211 | Standard_Integer argc = pilot->NbWords(); |
212 | const Standard_CString arg1 = pilot->Arg(1); |
7f56eba8 |
213 | const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); |
7fd59977 |
214 | // **** tpent **** |
215 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
216 | if (TP.IsNull()) { sout<<"No Transfer Read"<<endl; return IFSelect_RetError;} |
217 | Handle(Interface_InterfaceModel) model = TP->Model(); |
218 | if (model.IsNull()) return IFSelect_RetFail; |
219 | |
220 | if (argc < 2) { sout<<"Give ENTITY NUMBER (IN MODEL TransferProcess)"<<endl; return IFSelect_RetError; } |
221 | Standard_Integer num = atoi(arg1); |
222 | if (num <= 0 || num > model->NbEntities()) { sout<<"Number not in [1 - "<<model->NbEntities()<<"]"<<endl; return IFSelect_RetError; } |
223 | Handle(Standard_Transient) ent = model->Value(num); |
224 | Standard_Integer index = TP->MapIndex (ent); |
225 | if (index == 0) sout<<"Entity "<<num<<" not recorded in transfer"<<endl; |
226 | else XSControl::Session(pilot)->PrintTransferStatus (index,Standard_False,sout); |
227 | return IFSelect_RetVoid; |
228 | } |
229 | |
230 | |
231 | //======================================================================= |
232 | //function : tpitem |
233 | //======================================================================= |
234 | static IFSelect_ReturnStatus XSControl_tpitem(const Handle(IFSelect_SessionPilot)& pilot) |
235 | { |
236 | Standard_Integer argc = pilot->NbWords(); |
237 | const Standard_CString arg1 = pilot->Arg(1); |
238 | // **** tpitem/tproot/twitem/twroot **** |
239 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
240 | if (argc < 2) { sout<<"Give ITEM NUMBER (in TransferProcess)"<<endl; return IFSelect_RetError; } |
241 | Standard_Integer num = atoi(arg1); |
242 | if (pilot->Word(0).Value(3) == 'r') num = -num; |
243 | Standard_Boolean modew = Standard_False; |
244 | if (pilot->Word(0).Value(2) == 'w') modew = Standard_True; |
245 | Handle(Transfer_Binder) binder; |
246 | Handle(Transfer_Finder) finder; |
247 | Handle(Standard_Transient) ent; |
248 | if (!XSControl::Session(pilot)->PrintTransferStatus(num,modew,sout)) |
249 | sout<<" - Num="<<num<<" incorrect"<<endl; |
250 | return IFSelect_RetVoid; |
251 | } |
252 | |
253 | |
7fd59977 |
254 | //======================================================================= |
255 | //function : trecord |
256 | //======================================================================= |
257 | static IFSelect_ReturnStatus XSControl_trecord(const Handle(IFSelect_SessionPilot)& pilot) |
258 | { |
259 | Standard_Integer argc = pilot->NbWords(); |
260 | const Standard_CString arg1 = pilot->Arg(1); |
7f56eba8 |
261 | const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); |
7fd59977 |
262 | // **** trecord : TransferReader **** |
263 | Standard_Boolean tous = (argc == 1); |
264 | Standard_Integer num = -1; |
7f56eba8 |
265 | const Handle(Interface_InterfaceModel) &mdl = XSControl::Session(pilot)->Model(); |
266 | const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); |
7fd59977 |
267 | Handle(Standard_Transient) ent; |
268 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
269 | if (mdl.IsNull() || TR.IsNull() || TP.IsNull()) |
270 | { sout<<" init not done"<<endl; return IFSelect_RetError; } |
271 | if (!tous) num = atoi(arg1); |
272 | // Enregistrer les racines |
273 | if (tous) { |
274 | Standard_Integer nb = TP->NbRoots(); |
275 | sout<<" Recording "<<nb<<" Roots"<<endl; |
276 | for (Standard_Integer i = 1; i <= nb; i ++) { |
277 | ent = TP->Root(i); |
278 | if (TR->RecordResult (ent)) sout<<" Root n0."<<i<<endl; |
279 | else sout<<" Root n0."<<i<<" not recorded"<<endl; |
280 | } |
281 | } else { |
282 | if (num < 1 || num > mdl->NbEntities()) sout<<"incorrect number:"<<num<<endl; |
283 | else if (TR->RecordResult(mdl->Value(num))) sout<<" Entity n0."<<num<<endl; |
284 | else sout<<" Entity n0."<<num<<" not recorded"<<endl; |
285 | } |
286 | return IFSelect_RetDone; |
287 | } |
288 | |
289 | |
290 | //======================================================================= |
291 | //function : trstat |
292 | //======================================================================= |
293 | static IFSelect_ReturnStatus XSControl_trstat(const Handle(IFSelect_SessionPilot)& pilot) |
294 | { |
295 | Standard_Integer argc = pilot->NbWords(); |
296 | const Standard_CString arg1 = pilot->Arg(1); |
297 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
298 | // **** trstat : TransferReader **** |
7f56eba8 |
299 | const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); |
7fd59977 |
300 | if (TR.IsNull()) { sout<<" init not done"<<endl; return IFSelect_RetError; } |
301 | Handle(Interface_InterfaceModel) mdl = TR->Model(); |
302 | if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; } |
303 | sout<<" Statistics : FileName : "<<TR->FileName()<<endl; |
304 | if (argc == 1) { |
305 | // stats generales |
306 | TR->PrintStats(10,0); |
307 | } else { |
308 | // stats unitaires |
309 | Standard_Integer num = atoi(arg1); |
310 | if (num < 1 || num > mdl->NbEntities()) { sout<<" incorrect number:"<<arg1<<endl; return IFSelect_RetError; } |
311 | Handle(Standard_Transient) ent = mdl->Value(num); |
312 | if (!TR->IsRecorded(ent)) { sout<<" Entity "<<num<<" not recorded"<<endl; return IFSelect_RetError; } |
313 | Handle(Transfer_ResultFromModel) RM = TR->FinalResult(ent); |
314 | Handle(TColStd_HSequenceOfTransient) list = TR->CheckedList(ent); |
315 | Standard_Integer i, nb = list->Length(); |
316 | if (nb > 0) sout<<" Entities implied by Check/Result :"<<nb<<" i.e.:"; |
317 | for (i = 1; i <= nb; i ++) { sout<<" "; mdl->Print(list->Value(i),sout); } |
318 | sout<<endl; |
319 | if (RM.IsNull()) { sout<<" no other info"<<endl; return IFSelect_RetVoid; } |
320 | Interface_CheckIterator chl = RM->CheckList(Standard_False); |
321 | pilot->Session()->PrintCheckList(chl,Standard_False,IFSelect_EntitiesByItem); |
322 | } |
323 | return IFSelect_RetVoid; |
324 | } |
325 | |
326 | |
327 | //======================================================================= |
328 | //function : trbegin |
329 | //======================================================================= |
330 | static IFSelect_ReturnStatus XSControl_trbegin(const Handle(IFSelect_SessionPilot)& pilot) |
331 | { |
332 | // **** trbegin : TransferReader **** |
7f56eba8 |
333 | Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader(); |
7fd59977 |
334 | Standard_Boolean init = TR.IsNull(); |
335 | if (pilot->NbWords() > 1) { if (pilot->Arg(1)[0] == 'i') init = Standard_True; } |
336 | if (init) { |
337 | XSControl::Session(pilot)->InitTransferReader (0); |
7f56eba8 |
338 | TR = XSControl::Session(pilot)->TransferReader(); |
7fd59977 |
339 | if (TR.IsNull()) { |
340 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
341 | sout<<" init not done or failed"<<endl; |
342 | return IFSelect_RetError; |
343 | } |
344 | } |
345 | TR->BeginTransfer(); |
346 | return IFSelect_RetDone; |
347 | } |
348 | |
349 | |
350 | //======================================================================= |
351 | //function : tread |
352 | //======================================================================= |
353 | static IFSelect_ReturnStatus XSControl_tread(const Handle(IFSelect_SessionPilot)& pilot) |
354 | { |
355 | Standard_Integer argc = pilot->NbWords(); |
356 | //const Standard_CString arg1 = pilot->Arg(1); |
357 | // **** tread : TransferReader **** |
358 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
7f56eba8 |
359 | const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); |
7fd59977 |
360 | if (TR.IsNull()) { sout<<" init not done"<<endl; return IFSelect_RetError; } |
7f56eba8 |
361 | const Handle(Interface_InterfaceModel) &mdl = TR->Model(); |
7fd59977 |
362 | if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; } |
363 | if (argc < 2) { |
364 | // DeclareAndCast(IFSelect_Selection,sel,pilot->Session()->NamedItem("xst-model-roots")); |
365 | Handle(Standard_Transient) sel = pilot->Session()->NamedItem("xst-model-roots"); |
366 | if (sel.IsNull()) { sout<<"Select Roots absent"<<endl; return IFSelect_RetError; } |
367 | Handle(TColStd_HSequenceOfTransient) list = pilot->Session()->GiveList(sel); |
368 | sout<<" Transferring all roots i.e. : "<<TR->TransferList(list)<<endl; |
369 | } else { |
370 | Handle(TColStd_HSequenceOfTransient) list = |
371 | IFSelect_Functions::GiveList(pilot->Session(),pilot->CommandPart(1)); |
372 | sout<<" Transfer of "<<list->Length()<<" entities"<<endl; |
373 | Standard_Integer nb = TR->TransferList(list); |
374 | sout<<" Gives "<<nb<<" results"<<endl; |
375 | } |
376 | return IFSelect_RetDone; |
377 | } |
378 | |
379 | |
380 | //======================================================================= |
381 | //function : trtp |
382 | //======================================================================= |
383 | static IFSelect_ReturnStatus XSControl_trtp(const Handle(IFSelect_SessionPilot)& pilot) |
384 | { |
385 | // **** TReader -> TProcess **** |
7f56eba8 |
386 | const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); |
7fd59977 |
387 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
388 | if (TR.IsNull()) sout<<" No TransferReader"<<endl; |
389 | else if (TR->TransientProcess().IsNull()) sout<<" Transfer Reader without Process"<<endl; |
7fd59977 |
390 | return IFSelect_RetVoid; |
391 | } |
392 | |
393 | |
394 | //======================================================================= |
395 | //function : tptr |
396 | //======================================================================= |
397 | static IFSelect_ReturnStatus XSControl_tptr(const Handle(IFSelect_SessionPilot)& pilot) |
398 | { |
399 | // **** TProcess -> TReader **** |
400 | XSControl::Session(pilot)->InitTransferReader (3); |
401 | return IFSelect_RetDone; |
402 | } |
403 | |
404 | |
405 | //======================================================================= |
406 | //function : twmode |
407 | //======================================================================= |
408 | static IFSelect_ReturnStatus XSControl_twmode(const Handle(IFSelect_SessionPilot)& pilot) |
409 | { |
410 | Standard_Integer argc = pilot->NbWords(); |
411 | const Standard_CString arg1 = pilot->Arg(1); |
412 | // **** twmode **** |
413 | Handle(XSControl_TransferWriter) TW = XSControl::Session(pilot)->TransferWriter(); |
414 | Handle(XSControl_Controller) control = XSControl::Session(pilot)->NormAdaptor(); |
415 | Standard_Integer modemin,modemax; |
416 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
417 | if (control->ModeWriteBounds (modemin,modemax)) { |
418 | sout<<"Write Mode : allowed values "<<modemin<<" to "<<modemax<<endl; |
419 | for (Standard_Integer modd = modemin; modd <= modemax; modd ++) { |
420 | sout<<modd<<" : "<<control->ModeWriteHelp (modd)<<endl;; |
421 | } |
422 | } |
423 | sout<<"Write Mode : actual = "<<TW->TransferMode()<<endl; |
424 | if (argc <= 1) return IFSelect_RetVoid; |
425 | Standard_Integer mod = atoi(arg1); |
426 | sout<<"New value -> "<<arg1<<endl; |
427 | TW->SetTransferMode(mod); |
428 | if (!control->IsModeWrite (mod)) sout<<"Warning : this new value is not supported"<<endl; |
429 | return IFSelect_RetDone; |
430 | } |
431 | |
432 | |
433 | //======================================================================= |
434 | //function : twstat |
435 | //======================================================================= |
436 | static IFSelect_ReturnStatus XSControl_twstat(const Handle(IFSelect_SessionPilot)& pilot) |
437 | { |
438 | //Standard_Integer argc = pilot->NbWords(); |
439 | //const Standard_CString arg1 = pilot->Arg(1); |
440 | //const Standard_CString arg2 = pilot->Arg(2); |
7f56eba8 |
441 | const Handle(Transfer_FinderProcess) &FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess(); |
7fd59977 |
442 | // **** twstat **** |
443 | // Pour Write |
444 | Handle(Message_Messenger) sout = Message::DefaultMessenger(); |
445 | if (!FP.IsNull()) { |
446 | sout<<"TransferWrite:"; |
447 | // XSControl_TransferWriter::PrintStatsProcess (FP,mod1,mod2); |
448 | FP->PrintStats (1,sout); |
449 | } |
450 | else sout<<"TransferWrite: not defined"<<endl; |
451 | return IFSelect_RetVoid; |
452 | } |
453 | |
454 | |
455 | //======================================================================= |
456 | //function : settransfert |
457 | //======================================================================= |
458 | static IFSelect_ReturnStatus XSControl_settransfert(const Handle(IFSelect_SessionPilot)& pilot) |
459 | { |
460 | // **** SelectForTransfer **** |
461 | return pilot->RecordItem(new XSControl_SelectForTransfer(XSControl::Session(pilot)->TransferReader())); |
462 | } |
463 | |
464 | |
465 | |
466 | static int initactor = 0; |
467 | |
468 | //======================================================================= |
469 | //function : Init |
470 | //purpose : |
471 | //======================================================================= |
472 | |
473 | void XSControl_Functions::Init () |
474 | { |
475 | if (initactor) return; initactor = 1; |
476 | IFSelect_Act::SetGroup("DE: General"); |
477 | |
478 | IFSelect_Act::AddFunc ("xinit","[norm:string to change norme] reinitialises according to the norm",XSControl_xinit); |
479 | IFSelect_Act::AddFunc ("xnorm","displays current norm +norm : changes it",XSControl_xnorm); |
7fd59977 |
480 | |
481 | IFSelect_Act::AddFunc ("newmodel","produces a new empty model, for the session",XSControl_newmodel); |
482 | |
483 | IFSelect_Act::AddFunc ("tpclear","Clears TransferProcess (READ)",XSControl_tpclear); |
484 | IFSelect_Act::AddFunc ("twclear","Clears TransferProcess (WRITE)",XSControl_tpclear); |
485 | |
486 | IFSelect_Act::AddFunc ("tpstat","Statistics on TransferProcess (READ)",XSControl_tpstat); |
487 | |
488 | IFSelect_Act::AddFunc ("tpent","[num:integer] Statistics on an entity of the model (READ)",XSControl_tpent); |
489 | |
490 | IFSelect_Act::AddFunc ("tpitem","[num:integer] Statistics on ITEM of transfer (READ)" ,XSControl_tpitem); |
491 | IFSelect_Act::AddFunc ("tproot","[num:integer] Statistics on a ROOT of transfert (READ)" ,XSControl_tpitem); |
492 | IFSelect_Act::AddFunc ("twitem","[num:integer] Statistics on an ITEM of transfer (WRITE)" ,XSControl_tpitem); |
493 | IFSelect_Act::AddFunc ("twroot","[num:integer] Statistics on a ROOT of transfer (WRITE)",XSControl_tpitem); |
7fd59977 |
494 | |
495 | IFSelect_Act::AddFunc ("trecord","record : all root results; or num : for entity n0.num",XSControl_trecord); |
496 | IFSelect_Act::AddFunc ("trstat","general statistics; or num : stats on entity n0 num",XSControl_trstat); |
497 | IFSelect_Act::AddFunc ("trbegin","begin-transfer-reader [init]",XSControl_trbegin); |
498 | IFSelect_Act::AddFunc ("tread","transfers all roots, or num|sel|sel num : entity list, by transfer-reader",XSControl_tread); |
499 | |
500 | IFSelect_Act::AddFunc ("trtp","feeds commands tp... with results from tr...",XSControl_trtp); |
501 | IFSelect_Act::AddFunc ("tptr","feeds tr... from tp... (may be incomplete)",XSControl_tptr); |
502 | |
503 | IFSelect_Act::AddFunc ("twmode","displays mode transfer write, + num changes it",XSControl_twmode); |
504 | IFSelect_Act::AddFunc ("twstat","Statistics on TransferProcess (WRITE)",XSControl_twstat); |
505 | |
506 | IFSelect_Act::AddFSet ("selecttransfer","selection (recognize from transfer actor)",XSControl_settransfert); |
507 | } |