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