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