0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / IFSelect / IFSelect_WorkSession.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-12-15
2// Created by: Christian CAILLET
3// Copyright (c) 1992-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
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
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _IFSelect_WorkSession_HeaderFile
18#define _IFSelect_WorkSession_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <Standard_Boolean.hxx>
24#include <TCollection_AsciiString.hxx>
25#include <Interface_CheckIterator.hxx>
26#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
27#include <MMgt_TShared.hxx>
28#include <Standard_CString.hxx>
29#include <IFSelect_ReturnStatus.hxx>
30#include <Standard_Integer.hxx>
31#include <TColStd_HSequenceOfTransient.hxx>
32#include <TColStd_HSequenceOfInteger.hxx>
33#include <Standard_Type.hxx>
34#include <TColStd_HSequenceOfHAsciiString.hxx>
35#include <IFSelect_RemainMode.hxx>
36#include <TColStd_SequenceOfTransient.hxx>
37#include <TColStd_SequenceOfInteger.hxx>
38#include <IFSelect_PrintCount.hxx>
39class IFSelect_ShareOut;
40class IFSelect_WorkLibrary;
41class Interface_Protocol;
42class Interface_InterfaceModel;
43class Interface_HGraph;
44class Interface_GTool;
45class Dico_DictionaryOfTransient;
46class IFSelect_ModelCopier;
47class Standard_DomainError;
48class IFSelect_Signature;
49class Standard_Transient;
50class TCollection_HAsciiString;
51class Interface_Graph;
52class Interface_CheckIterator;
53class IFSelect_IntParam;
54class TCollection_AsciiString;
55class IFSelect_Selection;
56class Interface_EntityIterator;
57class IFSelect_SelectionIterator;
58class IFSelect_SignCounter;
59class IFSelect_Dispatch;
60class IFSelect_GeneralModifier;
61class IFSelect_Modifier;
62class IFSelect_Transformer;
63class IFSelect_PacketList;
64class Message_Messenger;
65class IFSelect_SignatureList;
66
67
68class IFSelect_WorkSession;
69DEFINE_STANDARD_HANDLE(IFSelect_WorkSession, MMgt_TShared)
70
71//! This class can be used to simply manage a process such as
72//! splitting a file, extracting a set of Entities ...
73//! It allows to manage different types of Variables : Integer or
74//! Text Parameters, Selections, Dispatches, in addition to a
75//! ShareOut. To each of these variables, a unique Integer
76//! Identifier is attached. A Name can be attached too as desired.
77class IFSelect_WorkSession : public MMgt_TShared
78{
79
80public:
81
82
83 //! Creates a Work Session
84 //! It provides default, empty ShareOut and ModelCopier, which can
85 //! be replaced (if required, should be done just after creation).
86 Standard_EXPORT IFSelect_WorkSession();
87
88 //! Changes the Error Handler status (by default, it is not set)
89 Standard_EXPORT void SetErrorHandle (const Standard_Boolean hand);
90
91 //! Returns the Error Handler status
92 Standard_EXPORT Standard_Boolean ErrorHandle() const;
93
94 //! Returns the ShareOut defined at creation time
95 Standard_EXPORT const Handle(IFSelect_ShareOut)& ShareOut() const;
96
97 //! Sets a new ShareOut. Fills Items which its content
98 //! Warning : data from the former ShareOut are lost
99 Standard_EXPORT void SetShareOut (const Handle(IFSelect_ShareOut)& shareout);
100
101 //! Set value of mode responsible for precence of selections after loading
102 //! If mode set to true that different selections will be accessible after loading
103 //! else selections will be not accessible after loading( for economy memory in applicatios)
104 Standard_EXPORT void SetModeStat (const Standard_Boolean theMode);
105
106 //! Return value of mode defining of filling selection during loading
107 Standard_EXPORT Standard_Boolean GetModeStat() const;
108
109 //! Sets a WorkLibrary, which will be used to Read and Write Files
110 Standard_EXPORT void SetLibrary (const Handle(IFSelect_WorkLibrary)& lib);
111
112 //! Returns the WorkLibrary. Null Handle if not yet set
113 //! should be C++ : return const &
114 Standard_EXPORT Handle(IFSelect_WorkLibrary) WorkLibrary() const;
115
116 //! Sets a Protocol, which will be used to determine Graphs, to
117 //! Read and to Write Files
118 Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& protocol);
119
120 //! Returns the Protocol. Null Handle if not yet set
121 //! should be C++ : return const &
122 Standard_EXPORT Handle(Interface_Protocol) Protocol() const;
123
124 //! Sets a specific Signature to be the SignType, i.e. the
125 //! Signature which will determine TypeName from the Model
126 //! (basic function). It is recorded in the GTool
127 //! This Signature is also set as "xst-sign-type" (reserved name)
128 Standard_EXPORT void SetSignType (const Handle(IFSelect_Signature)& signtype);
129
130 //! Returns the current SignType
131 Standard_EXPORT Handle(IFSelect_Signature) SignType() const;
132
133 //! Returns True is a Model has been set
134 Standard_EXPORT Standard_Boolean HasModel() const;
135
136 //! Sets a Model as input : this will be the Model from which the
137 //! ShareOut will work
138 //! if <clearpointed> is True (default) all SelectPointed items
139 //! are cleared, else they must be managed by the caller
140 //! Remark : SetModel clears the Graph, recomputes it if a
141 //! Protocol is set and if the Model is not empty, of course
142 Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model, const Standard_Boolean clearpointed = Standard_True);
143
144 //! Returns the Model of the Work Session (Null Handle if none)
145 //! should be C++ : return const &
146 Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
147
148 //! Stores the filename used for read for setting the model
149 //! It is cleared by SetModel and ClearData(1)
150 Standard_EXPORT void SetLoadedFile (const Standard_CString filename);
151
152 //! Returns the filename used to load current model
153 //! empty if unknown
154 Standard_EXPORT Standard_CString LoadedFile() const;
155
156 //! Reads a file with the WorkLibrary (sets Model and LoadedFile)
157 //! Returns a integer status which can be :
158 //! RetDone if OK, RetVoid if no Protocol not defined,
159 //! RetError for file not found, RetFail if fail during read
160 Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString filename);
161
162 //! Returns the count of Entities stored in the Model, or 0
163 Standard_EXPORT Standard_Integer NbStartingEntities() const;
164
165 //! Returns an Entity stored in the Model of the WorkSession
166 //! (Null Handle is no Model or num out of range)
167 Standard_EXPORT Handle(Standard_Transient) StartingEntity (const Standard_Integer num) const;
168
169 //! Returns the Number of an Entity in the Model
170 //! (0 if no Model set or <ent> not in the Model)
171 Standard_EXPORT Standard_Integer StartingNumber (const Handle(Standard_Transient)& ent) const;
172
173 //! From a given label in Model, returns the corresponding number
174 //! Starts from first entity by Default, may start after a given
175 //! number : this number may be given negative, its absolute value
176 //! is then considered. Hence a loop on NumberFromLabel may be
177 //! programmed (stop test is : returned value positive or null)
178 //!
179 //! Returns 0 if not found, < 0 if more than one found (first
180 //! found in negative).
181 //! If <val> just gives an integer value, returns it
182 Standard_EXPORT Standard_Integer NumberFromLabel (const Standard_CString val, const Standard_Integer afternum = 0) const;
183
184 //! Returns the label for <ent>, as the Model does
185 //! If <ent> is not in the Model or if no Model is loaded, a Null
186 //! Handle is returned
187 Standard_EXPORT Handle(TCollection_HAsciiString) EntityLabel (const Handle(Standard_Transient)& ent) const;
188
189 //! Returns the Name of an Entity
190 //! This Name is computed by the general service Name
191 //! Returns a Null Handle if fails
192 Standard_EXPORT Handle(TCollection_HAsciiString) EntityName (const Handle(Standard_Transient)& ent) const;
193
194 //! Returns the Category Number determined for an entity
195 //! it is computed by the class Category
196 //! An unknown entity (number 0) gives a value -1
197 Standard_EXPORT Standard_Integer CategoryNumber (const Handle(Standard_Transient)& ent) const;
198
199 //! Returns the Category Name determined for an entity
200 //! it is computed by the class Category
201 //! Remark : an unknown entity gives an empty string
202 Standard_EXPORT Standard_CString CategoryName (const Handle(Standard_Transient)& ent) const;
203
204 //! Returns the Validity Name determined for an entity
205 //! it is computed by the class SignValidity
206 //! Remark : an unknown entity gives an empty string
207 Standard_EXPORT Standard_CString ValidityName (const Handle(Standard_Transient)& ent) const;
208
209 //! Clears recorded data (not the items) according mode :
210 //! 1 : all Data : Model, Graph, CheckList, + ClearData 4
211 //! 2 : Graph and CheckList (they will then be recomputed later)
212 //! 3 : CheckList (it will be recomputed by ComputeCheck)
213 //! 4 : just content of SelectPointed and Counters
214 //! Plus 0 : does nothing but called by SetModel
215 //! ClearData is virtual, hence it can be redefined to clear
216 //! other data of a specialised Work Session
217 Standard_EXPORT virtual void ClearData (const Standard_Integer mode);
218
219 //! Computes the Graph used for Selections, Displays ...
220 //! If a HGraph is already set, with same model as given by method
221 //! Model, does nothing. Else, computes a new Graph.
222 //! If <enforce> is given True, computes a new Graph anyway.
223 //! Remark that a call to ClearGraph will cause ComputeGraph to
224 //! really compute a new Graph
225 //! Returns True if Graph is OK, False else (i.e. if no Protocol
226 //! is set, or if Model is absent or empty).
227 Standard_EXPORT Standard_Boolean ComputeGraph (const Standard_Boolean enforce = Standard_False);
228
229 //! Returns the Computed Graph as HGraph (Null Handle if not set)
230 Standard_EXPORT Handle(Interface_HGraph) HGraph();
231
232 //! Returns the Computed Graph, for Read only
233 Standard_EXPORT const Interface_Graph& Graph();
234
235 //! Returns the list of entities shared by <ent> (can be empty)
236 //! Returns a null Handle if <ent> is unknown
237 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Shareds (const Handle(Standard_Transient)& ent);
238
239 //! Returns the list of entities sharing <ent> (can be empty)
240 //! Returns a null Handle if <ent> is unknown
241 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Sharings (const Handle(Standard_Transient)& ent);
242
243 //! Returns True if a Model is defined and really loaded (not
244 //! empty), a Protocol is set and a Graph has been computed.
245 //! In this case, the WorkSession can start to work
246 Standard_EXPORT Standard_Boolean IsLoaded() const;
247
248 //! Computes the CheckList for the Model currently loaded
249 //! It can then be used for displays, querries ...
250 //! Returns True if OK, False else (i.e. no Protocol set, or Model
251 //! absent). If <enforce> is False, works only if not already done
252 //! or if a new Model has been loaded from last call.
253 //! Remark : computation is enforced by every call to
254 //! SetModel or RunTransformer
255 Standard_EXPORT Standard_Boolean ComputeCheck (const Standard_Boolean enforce = Standard_False);
256
257 //! Returns the Check List for the Model currently loaded :
258 //! <complete> = True : complete (syntactic & semantic messages),
259 //! computed if not yet done
260 //! <complete> = False : only syntactic (check file form)
261 Standard_EXPORT Interface_CheckIterator ModelCheckList (const Standard_Boolean complete = Standard_True);
262
263 //! Returns a Check for a single entity, under the form of a
264 //! CheckIterator (this gives only one form for the user)
265 //! if <ent> is Null or equates the current Model, it gives the
266 //! Global Check, else the Check for the given entity
267 //! <complete> as for ModelCheckList
268 Standard_EXPORT Interface_CheckIterator CheckOne (const Handle(Standard_Transient)& ent, const Standard_Boolean complete = Standard_True);
269
270 //! Returns the Check List produced by the last execution of
271 //! either : EvaluateFile(for Split), SendSplit, SendAll,
272 //! SendSelected, RunTransformer-RunModifier
273 //! Cleared by SetModel or ClearData(1)
274 //! The field is protected, hence a specialized WorkSession may
275 //! fill it
276 Standard_EXPORT Interface_CheckIterator LastRunCheckList() const;
277
278 //! Returns the Maximum Value for an Item Identifier. It can be
279 //! greater to the count of known Items, because some can have
280 //! been removed
281 Standard_EXPORT Standard_Integer MaxIdent() const;
282
283 //! Returns an Item, given its Ident. Returns a Null Handle if
284 //! no Item corresponds to this Ident.
285 Standard_EXPORT Handle(Standard_Transient) Item (const Standard_Integer id) const;
286
287 //! Returns the Ident attached to an Item in the WorkSession, or
288 //! Zero if it is unknown
289 Standard_EXPORT Standard_Integer ItemIdent (const Handle(Standard_Transient)& item) const;
290
291 //! Returns the Item which corresponds to a Variable, given its
292 //! Name (whatever the type of this Item).
293 //! Returns a Null Handle if this Name is not recorded
294 Standard_EXPORT Handle(Standard_Transient) NamedItem (const Standard_CString name) const;
295
296 //! Same as above, but <name> is given through a Handle
297 //! Especially Usefull with methods SelectionNames, etc...
298 Standard_EXPORT Handle(Standard_Transient) NamedItem (const Handle(TCollection_HAsciiString)& name) const;
299
300 //! Returns the Ident attached to a Name, 0 if name not recorded
301 Standard_EXPORT Standard_Integer NameIdent (const Standard_CString name) const;
302
303 //! Returns True if an Item of the WorkSession has an attached Name
304 Standard_EXPORT Standard_Boolean HasName (const Handle(Standard_Transient)& item) const;
305
306 //! Returns the Name attached to an Item as a Variable of this
307 //! WorkSession. If <item> is Null or not recorded, returns an
308 //! empty string.
309 Standard_EXPORT Handle(TCollection_HAsciiString) Name (const Handle(Standard_Transient)& item) const;
310
311 //! Adds an Item and returns its attached Ident. Does nothing
312 //! if <item> is already recorded (and returns its attached Ident)
313 //! <active> if True commands call to SetActive (see below)
314 //! Remark : the determined Ident is used if <item> is a Dispatch,
315 //! to fill the ShareOut
316 Standard_EXPORT Standard_Integer AddItem (const Handle(Standard_Transient)& item, const Standard_Boolean active = Standard_True);
317
318 //! Adds an Item with an attached Name. If the Name is already
319 //! known in the WorkSession, the older item losts it
320 //! Returns Ident if Done, 0 else, i.e. if <item> is null
321 //! If <name> is empty, works as AddItem (i.e. with no name)
322 //! If <item> is already known but with no attached Name, this
323 //! method tries to attached a Name to it
324 //! <active> if True commands call to SetActive (see below)
325 Standard_EXPORT Standard_Integer AddNamedItem (const Standard_CString name, const Handle(Standard_Transient)& item, const Standard_Boolean active = Standard_True);
326
327 //! Following the type of <item> :
328 //! - Dispatch : Adds or Removes it in the ShareOut & FileNaming
329 //! - GeneralModifier : Adds or Removes it for final sending
330 //! (i.e. in the ModelCopier)
331 //! Returns True if it did something, False else (state unchanged)
332 Standard_EXPORT Standard_Boolean SetActive (const Handle(Standard_Transient)& item, const Standard_Boolean mode);
333
334 //! Removes an Item from the Session, given its Name
335 //! Returns True if Done, False else (Name not recorded)
336 //! (Applies only on Item which are Named)
337 Standard_EXPORT Standard_Boolean RemoveNamedItem (const Standard_CString name);
338
339 //! Removes a Name without removing the Item
340 //! Returns True if Done, False else (Name not recorded)
341 Standard_EXPORT Standard_Boolean RemoveName (const Standard_CString name);
342
343 //! Removes an Item given its Ident. Returns False if <id> is
344 //! attached to no Item in the WorkSession. For a Named Item,
345 //! also removes its Name.
346 Standard_EXPORT Standard_Boolean RemoveItem (const Handle(Standard_Transient)& item);
347
348 //! Clears all the recorded Items : Selections, Dispatches,
349 //! Modifiers, and Strings & IntParams, with their Idents & Names.
350 //! Remark that if a Model has been loaded, it is not cleared.
351 Standard_EXPORT void ClearItems();
352
353 //! Returns a Label which illustrates the content of an Item,
354 //! given its Ident. This Label is :
355 //! - for a Text Parameter, "Text:<text value>"
356 //! - for an Integer Parameter, "Integer:<integer value>"
357 //! - for a Selection, a Dispatch or a Modifier, its Label
358 //! (see these classes)
359 //! - for any other kind of Variable, its cdl type
360 Standard_EXPORT Handle(TCollection_HAsciiString) ItemLabel (const Standard_Integer id) const;
361
362 //! Fills a Sequence with the List of Idents attached to the Items
363 //! of which Type complies with (IsKind) <type> (alphabetic order)
364 //! Remark : <type> = TYPE(Standard_Transient) gives all the
365 //! Idents which are suitable in the WorkSession
366 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) ItemIdents (const Handle(Standard_Type)& type) const;
367
368 //! Fills a Sequence with the list of the Names attached to Items
369 //! of which Type complies with (IsKind) <type> (alphabetic order)
370 //! Remark : <type> = TYPE(Standard_Transient) gives all the Names
371 Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) ItemNames (const Handle(Standard_Type)& type) const;
372
373 //! Fills a Sequence with the NAMES of the control items, of which
374 //! the label matches <label> (contain it) : see NextIdentForLabel
375 //! Search mode is fixed to "contained"
376 //! If <label> is empty, returns all Names
377 Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) ItemNamesForLabel (const Standard_CString label) const;
378
379 //! For query by Label with possible iterations
380 //! Searches the Ident of which Item has a Label which matches a
381 //! given one, the search starts from an initial Ident.
382 //! Returns the first found Ident which follows <id>, or ZERO
383 //!
384 //! The search must start with <id> = 0, it returns the next Ident
385 //! which matches. To iterate, call again this method which this
386 //! returned value as <id>. Once an Ident has been returned, the
387 //! Item can be obtained by the method Item
388 //!
389 //! <mode> precises the required matching mode :
390 //! - 0 (Default) : <label> must match exactly with the Item Label
391 //! - 1 : <label> must match the exact beginning (the end is free)
392 //! - 2 : <label> must be at least once wherever in the Item Label
393 //! - other values are ignored
394 Standard_EXPORT Standard_Integer NextIdentForLabel (const Standard_CString label, const Standard_Integer id, const Standard_Integer mode = 0) const;
395
396 //! Creates a parameter as being bound to a Static
397 //! If the Static is Integer, this creates an IntParam bound to
398 //! it by its name. Else this creates a String which is the value
399 //! of the Static.
400 //! Returns a null handle if <statname> is unknown as a Static
401 Standard_EXPORT Handle(Standard_Transient) NewParamFromStatic (const Standard_CString statname, const Standard_CString name = "");
402
403 //! Returns an IntParam, given its Ident in the Session
404 //! Null result if <id> is not suitable for an IntParam
405 //! (undefined, or defined for another kind of variable)
406 Standard_EXPORT Handle(IFSelect_IntParam) IntParam (const Standard_Integer id) const;
407
408 //! Returns Integer Value of an IntParam
409 Standard_EXPORT Standard_Integer IntValue (const Handle(IFSelect_IntParam)& it) const;
410
411 //! Creates a new IntParam. A Name can be set (Optional)
412 //! Returns the created IntParam, or a Null Handle in case of
413 //! Failure (see AddItem/AddNamedItem)
414 Standard_EXPORT Handle(IFSelect_IntParam) NewIntParam (const Standard_CString name = "");
415
416 //! Changes the Integer Value of an IntParam
417 //! Returns True if Done, False if <it> is not in the WorkSession
418 Standard_EXPORT Standard_Boolean SetIntValue (const Handle(IFSelect_IntParam)& it, const Standard_Integer val);
419
420 //! Returns a TextParam, given its Ident in the Session
421 //! Null result if <id> is not suitable for a TextParam
422 //! (undefined, or defined for another kind of variable)
423 Standard_EXPORT Handle(TCollection_HAsciiString) TextParam (const Standard_Integer id) const;
424
425 //! Returns Text Value of a TextParam (a String)
426 //! or an empty string if <it> is not in the WorkSession
427 Standard_EXPORT TCollection_AsciiString TextValue (const Handle(TCollection_HAsciiString)& par) const;
428
429 //! Creates a new (empty) TextParam. A Name can be set (Optional)
430 //! Returns the created TextParam (as an HAsciiString), or a Null
431 //! Handle in case of Failure (see AddItem/AddNamedItem)
432 Standard_EXPORT Handle(TCollection_HAsciiString) NewTextParam (const Standard_CString name = "");
433
434 //! Changes the Text Value of a TextParam (an HAsciiString)
435 //! Returns True if Done, False if <it> is not in the WorkSession
436 Standard_EXPORT Standard_Boolean SetTextValue (const Handle(TCollection_HAsciiString)& par, const Standard_CString val);
437
438 //! Returns a Signature, given its Ident in the Session
439 //! Null result if <id> is not suitable for a Signature
440 //! (undefined, or defined for another kind of variable)
441 Standard_EXPORT Handle(IFSelect_Signature) Signature (const Standard_Integer id) const;
442
443 //! Returns the Value computed by a Signature for an Entity
444 //! Returns an empty string if the entity does not belong to the
445 //! loaded model
446 Standard_EXPORT Standard_CString SignValue (const Handle(IFSelect_Signature)& sign, const Handle(Standard_Transient)& ent) const;
447
448 //! Returns a Selection, given its Ident in the Session
449 //! Null result if <id> is not suitable for a Selection
450 //! (undefined, or defined for another kind of variable)
451 Standard_EXPORT Handle(IFSelect_Selection) Selection (const Standard_Integer id) const;
452
453 //! Evaluates the effect of a Selection applied on the input Model
454 //! Returned Result remains empty if no input Model has been set
455 Standard_EXPORT Interface_EntityIterator EvalSelection (const Handle(IFSelect_Selection)& sel) const;
456
457 //! Returns the Selections which are source of Selection, given
458 //! its rank in the List of Selections (see SelectionIterator)
459 //! Returned value is empty if <num> is out of range or if
460 //! <sel> is not in the WorkSession
461 Standard_EXPORT IFSelect_SelectionIterator Sources (const Handle(IFSelect_Selection)& sel) const;
462
463 //! Returns the result of a Selection, computed by EvalSelection
464 //! (see above) under the form of a HSequence (hence, it can be
465 //! used by a frontal-engine logic). It can be empty
466 //! Returns a Null Handle if <sel> is not in the WorkSession
467 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) SelectionResult (const Handle(IFSelect_Selection)& sel) const;
468
469 //! Returns the result of a Selection, by forcing its input with
470 //! a given list <list> (unless <list> is Null).
471 //! RULES :
472 //! <list> applies only for a SelectDeduct kind Selection :
473 //! its Input is considered : if it is a SelectDeduct kind
474 //! Selection, its Input is considered, etc... until an Input
475 //! is not a Deduct/Extract : its result is replaced by <list>
476 //! and all the chain of deductions is applied
477 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) SelectionResultFromList (const Handle(IFSelect_Selection)& sel, const Handle(TColStd_HSequenceOfTransient)& list) const;
478
479 //! Sets a Selection as input for an item, according its type :
480 //! if <item> is a Dispatch : as Final Selection
481 //! if <item> is a GeneralModifier (i.e. any kind of Modifier) :
482 //! as Selection used to filter entities to modify
483 //! <sel> Null causes this Selection to be nullified
484 //! Returns False if <item> is not of a suitable type, or
485 //! <item> or <sel> is not in the WorkSession
486 Standard_EXPORT Standard_Boolean SetItemSelection (const Handle(Standard_Transient)& item, const Handle(IFSelect_Selection)& sel);
487
488 //! Resets input Selection which was set by SetItemSelection
489 //! Same conditions as for SetItemSelection
490 //! Returns True if done, False if <item> is not in the WorkSession
491 Standard_EXPORT Standard_Boolean ResetItemSelection (const Handle(Standard_Transient)& item);
492
493 //! Returns the Selection of a Dispatch or a GeneralModifier.
494 //! Returns a Null Handle if none is defined or <item> not good type
495 Standard_EXPORT Handle(IFSelect_Selection) ItemSelection (const Handle(Standard_Transient)& item) const;
496
497 //! Returns a SignCounter from its ident in the Session
498 //! Null result if <id> is not suitable for a SignCounter
499 //! (undefined, or defined for another kind of variable)
500 Standard_EXPORT Handle(IFSelect_SignCounter) SignCounter (const Standard_Integer id) const;
501
502 //! Computes the content of a SignCounter when it is defined with
503 //! a Selection, then returns True
504 //! Returns False if the SignCounter is not defined with a
505 //! Selection, or if its Selection Mode is inhibited
506 //! <forced> to work around optimisations
507 Standard_EXPORT Standard_Boolean ComputeCounter (const Handle(IFSelect_SignCounter)& counter, const Standard_Boolean forced = Standard_False);
508
509 //! Computes the content of a SignCounter from an input list
510 //! If <list> is Null, uses internal definition of the Counter :
511 //! a Selection, else the whole Model (recomputation forced)
512 //! If <clear> is True (D), starts from scratch
513 //! Else, cumulates computations
514 Standard_EXPORT Standard_Boolean ComputeCounterFromList (const Handle(IFSelect_SignCounter)& counter, const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean clear = Standard_True);
515
516 //! Returns the ordered list of dispatches stored by the ShareOut
517 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) AppliedDispatches() const;
518
519 //! Clears the list of Dispatches recorded by the ShareOut
520 //! if <only> disp is True, tha's all. Else, clears also the lists
521 //! of Modifiers recorded by the ShareOut
522 Standard_EXPORT void ClearShareOut (const Standard_Boolean onlydisp);
523
524 //! Returns a Dispatch, given its Ident in the Session
525 //! Null result if <id> is not suitable for a Dispatch
526 //! (undefined, or defined for another kind of variable)
527 Standard_EXPORT Handle(IFSelect_Dispatch) Dispatch (const Standard_Integer id) const;
528
529 //! Returns the rank of a Dispatch in the ShareOut, or 0 if <disp>
530 //! is not in the ShareOut or not in the WorkSession
531 Standard_EXPORT Standard_Integer DispatchRank (const Handle(IFSelect_Dispatch)& disp) const;
532
533 //! Gives access to the complete ModelCopier
534 Standard_EXPORT Handle(IFSelect_ModelCopier) ModelCopier() const;
535
536 //! Sets a new ModelCopier. Fills Items which its content
537 Standard_EXPORT void SetModelCopier (const Handle(IFSelect_ModelCopier)& copier);
538
539 //! Returns the count of Modifiers applied to final sending
540 //! Model Modifiers if <formodel> is True, File Modifiers else
541 //! (i.e. Modifiers which apply once the Models have been filled)
542 Standard_EXPORT Standard_Integer NbFinalModifiers (const Standard_Boolean formodel) const;
543
544 //! Fills a Sequence with a list of Idents, those attached to
545 //! the Modifiers applied to final sending.
546 //! Model Modifiers if <formodel> is True, File Modifiers else
547 //! This list is given in the order in which they will be applied
548 //! (which takes into account the Changes to Modifier Ranks)
549 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) FinalModifierIdents (const Standard_Boolean formodel) const;
550
551 //! Returns a Modifier, given its Ident in the Session
552 //! Null result if <id> is not suitable for a Modifier
553 //! (undefined, or defined for another kind of variable)
554 Standard_EXPORT Handle(IFSelect_GeneralModifier) GeneralModifier (const Standard_Integer id) const;
555
556 //! Returns a Model Modifier, given its Ident in the Session,
557 //! i.e. typed as a Modifier (not simply a GeneralModifier)
558 //! Null result if <id> is not suitable for a Modifier
559 //! (undefined, or defined for another kind of variable)
560 Standard_EXPORT Handle(IFSelect_Modifier) ModelModifier (const Standard_Integer id) const;
561
562 //! Returns the Rank of a Modifier given its Ident. Model or File
563 //! Modifier according its type (ModelModifier or not)
564 //! Remember that Modifiers are applied sequencially following
565 //! their Rank : first Model Modifiers then File Modifiers
566 //! Rank is given by rank of call to AddItem and can be
567 //! changed by ChangeModifierRank
568 Standard_EXPORT Standard_Integer ModifierRank (const Handle(IFSelect_GeneralModifier)& item) const;
569
570 //! Changes the Rank of a Modifier in the Session :
571 //! Model Modifiers if <formodel> is True, File Modifiers else
572 //! the Modifier n0 <before> is put to n0 <after>
573 //! Return True if Done, False if <before> or <after> out of range
574 Standard_EXPORT Standard_Boolean ChangeModifierRank (const Standard_Boolean formodel, const Standard_Integer before, const Standard_Integer after);
575
576 //! Removes all the Modifiers active in the ModelCopier : they
577 //! become inactive and they are removed from the Session
578 Standard_EXPORT void ClearFinalModifiers();
579
580 //! Sets a GeneralModifier to be applied to an item :
581 //! - item = ShareOut : applies for final sending (all dispatches)
582 //! - item is a Dispatch : applies for this dispatch only
583 //! Returns True if done, False if <modif> or <item> not in <me>
584 Standard_EXPORT Standard_Boolean SetAppliedModifier (const Handle(IFSelect_GeneralModifier)& modif, const Handle(Standard_Transient)& item);
585
586 //! Resets a GeneralModifier to be applied
587 //! Returns True if done, False if <modif> was not applied
588 Standard_EXPORT Standard_Boolean ResetAppliedModifier (const Handle(IFSelect_GeneralModifier)& modif);
589
590 //! Returns the item on which a GeneralModifier is applied :
591 //! the ShareOut, or a given Dispatch
592 //! Returns a Null Handle if <modif> is not applied
593 Standard_EXPORT Handle(Standard_Transient) UsesAppliedModifier (const Handle(IFSelect_GeneralModifier)& modif) const;
594
595 //! Returns a Transformer, given its Ident in the Session
596 //! Null result if <id> is not suitable for a Transformer
597 //! (undefined, or defined for another kind of variable)
598 Standard_EXPORT Handle(IFSelect_Transformer) Transformer (const Standard_Integer id) const;
599
600 //! Runs a Transformer on starting Model, which can then be edited
601 //! or replaced by a new one. The Protocol can also be changed.
602 //! Fills LastRunCheckList
603 //!
604 //! Returned status is 0 if nothing done (<transf> or model
605 //! undefined), positive if OK, negative else :
606 //! 0 : Nothing done
607 //! 1 : OK, edition on the spot with no change to the graph
608 //! of dependances (purely local)
609 //! 2 : OK, model edited on the spot (graph recomputed, may
610 //! have changed), protocol unchanged
611 //! 3 : OK, new model produced, same protocol
612 //! 4 : OK, model edited on the spot (graph recomputed),
613 //! but protocol has changed
614 //! 5 : OK, new model produced, protocol has changed
615 //! -1 : Error on the spot (slight changes), data may be corrupted
616 //! (remark : corruption should not be profound)
617 //! -2 : Error on edition the spot, data may be corrupted
618 //! (checking them is recommanded)
619 //! -3 : Error with a new data set, transformation ignored
620 //! -4 : OK as 4, but graph of dependances count not be recomputed
621 //! (the former one is kept) : check the protocol
622 Standard_EXPORT Standard_Integer RunTransformer (const Handle(IFSelect_Transformer)& transf);
623
624 //! Runs a Modifier on Starting Model. It can modify entities, or
625 //! add new ones. But the Model or the Protocol is unchanged.
626 //! The Modifier is applied on each entity of the Model. See also
627 //! RunModifierSelected
628 //! Fills LastRunCheckList
629 //!
630 //! <copy> : if True, a new data set is produced which brings
631 //! the modifications (Model + its Entities)
632 //! if False, data are modified on the spot
633 //!
634 //! It works through a TransformStandard defined with <modif>
635 //! Returned status as RunTransformer : 0 nothing done, >0 OK,
636 //! <0 problem, but only between -3 and 3 (protocol unchanged)
637 //! Remark : <copy> True will give <effect> = 3 or -3
638 Standard_EXPORT Standard_Integer RunModifier (const Handle(IFSelect_Modifier)& modif, const Standard_Boolean copy);
639
640 //! Acts as RunModifier, but the Modifier is applied on the list
641 //! determined by a Selection, rather than on the whole Model
642 //! If the selection is a null handle, the whole model is taken
643 Standard_EXPORT Standard_Integer RunModifierSelected (const Handle(IFSelect_Modifier)& modif, const Handle(IFSelect_Selection)& sel, const Standard_Boolean copy);
644
645 //! Creates and returns a TransformStandard, empty, with its
646 //! Copy Option (True = Copy, False = On the Spot) and an
647 //! optional name.
648 //! To a TransformStandard, the method SetAppliedModifier applies
649 Standard_EXPORT Handle(IFSelect_Transformer) NewTransformStandard (const Standard_Boolean copy, const Standard_CString name = "");
650
651 //! Defines a new content from the former one
652 //! If <keep> is True, it is given by entities selected by
653 //! Selection <sel> (and all shared entities)
654 //! Else, it is given by all the former content but entities
655 //! selected by the Selection <sel> (and properly shared ones)
656 //! Returns True if done. Returns False if the selected list
657 //! (from <sel>) is empty, hence nothing is done
658 Standard_EXPORT Standard_Boolean SetModelContent (const Handle(IFSelect_Selection)& sel, const Standard_Boolean keep);
659
660 //! Returns the defined File Prefix. Null Handle if not defined
661 Standard_EXPORT Handle(TCollection_HAsciiString) FilePrefix() const;
662
663 //! Returns the defined Default File Root. It is used for
664 //! Dispatches which have no specific root attached.
665 //! Null Handle if not defined
666 Standard_EXPORT Handle(TCollection_HAsciiString) DefaultFileRoot() const;
667
668 //! Returns the defined File Extension. Null Handle if not defined
669 Standard_EXPORT Handle(TCollection_HAsciiString) FileExtension() const;
670
671 //! Returns the File Root defined for a Dispatch. Null if no
672 //! Root Name is defined for it (hence, no File will be produced)
673 Standard_EXPORT Handle(TCollection_HAsciiString) FileRoot (const Handle(IFSelect_Dispatch)& disp) const;
674
675 //! Defines a File Prefix
676 Standard_EXPORT void SetFilePrefix (const Standard_CString name);
677
678 //! Defines a Default File Root Name. Clears it is <name> = ""
679 //! Returns True if OK, False if <name> already set for a Dispatch
680 Standard_EXPORT Standard_Boolean SetDefaultFileRoot (const Standard_CString name);
681
682 //! Defines a File Extension
683 Standard_EXPORT void SetFileExtension (const Standard_CString name);
684
685 //! Defines a Root for a Dispatch
686 //! If <name> is empty, clears Root Name
687 //! This has as effect to inhibit the production of File by <disp>
688 //! Returns False if <disp> is not in the WorkSession or if a
689 //! root name is already defined for it
690 Standard_EXPORT Standard_Boolean SetFileRoot (const Handle(IFSelect_Dispatch)& disp, const Standard_CString name);
691
692 //! Extracts File Root Name from a given complete file name
693 //! (uses OSD_Path)
694 Standard_EXPORT Standard_CString GiveFileRoot (const Standard_CString file) const;
695
696 //! Completes a file name as required, with Prefix and Extension
697 //! (if defined; for a non-defined item, completes nothing)
698 Standard_EXPORT Standard_CString GiveFileComplete (const Standard_CString file) const;
699
700 //! Erases all stored data from the File Evaluation
701 //! (i.e. ALL former naming informations are lost)
702 Standard_EXPORT void ClearFile();
703
704 //! Performs and stores a File Evaluation. The Results are a List
705 //! of produced Models and a List of names (Strings), in parallel
706 //! Fills LastRunCheckList
707 Standard_EXPORT void EvaluateFile();
708
709 //! Returns the count of produced Models
710 Standard_EXPORT Standard_Integer NbFiles() const;
711
712 //! Returns a Model, given its rank in the Evaluation List
713 Standard_EXPORT Handle(Interface_InterfaceModel) FileModel (const Standard_Integer num) const;
714
715 //! Returns the name of a file corresponding to a produced Model,
716 //! given its rank in the Evaluation List
717 Standard_EXPORT TCollection_AsciiString FileName (const Standard_Integer num) const;
718
719 //! Commands file sending to clear the list of already sent files,
720 //! commands to record a new one if <record> is True
721 //! This list is managed by the ModelCopier when SendSplit is called
722 //! It allows a global exploitation of the set of sent files
723 Standard_EXPORT void BeginSentFiles (const Standard_Boolean record);
724
725 //! Returns the list of recorded sent files, or a Null Handle is
726 //! recording has not been enabled
727 Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) SentFiles() const;
728
729 //! Performs creation of derived files from the input Model
730 //! Takes its data (sub-models and names), from result EvaluateFile
731 //! if active, else by dynamic Evaluation (not stored)
732 //! After SendSplit, result of EvaluateFile is Cleared
733 //! Fills LastRunCheckList
734 //!
735 //! Works with the WorkLibrary which acts on specific type of Model
736 //! and can work with File Modifiers (managed by the Model Copier)
737 //! and a ModelCopier, which can work with Model Modifiers
738 //! Returns False if, either WorkLibrary has failed on at least
739 //! one sub-file, or the Work Session is badly conditionned
740 //! (no Model defined, or FileNaming not in phase with ShareOut)
741 Standard_EXPORT Standard_Boolean SendSplit();
742
743 //! Returns an Evaluation of the whole ShareOut definition : i.e.
744 //! how the entities of the starting model are forecast to be sent
745 //! to various files : list of packets according the dispatches,
746 //! effective lists of roots for each packet (which determine the
747 //! content of the corresponding file); plus evaluation of which
748 //! entities are : forgotten (sent into no file), duplicated (sent
749 //! into more than one file), sent into a given file.
750 //! See the class PacketList for more details.
751 Standard_EXPORT Handle(IFSelect_PacketList) EvalSplit() const;
752
753 //! Returns the list of Entities sent in files, accourding the
754 //! count of files each one has been sent (these counts are reset
755 //! by SetModel or SetRemaining(Forget) ) stored in Graph Status
756 //! <count> = -1 (default) is for ENtities sent at least once
757 //! <count> = 0 is for the Remaining List (entities not yet sent)
758 //! <count> = 1 is for entities sent in one and only one file
759 //! (the ideal case)
760 //! Remaining Data are computed on each Sending/Copying output
761 //! files (see methods EvaluateFile and SendSplit)
762 //! Graph Status is 0 for Remaining Entity, <count> for Sent into
763 //! <count> files
764 //! This status is set to 0 (not yet sent) for all by SetModel
765 //! and by SetRemaining(mode=Forget,Display)
766 Standard_EXPORT Interface_EntityIterator SentList (const Standard_Integer count = -1) const;
767
768 //! Returns the greater count of different files in which any of
769 //! the starting entities could be sent.
770 //! Before any file output, this count is 0.
771 //! Ideal count is 1. More than 1 means that duplications occur.
772 Standard_EXPORT Standard_Integer MaxSendingCount() const;
773
774 //! Processes Remaining data (after having sent files), mode :
775 //! Forget : forget remaining info (i.e. clear all "Sent" status)
776 //! Compute : compute and keep remaining (does nothing if :
777 //! remaining is empty or if no files has been sent)
778 //! Display : display entities recorded as remaining
779 //! Undo : restore former state of data (after Remaining(1) )
780 //! Returns True if OK, False else (i.e. mode = 2 and Remaining
781 //! List is either empty or takes all the entities, or mode = 3
782 //! and no former computation of remaining data was done)
783 Standard_EXPORT Standard_Boolean SetRemaining (const IFSelect_RemainMode mode);
784
785 //! Sends the starting Model into one file, without splitting,
786 //! managing remaining data or anything else.
787 //! <computegraph> true commands the Graph to be recomputed before
788 //! sending : required when a Model is filled in several steps
789 //!
790 //! The Model and File Modifiers recorded to be applied on sending
791 //! files are.
792 //! Returns a status of execution :
793 //! Done if OK,
794 //! Void if no data available,
795 //! Error if errors occured (work library is not defined), errors
796 //! during translation
797 //! Fail if exception during translation is raised
798 //! Stop if no disk space or disk, file is write protected
799 //! Fills LastRunCheckList
800 Standard_EXPORT IFSelect_ReturnStatus SendAll (const Standard_CString filename, const Standard_Boolean computegraph = Standard_False);
801
802 //! Sends a part of the starting Model into one file, without
803 //! splitting. But remaining data are managed.
804 //! <computegraph> true commands the Graph to be recomputed before
805 //! sending : required when a Model is filled in several steps
806 //!
807 //! The Model and File Modifiers recorded to be applied on sending
808 //! files are.
809 //! Returns a status : Done if OK, Fail if error during send,
810 //! Error : WorkLibrary not defined, Void : selection list empty
811 //! Fills LastRunCheckList
812 Standard_EXPORT IFSelect_ReturnStatus SendSelected (const Standard_CString filename, const Handle(IFSelect_Selection)& sel, const Standard_Boolean computegraph = Standard_False);
813
814 //! Writes the current Interface Model globally to a File, and
815 //! returns a write status which can be :
816 //! Done OK, Fail file could not be written, Error no norm is selected
817 //! Remark : It is a simple, one-file writing, other operations are
818 //! available (such as splitting ...) which calls SendAll
819 Standard_EXPORT IFSelect_ReturnStatus WriteFile (const Standard_CString filename);
820
821 //! Writes a sub-part of the current Interface Model to a File,
822 //! as defined by a Selection <sel>, recomputes the Graph, and
823 //! returns a write status which can be :
824 //! Done OK, Fail file could not be written, Error no norm is selected
825 //! Remark : It is a simple, one-file writing, other operations are
826 //! available (such as splitting ...) which calls SendSelected
827 Standard_EXPORT IFSelect_ReturnStatus WriteFile (const Standard_CString filename, const Handle(IFSelect_Selection)& sel);
828
829 //! Returns the count of Input Selections known for a Selection,
830 //! or 0 if <sel> not in the WorkSession. This count is one for a
831 //! SelectDeduct / SelectExtract kind, two for SelectControl kind,
832 //! variable for a SelectCombine (Union/Intersection), zero else
833 Standard_EXPORT Standard_Integer NbSources (const Handle(IFSelect_Selection)& sel) const;
834
835 //! Returns the <num>th Input Selection of a Selection
836 //! (see NbSources).
837 //! Returns a Null Handle if <sel> is not in the WorkSession or if
838 //! <num> is out of the range <1-NbSources>
839 //! To obtain more details, see the method Sources
840 Standard_EXPORT Handle(IFSelect_Selection) Source (const Handle(IFSelect_Selection)& sel, const Standard_Integer num = 1) const;
841
842 //! Returns True if <sel> a Reversed SelectExtract, False else
843 Standard_EXPORT Standard_Boolean IsReversedSelectExtract (const Handle(IFSelect_Selection)& sel) const;
844
845 //! Toggles the Sense (Direct <-> Reversed) of a SelectExtract
846 //! Returns True if Done, False if <sel> is not a SelectExtract or
847 //! is not in the WorkSession
848 Standard_EXPORT Standard_Boolean ToggleSelectExtract (const Handle(IFSelect_Selection)& sel);
849
850 //! Sets an Input Selection (as <input>) to a SelectExtract or
851 //! a SelectDeduct (as <sel>).
852 //! Returns True if Done, False if <sel> is neither a
853 //! SelectExtract nor a SelectDeduct, or not in the WorkSession
854 Standard_EXPORT Standard_Boolean SetInputSelection (const Handle(IFSelect_Selection)& sel, const Handle(IFSelect_Selection)& input);
855
856 //! Sets an Input Selection, Main if <formain> is True, Second else
857 //! (as <sc>) to a SelectControl (as <sel>). Returns True if Done,
858 //! False if <sel> is not a SelectControl, or <sc> or <sel> is not
859 //! in the WorkSession
860 Standard_EXPORT Standard_Boolean SetControl (const Handle(IFSelect_Selection)& sel, const Handle(IFSelect_Selection)& sc, const Standard_Boolean formain = Standard_True);
861
862 //! Adds an input selection to a SelectCombine (Union or Inters.).
863 //! Returns new count of inputs for this SelectCombine if Done or
864 //! 0 if <sel> is not kind of SelectCombine, or if <seladd> or
865 //! <sel> is not in the WorkSession
866 //! By default, adding is done at the end of the list
867 //! Else, it is an insertion to rank <atnum> (usefull for Un-ReDo)
868 Standard_EXPORT Standard_Integer CombineAdd (const Handle(IFSelect_Selection)& selcomb, const Handle(IFSelect_Selection)& seladd, const Standard_Integer atnum = 0);
869
870 //! Removes an input selection from a SelectCombine (Union or
871 //! Intersection). Returns True if done, False if <selcomb> is not
872 //! kind of SelectCombine or <selrem> is not source of <selcomb>
873 Standard_EXPORT Standard_Boolean CombineRemove (const Handle(IFSelect_Selection)& selcomb, const Handle(IFSelect_Selection)& selrem);
874
875 //! Creates a new Selection, of type SelectPointed, its content
876 //! starts with <list>. A name must be given (can be empty)
877 Standard_EXPORT Handle(IFSelect_Selection) NewSelectPointed (const Handle(TColStd_HSequenceOfTransient)& list, const Standard_CString name);
878
879 //! Changes the content of a Selection of type SelectPointed
880 //! According <mode> : 0 set <list> as new content (clear former)
881 //! 1 : adds <list> to actual content
882 //! -1 : removes <list> from actual content
883 //! Returns True if done, False if <sel> is not a SelectPointed
884 Standard_EXPORT Standard_Boolean SetSelectPointed (const Handle(IFSelect_Selection)& sel, const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Integer mode) const;
885
886 //! Returns a Selection from a Name :
887 //! - the name of a Selection : this Selection
888 //! - the name of a Signature + criteria between (..) : a new
889 //! Selection from this Signature
890 //! - an entity or a list of entities : a new SelectPointed
891 //! Else, returns a Null Handle
892 Standard_EXPORT Handle(IFSelect_Selection) GiveSelection (const Standard_CString selname) const;
893
894 //! Determines a list of entities from an object :
895 //! <obj> already HSequenceOfTransient : returned itself
896 //! <obj> Selection : its Result of Evaluation is returned
897 //! <obj> an entity of the Model : a HSequence which contains it
898 //! else, an empty HSequence
899 //! <obj> the Model it self : ALL its content (not only the roots)
900 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveList (const Handle(Standard_Transient)& obj) const;
901
902 //! Computes a List of entities from two alphanums,
903 //! first and second, as follows :
904 //! if <first> is a Number or Label of an entity : this entity
905 //! if <first> is a list of Numbers/Labels : the list of entities
906 //! if <first> is the name of a Selection in <WS>, and <second>
907 //! not defined, the standard result of this Selection
908 //! else, let's consider "first second" : this whole phrase is
909 //! splitted by blanks, as follows (RECURSIVE CALL) :
910 //! - the leftest term is the final selection
911 //! - the other terms define the result of the selection
912 //! - and so on (the "leftest minus one" is a selection, of which
913 //! the input is given by the remaining ...)
914 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveList (const Standard_CString first, const Standard_CString second = "") const;
915
916 //! Computes a List of entities from the model as follows
917 //! <first> beeing a Selection or a combination of Selections,
918 //! <ent> beeing an entity or a list
919 //! of entities (as a HSequenceOfTransient) :
920 //! the standard result of this selection applied to this list
921 //! if <ent> is Null, the standard definition of the selection is
922 //! used (which contains a default input selection)
923 //! if <selname> is erroneous, a null handle is returned
924 //!
925 //! REMARK : selname is processed as <first second> of preceeding
926 //! GiveList
927 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveListFromList (const Standard_CString selname, const Handle(Standard_Transient)& ent) const;
928
929 //! Combines two lists and returns the result, according to mode :
930 //! <mode> < 0 : entities in <l1> AND NOT in <l2>
931 //! <mode> = 0 : entities in <l1> AND in <l2>
932 //! <mode> > 0 : entities in <l1> OR in <l2>
933 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GiveListCombined (const Handle(TColStd_HSequenceOfTransient)& l1, const Handle(TColStd_HSequenceOfTransient)& l2, const Standard_Integer mode) const;
934
935 //! Loads data from a check iterator to query status on it
936 Standard_EXPORT void QueryCheckList (const Interface_CheckIterator& chl);
937
938 //! Determines check status for an entity regarding last call to
939 //! QueryCheckList :
940 //! -1 : <ent> unknown in the model, ignored
941 //! 0 : no check at all, immediate or inherited thru Graph
942 //! 1 : immediate warning (no fail), no inherited check
943 //! 2 : immediate fail, no inherited check
944 //! +10 : idem but some inherited warning (no fail)
945 //! +20 : idem but some inherited fail
946 Standard_EXPORT Standard_Integer QueryCheckStatus (const Handle(Standard_Transient)& ent) const;
947
948 //! Determines if <entdad> is parent of <entson> (in the graph),
949 //! returns : -1 if no; 0 if <entdad> = <entson>
950 //! 1 if immediate parent, > 1 if parent, gives count of steps
951 Standard_EXPORT Standard_Integer QueryParent (const Handle(Standard_Transient)& entdad, const Handle(Standard_Transient)& entson) const;
952
953 //! Sets a list of Parameters, i.e. TypedValue, to be handled
954 //! through an Editor
955 //! The two lists are parallel, if <params> is longer than <uses>,
956 //! surnumeral parameters are for general use
957 //!
958 //! EditForms are created to handle these parameters (list, edit)
959 //! on the basis of a ParamEditor xst-params-edit
960 //!
961 //! A use number dispatches the parameter to a given EditForm
962 //! EditForms are defined as follows
963 //! Name Use Means
964 //! xst-params all All Parameters (complete list)
965 //! xst-params-general 1 Generals
966 //! xst-params-load 2 LoadFile (no Transfer)
967 //! xst-params-send 3 SendFile (Write, no Transfer)
968 //! xst-params-split 4 Split
969 //! xst-param-read 5 Transfer on Reading
970 //! xst-param-write 6 Transfer on Writing
971 Standard_EXPORT void SetParams (const TColStd_SequenceOfTransient& params, const TColStd_SequenceOfInteger& uselist);
972
973 //! Traces the Statics attached to a given use number
974 //! If <use> is given positive (normal), the trace is embedded
975 //! with a header and a trailer
976 //! If <use> is negative, just values are printed
977 //! (this allows to make compositions)
978 //! Remark : use number 5 commands use -2 to be traced
979 //! Remark : use numbers 4 and 6 command use -3 to be traced
980 Standard_EXPORT void TraceStatics (const Standard_Integer use, const Standard_Integer mode = 0) const;
981
982 //! Dumps contents of the ShareOut (on "cout")
983 Standard_EXPORT void DumpShare() const;
984
985 //! Lists the Labels of all Items of the WorkSession
986 //! If <label> is defined, lists labels which contain it
987 Standard_EXPORT void ListItems (const Standard_CString label = "") const;
988
989 //! Lists the Modifiers of the session (for each one, displays
990 //! its Label). Listing is done following Ranks (Modifiers are
991 //! invoked following their ranks)
992 //! Model Modifiers if <formodel> is True, File Modifiers else
993 Standard_EXPORT void ListFinalModifiers (const Standard_Boolean formodel) const;
994
995 //! Lists a Selection and its Sources (see SelectionIterator),
996 //! given its rank in the list
997 Standard_EXPORT void DumpSelection (const Handle(IFSelect_Selection)& sel) const;
998
999 //! Lists the content of the Input Model (if there is one)
1000 //! According level : 0 -> gives only count of Entities and Roots
1001 //! 1 -> Lists also Roots; 2 -> Lists all Entities (by TraceType)
1002 //! 3 -> Performs a call to CheckList (Fails) and lists the result
1003 //! 4 -> as 3 but all CheckList (Fails + Warnings)
1004 //! 5,6,7 : as 3 but resp. Count,List,Labels by Fail
1005 //! 8,9,10 : as 4 but resp. Count,List,Labels by message
1006 Standard_EXPORT void DumpModel (const Standard_Integer level, const Handle(Message_Messenger)& S);
1007
1008 //! Dumps the current Model (as inherited DumpModel), on currently
1009 //! defined Default Trace File (default is standard output)
1010 Standard_EXPORT void TraceDumpModel (const Standard_Integer mode);
1011
1012 //! Dumps a starting entity according to the current norm.
1013 //! To do this, it calls DumpEntity from WorkLibrary.
1014 //! <level> is to be interpreted for each norm : see specific
1015 //! classes of WorkLibrary for it. Generally, 0 if for very basic
1016 //! (only type ...), greater values give more and more details.
1017 Standard_EXPORT void DumpEntity (const Handle(Standard_Transient)& ent, const Standard_Integer level, const Handle(Message_Messenger)& S) const;
1018
1019 //! Prints main informations about an entity : its number, type,
1020 //! validity (and checks if any), category, shareds and sharings..
1021 //! mutable because it can recompute checks as necessary
1022 Standard_EXPORT void PrintEntityStatus (const Handle(Standard_Transient)& ent, const Handle(Message_Messenger)& S);
1023
1024 //! Dumps an entity from the current Model as inherited DumpEntity
1025 //! on currently defined Default Trace File
1026 //! (<level> interpreted according to the Norm, see WorkLibrary)
1027 Standard_EXPORT void TraceDumpEntity (const Handle(Standard_Transient)& ent, const Standard_Integer level) const;
1028
1029 //! Prints a CheckIterator to the current Trace File, controlled
1030 //! with the current Model
1031 //! complete or fails only, according to <failsonly>
1032 //! <mode> defines the mode of printing
1033 //! 0 : sequential, according entities; else with a CheckCounter
1034 //! 1 : according messages, count of entities
1035 //! 2 : id but with list of entities, designated by their numbers
1036 //! 3 : as 2 but with labels of entities
1037 Standard_EXPORT void PrintCheckList (const Interface_CheckIterator& checklist, const Standard_Boolean failsonly, const IFSelect_PrintCount mode) const;
1038
1039 //! Prints a SignatureList to the current Trace File, controlled
1040 //! with the current Model
1041 //! <mode> defines the mode of printing (see SignatureList)
1042 Standard_EXPORT void PrintSignatureList (const Handle(IFSelect_SignatureList)& signlist, const IFSelect_PrintCount mode) const;
1043
1044 //! Displays the list of Entities selected by a Selection (i.e.
1045 //! the result of EvalSelection).
1046 Standard_EXPORT void EvaluateSelection (const Handle(IFSelect_Selection)& sel) const;
1047
1048 //! Displays the result of applying a Dispatch on the input Model
1049 //! (also shows Remainder if there is)
1050 //! <mode> = 0 (default), displays nothing else
1051 //! <mode> = 1 : displays also duplicated entities (because of
1052 //! this dispatch)
1053 //! <mode> = 2 : displays the entities of the starting Model
1054 //! which are not taken by this dispatch (forgotten entities)
1055 //! <mode> = 3 : displays both duplicated and forgotten entities
1056 //! Remark : EvaluateComplete displays these data evaluated for
1057 //! for all the dispatches, if there are several
1058 Standard_EXPORT void EvaluateDispatch (const Handle(IFSelect_Dispatch)& disp, const Standard_Integer mode = 0) const;
1059
1060 //! Displays the effect of applying the ShareOut on the input
1061 //! Model.
1062 //! <mode> = 0 (default) : displays only roots for each packet,
1063 //! <mode> = 1 : displays all entities for each packet, plus
1064 //! duplicated entities
1065 //! <mode> = 2 : same as <mode> = 1, plus displays forgotten
1066 //! entities (which are in no packet at all)
1067 Standard_EXPORT void EvaluateComplete (const Standard_Integer mode = 0) const;
1068
1069 //! Internal method which displays an EntityIterator
1070 //! <mode> 0 gives short display (only entity numbers)
1071 //! 1 gives a more complete trace (1 line per Entity)
1072 //! (can be used each time a trace has to be output from a list)
1073 //! 2 gives a form suitable for givelist : (n1,n2,n3...)
1074 Standard_EXPORT void ListEntities (const Interface_EntityIterator& iter, const Standard_Integer mode) const;
1075
1076
1077
1078
92efcf78 1079 DEFINE_STANDARD_RTTIEXT(IFSelect_WorkSession,MMgt_TShared)
42cf5bc1 1080
1081protected:
1082
1083
1084 Handle(Interface_HGraph) thegraph;
1085 Interface_CheckIterator thecheckrun;
1086 TColStd_IndexedDataMapOfTransientTransient theitems;
1087 Handle(Dico_DictionaryOfTransient) thenames;
1088
1089
1090private:
1091
1092
1093 Standard_Boolean theerrhand;
1094 Handle(IFSelect_ShareOut) theshareout;
1095 Handle(IFSelect_WorkLibrary) thelibrary;
1096 Handle(Interface_Protocol) theprotocol;
1097 Handle(Interface_InterfaceModel) themodel;
1098 TCollection_AsciiString theloaded;
1099 Handle(Interface_GTool) thegtool;
1100 Standard_Boolean thecheckdone;
1101 Interface_CheckIterator thechecklist;
1102 TCollection_AsciiString thecheckana;
1103 Handle(IFSelect_ModelCopier) thecopier;
1104 Handle(Interface_InterfaceModel) theoldel;
1105 Standard_Boolean themodelstat;
1106
1107
1108};
1109
1110
1111
1112
1113
1114
1115
1116#endif // _IFSelect_WorkSession_HeaderFile