Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-03 09:16:22

0001 // Created on: 1992-12-15
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IFSelect_WorkSession_HeaderFile
0018 #define _IFSelect_WorkSession_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TCollection_AsciiString.hxx>
0024 #include <Interface_CheckIterator.hxx>
0025 #include <Standard_Transient.hxx>
0026 #include <NCollection_IndexedDataMap.hxx>
0027 #include <NCollection_DynamicArray.hxx>
0028 #include <NCollection_DataMap.hxx>
0029 #include <Standard_CString.hxx>
0030 #include <IFSelect_ReturnStatus.hxx>
0031 #include <Standard_Integer.hxx>
0032 #include <NCollection_Sequence.hxx>
0033 #include <NCollection_HSequence.hxx>
0034 #include <TCollection_HAsciiString.hxx>
0035 #include <IFSelect_RemainMode.hxx>
0036 #include <IFSelect_PrintCount.hxx>
0037 class IFSelect_ShareOut;
0038 class IFSelect_WorkLibrary;
0039 class Interface_Protocol;
0040 class Interface_InterfaceModel;
0041 class Interface_HGraph;
0042 class Interface_GTool;
0043 
0044 class IFSelect_ModelCopier;
0045 class IFSelect_Signature;
0046 class TCollection_HAsciiString;
0047 class Interface_Graph;
0048 class IFSelect_IntParam;
0049 class IFSelect_Selection;
0050 class Interface_EntityIterator;
0051 class IFSelect_SelectionIterator;
0052 class IFSelect_SignCounter;
0053 class IFSelect_Dispatch;
0054 class IFSelect_GeneralModifier;
0055 class IFSelect_Modifier;
0056 class IFSelect_Transformer;
0057 class IFSelect_PacketList;
0058 class IFSelect_SignatureList;
0059 
0060 //! This class can be used to simply manage a process such as
0061 //! splitting a file, extracting a set of Entities ...
0062 //! It allows to manage different types of Variables : Integer or
0063 //! Text Parameters, Selections, Dispatches, in addition to a
0064 //! ShareOut. To each of these variables, a unique Integer
0065 //! Identifier is attached. A Name can be attached too as desired.
0066 class IFSelect_WorkSession : public Standard_Transient
0067 {
0068 
0069 public:
0070   //! Creates a Work Session
0071   //! It provides default, empty ShareOut and ModelCopier, which can
0072   //! be replaced (if required, should be done just after creation).
0073   Standard_EXPORT IFSelect_WorkSession();
0074 
0075   //! Changes the Error Handler status (by default, it is not set)
0076   Standard_EXPORT void SetErrorHandle(const bool toHandle);
0077 
0078   //! Returns the Error Handler status
0079   bool ErrorHandle() const { return theerrhand; }
0080 
0081   //! Returns the ShareOut defined at creation time
0082   const occ::handle<IFSelect_ShareOut>& ShareOut() const { return theshareout; }
0083 
0084   //! Sets a new ShareOut. Fills Items which its content
0085   //! Warning : data from the former ShareOut are lost
0086   Standard_EXPORT void SetShareOut(const occ::handle<IFSelect_ShareOut>& shareout);
0087 
0088   //! Set value of mode responsible for presence of selections after loading
0089   //! If mode set to true that different selections will be accessible after loading
0090   //! else selections will be not accessible after loading( for economy memory in applications)
0091   void SetModeStat(const bool theMode) { themodelstat = theMode; }
0092 
0093   //! Return value of mode defining of filling selection during loading
0094   bool GetModeStat() const { return themodelstat; }
0095 
0096   //! Sets a WorkLibrary, which will be used to Read and Write Files
0097   void SetLibrary(const occ::handle<IFSelect_WorkLibrary>& theLib) { thelibrary = theLib; }
0098 
0099   //! Returns the WorkLibrary. Null Handle if not yet set
0100   //! should be C++ : return const &
0101   const occ::handle<IFSelect_WorkLibrary>& WorkLibrary() const { return thelibrary; }
0102 
0103   //! Sets a Protocol, which will be used to determine Graphs, to
0104   //! Read and to Write Files
0105   Standard_EXPORT void SetProtocol(const occ::handle<Interface_Protocol>& protocol);
0106 
0107   //! Returns the Protocol. Null Handle if not yet set
0108   //! should be C++ : return const &
0109   const occ::handle<Interface_Protocol>& Protocol() const { return theprotocol; }
0110 
0111   //! Sets a specific Signature to be the SignType, i.e. the
0112   //! Signature which will determine TypeName from the Model
0113   //! (basic function). It is recorded in the GTool
0114   //! This Signature is also set as "xst-sign-type" (reserved name)
0115   Standard_EXPORT void SetSignType(const occ::handle<IFSelect_Signature>& signtype);
0116 
0117   //! Returns the current SignType
0118   Standard_EXPORT occ::handle<IFSelect_Signature> SignType() const;
0119 
0120   //! Returns True is a Model has been set
0121   bool HasModel() const { return (!myModel.IsNull()); }
0122 
0123   //! Sets a Model as input : this will be the Model from which the
0124   //! ShareOut will work
0125   //! if <clearpointed> is True (default) all SelectPointed items
0126   //! are cleared, else they must be managed by the caller
0127   //! Remark : SetModel clears the Graph, recomputes it if a
0128   //! Protocol is set and if the Model is not empty, of course
0129   Standard_EXPORT void SetModel(const occ::handle<Interface_InterfaceModel>& model,
0130                                 const bool                                   clearpointed = true);
0131 
0132   //! Returns the Model of the Work Session (Null Handle if none)
0133   //! should be C++ : return const &
0134   const occ::handle<Interface_InterfaceModel>& Model() const { return myModel; }
0135 
0136   //! Stores the filename used for read for setting the model
0137   //! It is cleared by SetModel and ClearData(1)
0138   void SetLoadedFile(const char* const theFileName) { theloaded = theFileName; }
0139 
0140   //! Returns the filename used to load current model
0141   //! empty if unknown
0142   const char* LoadedFile() const { return theloaded.ToCString(); }
0143 
0144   //! Reads a file with the WorkLibrary (sets Model and LoadedFile)
0145   //! Returns a integer status which can be :
0146   //! RetDone if OK, RetVoid if no Protocol not defined,
0147   //! RetError for file not found, RetFail if fail during read
0148   Standard_EXPORT IFSelect_ReturnStatus ReadFile(const char* const filename);
0149 
0150   //! Reads a file from stream with the WorkLibrary (sets Model and LoadedFile)
0151   //! Returns a integer status which can be :
0152   //! RetDone if OK, RetVoid if no Protocol not defined,
0153   //! RetError for file not found, RetFail if fail during read
0154   Standard_EXPORT IFSelect_ReturnStatus ReadStream(const char* const theName,
0155                                                    std::istream&     theIStream);
0156 
0157   //! Returns the count of Entities stored in the Model, or 0
0158   Standard_EXPORT int NbStartingEntities() const;
0159 
0160   //! Returns an Entity stored in the Model of the WorkSession
0161   //! (Null Handle is no Model or num out of range)
0162   Standard_EXPORT occ::handle<Standard_Transient> StartingEntity(const int num) const;
0163 
0164   //! Returns the Number of an Entity in the Model
0165   //! (0 if no Model set or <ent> not in the Model)
0166   Standard_EXPORT int StartingNumber(const occ::handle<Standard_Transient>& ent) const;
0167 
0168   //! From a given label in Model, returns the corresponding number
0169   //! Starts from first entity by Default, may start after a given
0170   //! number : this number may be given negative, its absolute value
0171   //! is then considered. Hence a loop on NumberFromLabel may be
0172   //! programmed (stop test is : returned value positive or null)
0173   //!
0174   //! Returns 0 if not found, < 0 if more than one found (first
0175   //! found in negative).
0176   //! If <val> just gives an integer value, returns it
0177   Standard_EXPORT int NumberFromLabel(const char* const val, const int afternum = 0) const;
0178 
0179   //! Returns the label for <ent>, as the Model does
0180   //! If <ent> is not in the Model or if no Model is loaded, a Null
0181   //! Handle is returned
0182   Standard_EXPORT occ::handle<TCollection_HAsciiString> EntityLabel(
0183     const occ::handle<Standard_Transient>& ent) const;
0184 
0185   //! Returns the Name of an Entity
0186   //! This Name is computed by the general service Name
0187   //! Returns a Null Handle if fails
0188   Standard_EXPORT occ::handle<TCollection_HAsciiString> EntityName(
0189     const occ::handle<Standard_Transient>& ent) const;
0190 
0191   //! Returns the Category Number determined for an entity
0192   //! it is computed by the class Category
0193   //! An unknown entity (number 0) gives a value -1
0194   Standard_EXPORT int CategoryNumber(const occ::handle<Standard_Transient>& ent) const;
0195 
0196   //! Returns the Category Name determined for an entity
0197   //! it is computed by the class Category
0198   //! Remark : an unknown entity gives an empty string
0199   Standard_EXPORT const char* CategoryName(const occ::handle<Standard_Transient>& ent) const;
0200 
0201   //! Returns the Validity Name determined for an entity
0202   //! it is computed by the class SignValidity
0203   //! Remark : an unknown entity gives an empty string
0204   Standard_EXPORT const char* ValidityName(const occ::handle<Standard_Transient>& ent) const;
0205 
0206   //! Clears recorded data (not the items) according mode :
0207   //! 1 : all Data : Model, Graph, CheckList, + ClearData 4
0208   //! 2 : Graph and CheckList (they will then be recomputed later)
0209   //! 3 : CheckList (it will be recomputed by ComputeCheck)
0210   //! 4 : just content of SelectPointed and Counters
0211   //! Plus 0 : does nothing but called by SetModel
0212   //! ClearData is virtual, hence it can be redefined to clear
0213   //! other data of a specialised Work Session
0214   Standard_EXPORT virtual void ClearData(const int mode);
0215 
0216   //! Computes the Graph used for Selections, Displays ...
0217   //! If a HGraph is already set, with same model as given by method
0218   //! Model, does nothing. Else, computes a new Graph.
0219   //! If <enforce> is given True, computes a new Graph anyway.
0220   //! Remark that a call to ClearGraph will cause ComputeGraph to
0221   //! really compute a new Graph
0222   //! Returns True if Graph is OK, False else (i.e. if no Protocol
0223   //! is set, or if Model is absent or empty).
0224   Standard_EXPORT bool ComputeGraph(const bool enforce = false);
0225 
0226   //! Returns the Computed Graph as HGraph (Null Handle if not set)
0227   Standard_EXPORT occ::handle<Interface_HGraph> HGraph();
0228 
0229   //! Returns the Computed Graph, for Read only
0230   Standard_EXPORT const Interface_Graph& Graph();
0231 
0232   //! Returns the list of entities shared by <ent> (can be empty)
0233   //! Returns a null Handle if <ent> is unknown
0234   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>> Shareds(
0235     const occ::handle<Standard_Transient>& ent);
0236 
0237   //! Returns the list of entities sharing <ent> (can be empty)
0238   //! Returns a null Handle if <ent> is unknown
0239   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>> Sharings(
0240     const occ::handle<Standard_Transient>& ent);
0241 
0242   //! Returns True if a Model is defined and really loaded (not
0243   //! empty), a Protocol is set and a Graph has been computed.
0244   //! In this case, the WorkSession can start to work
0245   Standard_EXPORT bool IsLoaded() const;
0246 
0247   //! Computes the CheckList for the Model currently loaded
0248   //! It can then be used for displays, queries ...
0249   //! Returns True if OK, False else (i.e. no Protocol set, or Model
0250   //! absent). If <enforce> is False, works only if not already done
0251   //! or if a new Model has been loaded from last call.
0252   //! Remark : computation is enforced by every call to
0253   //! SetModel or RunTransformer
0254   Standard_EXPORT bool ComputeCheck(const bool enforce = false);
0255 
0256   //! Returns the Check List for the Model currently loaded :
0257   //! <complete> = True  : complete (syntactic & semantic messages),
0258   //! computed if not yet done
0259   //! <complete> = False : only syntactic (check file form)
0260   Standard_EXPORT Interface_CheckIterator ModelCheckList(const bool complete = true);
0261 
0262   //! Returns a Check for a single entity, under the form of a
0263   //! CheckIterator (this gives only one form for the user)
0264   //! if <ent> is Null or equates the current Model, it gives the
0265   //! Global Check, else the Check for the given entity
0266   //! <complete> as for ModelCheckList
0267   Standard_EXPORT Interface_CheckIterator CheckOne(const occ::handle<Standard_Transient>& ent,
0268                                                    const bool complete = true);
0269 
0270   //! Returns the Check List produced by the last execution of
0271   //! either : EvaluateFile(for Split), SendSplit, SendAll,
0272   //! SendSelected, RunTransformer-RunModifier
0273   //! Cleared by SetModel or ClearData(1)
0274   //! The field is protected, hence a specialized WorkSession may
0275   //! fill it
0276   Interface_CheckIterator LastRunCheckList() const { return thecheckrun; }
0277 
0278   //! Returns the Maximum Value for an Item Identifier. It can be
0279   //! greater to the count of known Items, because some can have
0280   //! been removed
0281   Standard_EXPORT int MaxIdent() const;
0282 
0283   //! Returns an Item, given its Ident. Returns a Null Handle if
0284   //! no Item corresponds to this Ident.
0285   Standard_EXPORT occ::handle<Standard_Transient> Item(const int id) const;
0286 
0287   //! Returns the Ident attached to an Item in the WorkSession, or
0288   //! Zero if it is unknown
0289   Standard_EXPORT int ItemIdent(const occ::handle<Standard_Transient>& item) const;
0290 
0291   //! Returns the Item which corresponds to a Variable, given its
0292   //! Name (whatever the type of this Item).
0293   //! Returns a Null Handle if this Name is not recorded
0294   Standard_EXPORT occ::handle<Standard_Transient> NamedItem(const char* const name) const;
0295 
0296   //! Same as above, but <name> is given through a Handle
0297   //! Especially useful with methods SelectionNames, etc...
0298   Standard_EXPORT occ::handle<Standard_Transient> NamedItem(
0299     const occ::handle<TCollection_HAsciiString>& name) const;
0300 
0301   //! Returns the Ident attached to a Name, 0 if name not recorded
0302   Standard_EXPORT int NameIdent(const char* const name) const;
0303 
0304   //! Returns True if an Item of the WorkSession has an attached Name
0305   Standard_EXPORT bool HasName(const occ::handle<Standard_Transient>& item) const;
0306 
0307   //! Returns the Name attached to an Item as a Variable of this
0308   //! WorkSession. If <item> is Null or not recorded, returns an
0309   //! empty string.
0310   Standard_EXPORT occ::handle<TCollection_HAsciiString> Name(
0311     const occ::handle<Standard_Transient>& item) const;
0312 
0313   //! Adds an Item and returns its attached Ident. Does nothing
0314   //! if <item> is already recorded (and returns its attached Ident)
0315   //! <active> if True commands call to SetActive (see below)
0316   //! Remark : the determined Ident is used if <item> is a Dispatch,
0317   //! to fill the ShareOut
0318   Standard_EXPORT int AddItem(const occ::handle<Standard_Transient>& item,
0319                               const bool                             active = true);
0320 
0321   //! Adds an Item with an attached Name. If the Name is already
0322   //! known in the WorkSession, the older item losts it
0323   //! Returns Ident if Done, 0 else, i.e. if <item> is null
0324   //! If <name> is empty, works as AddItem (i.e. with no name)
0325   //! If <item> is already known but with no attached Name, this
0326   //! method tries to attached a Name to it
0327   //! <active> if True commands call to SetActive (see below)
0328   Standard_EXPORT int AddNamedItem(const char* const                      name,
0329                                    const occ::handle<Standard_Transient>& item,
0330                                    const bool                             active = true);
0331 
0332   //! Following the type of <item> :
0333   //! - Dispatch : Adds or Removes it in the ShareOut & FileNaming
0334   //! - GeneralModifier : Adds or Removes it for final sending
0335   //! (i.e. in the ModelCopier)
0336   //! Returns True if it did something, False else (state unchanged)
0337   Standard_EXPORT bool SetActive(const occ::handle<Standard_Transient>& item, const bool mode);
0338 
0339   //! Removes an Item from the Session, given its Name
0340   //! Returns True if Done, False else (Name not recorded)
0341   //! (Applies only on Item which are Named)
0342   Standard_EXPORT bool RemoveNamedItem(const char* const name);
0343 
0344   //! Removes a Name without removing the Item
0345   //! Returns True if Done, False else (Name not recorded)
0346   Standard_EXPORT bool RemoveName(const char* const name);
0347 
0348   //! Removes an Item given its Ident. Returns False if <id> is
0349   //! attached to no Item in the WorkSession. For a Named Item,
0350   //! also removes its Name.
0351   Standard_EXPORT bool RemoveItem(const occ::handle<Standard_Transient>& item);
0352 
0353   //! Clears all the recorded Items : Selections, Dispatches,
0354   //! Modifiers, and Strings & IntParams, with their Idents & Names.
0355   //! Remark that if a Model has been loaded, it is not cleared.
0356   Standard_EXPORT void ClearItems();
0357 
0358   //! Returns a Label which illustrates the content of an Item,
0359   //! given its Ident. This Label is :
0360   //! - for a Text Parameter, "Text:<text value>"
0361   //! - for an Integer Parameter, "Integer:<integer value>"
0362   //! - for a Selection, a Dispatch or a Modifier, its Label
0363   //! (see these classes)
0364   //! - for any other kind of Variable, its cdl type
0365   Standard_EXPORT occ::handle<TCollection_HAsciiString> ItemLabel(const int id) const;
0366 
0367   //! Fills a Sequence with the List of Idents attached to the Items
0368   //! of which Type complies with (IsKind) <type> (alphabetic order)
0369   //! Remark : <type> = TYPE(Standard_Transient) gives all the
0370   //! Idents which are suitable in the WorkSession
0371   Standard_EXPORT occ::handle<NCollection_HSequence<int>> ItemIdents(
0372     const occ::handle<Standard_Type>& type) const;
0373 
0374   //! Fills a Sequence with the list of the Names attached to Items
0375   //! of which Type complies with (IsKind) <type> (alphabetic order)
0376   //! Remark : <type> = TYPE(Standard_Transient) gives all the Names
0377   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<TCollection_HAsciiString>>>
0378                   ItemNames(const occ::handle<Standard_Type>& type) const;
0379 
0380   //! Fills a Sequence with the NAMES of the control items, of which
0381   //! the label matches <label> (contain it) : see NextIdentForLabel
0382   //! Search mode is fixed to "contained"
0383   //! If <label> is empty, returns all Names
0384   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<TCollection_HAsciiString>>>
0385                   ItemNamesForLabel(const char* const label) const;
0386 
0387   //! For query by Label with possible iterations
0388   //! Searches the Ident of which Item has a Label which matches a
0389   //! given one, the search starts from an initial Ident.
0390   //! Returns the first found Ident which follows <id>, or ZERO
0391   //!
0392   //! The search must start with <id> = 0, it returns the next Ident
0393   //! which matches. To iterate, call again this method which this
0394   //! returned value as <id>. Once an Ident has been returned, the
0395   //! Item can be obtained by the method Item
0396   //!
0397   //! <mode> precises the required matching mode :
0398   //! - 0 (Default) : <label> must match exactly with the Item Label
0399   //! - 1 : <label> must match the exact beginning (the end is free)
0400   //! - 2 : <label> must be at least once wherever in the Item Label
0401   //! - other values are ignored
0402   Standard_EXPORT int NextIdentForLabel(const char* const label,
0403                                         const int         id,
0404                                         const int         mode = 0) const;
0405 
0406   //! Creates a parameter as being bound to a Static
0407   //! If the Static is Integer, this creates an IntParam bound to
0408   //! it by its name. Else this creates a String which is the value
0409   //! of the Static.
0410   //! Returns a null handle if <statname> is unknown as a Static
0411   Standard_EXPORT occ::handle<Standard_Transient> NewParamFromStatic(const char* const statname,
0412                                                                      const char* const name = "");
0413 
0414   //! Returns an IntParam, given its Ident in the Session
0415   //! Null result if <id> is not suitable for an IntParam
0416   //! (undefined, or defined for another kind of variable)
0417   Standard_EXPORT occ::handle<IFSelect_IntParam> IntParam(const int id) const;
0418 
0419   //! Returns Integer Value of an IntParam
0420   Standard_EXPORT int IntValue(const occ::handle<IFSelect_IntParam>& it) const;
0421 
0422   //! Creates a new IntParam. A Name can be set (Optional)
0423   //! Returns the created IntParam, or a Null Handle in case of
0424   //! Failure (see AddItem/AddNamedItem)
0425   Standard_EXPORT occ::handle<IFSelect_IntParam> NewIntParam(const char* const name = "");
0426 
0427   //! Changes the Integer Value of an IntParam
0428   //! Returns True if Done, False if <it> is not in the WorkSession
0429   Standard_EXPORT bool SetIntValue(const occ::handle<IFSelect_IntParam>& it, const int val);
0430 
0431   //! Returns a TextParam, given its Ident in the Session
0432   //! Null result if <id> is not suitable for a TextParam
0433   //! (undefined, or defined for another kind of variable)
0434   Standard_EXPORT occ::handle<TCollection_HAsciiString> TextParam(const int id) const;
0435 
0436   //! Returns Text Value of a TextParam (a String)
0437   //! or an empty string if <it> is not in the WorkSession
0438   Standard_EXPORT TCollection_AsciiString
0439     TextValue(const occ::handle<TCollection_HAsciiString>& par) const;
0440 
0441   //! Creates a new (empty) TextParam. A Name can be set (Optional)
0442   //! Returns the created TextParam (as an HAsciiString), or a Null
0443   //! Handle in case of Failure (see AddItem/AddNamedItem)
0444   Standard_EXPORT occ::handle<TCollection_HAsciiString> NewTextParam(const char* const name = "");
0445 
0446   //! Changes the Text Value of a TextParam (an HAsciiString)
0447   //! Returns True if Done, False if <it> is not in the WorkSession
0448   Standard_EXPORT bool SetTextValue(const occ::handle<TCollection_HAsciiString>& par,
0449                                     const char* const                            val);
0450 
0451   //! Returns a Signature, given its Ident in the Session
0452   //! Null result if <id> is not suitable for a Signature
0453   //! (undefined, or defined for another kind of variable)
0454   Standard_EXPORT occ::handle<IFSelect_Signature> Signature(const int id) const;
0455 
0456   //! Returns the Value computed by a Signature for an Entity
0457   //! Returns an empty string if the entity does not belong to the
0458   //! loaded model
0459   Standard_EXPORT const char* SignValue(const occ::handle<IFSelect_Signature>& sign,
0460                                         const occ::handle<Standard_Transient>& ent) const;
0461 
0462   //! Returns a Selection, given its Ident in the Session
0463   //! Null result if <id> is not suitable for a Selection
0464   //! (undefined, or defined for another kind of variable)
0465   Standard_EXPORT occ::handle<IFSelect_Selection> Selection(const int id) const;
0466 
0467   //! Evaluates the effect of a Selection applied on the input Model
0468   //! Returned Result remains empty if no input Model has been set
0469   Standard_EXPORT Interface_EntityIterator
0470     EvalSelection(const occ::handle<IFSelect_Selection>& sel) const;
0471 
0472   //! Returns the Selections which are source of Selection, given
0473   //! its rank in the List of Selections (see SelectionIterator)
0474   //! Returned value is empty if <num> is out of range or if
0475   //! <sel> is not in the WorkSession
0476   Standard_EXPORT IFSelect_SelectionIterator
0477     Sources(const occ::handle<IFSelect_Selection>& sel) const;
0478 
0479   //! Returns the result of a Selection, computed by EvalSelection
0480   //! (see above) under the form of a HSequence (hence, it can be
0481   //! used by a frontal-engine logic). It can be empty
0482   //! Returns a Null Handle if <sel> is not in the WorkSession
0483   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>
0484                   SelectionResult(const occ::handle<IFSelect_Selection>& sel) const;
0485 
0486   //! Returns the result of a Selection, by forcing its input with
0487   //! a given list <list> (unless <list> is Null).
0488   //! RULES :
0489   //! <list> applies only for a SelectDeduct kind Selection :
0490   //! its Input is considered : if it is a SelectDeduct kind
0491   //! Selection, its Input is considered, etc... until an Input
0492   //! is not a Deduct/Extract : its result is replaced by <list>
0493   //! and all the chain of deductions is applied
0494   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>
0495                   SelectionResultFromList(
0496                     const occ::handle<IFSelect_Selection>&                                     sel,
0497                     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list) const;
0498 
0499   //! Sets a Selection as input for an item, according its type :
0500   //! if <item> is a Dispatch : as Final Selection
0501   //! if <item> is a GeneralModifier (i.e. any kind of Modifier) :
0502   //! as Selection used to filter entities to modify
0503   //! <sel> Null causes this Selection to be nullified
0504   //! Returns False if <item> is not of a suitable type, or
0505   //! <item> or <sel> is not in the WorkSession
0506   Standard_EXPORT bool SetItemSelection(const occ::handle<Standard_Transient>& item,
0507                                         const occ::handle<IFSelect_Selection>& sel);
0508 
0509   //! Resets input Selection which was set by SetItemSelection
0510   //! Same conditions as for SetItemSelection
0511   //! Returns True if done, False if <item> is not in the WorkSession
0512   Standard_EXPORT bool ResetItemSelection(const occ::handle<Standard_Transient>& item);
0513 
0514   //! Returns the Selection of a Dispatch or a GeneralModifier.
0515   //! Returns a Null Handle if none is defined or <item> not good type
0516   Standard_EXPORT occ::handle<IFSelect_Selection> ItemSelection(
0517     const occ::handle<Standard_Transient>& item) const;
0518 
0519   //! Returns a SignCounter from its ident in the Session
0520   //! Null result if <id> is not suitable for a SignCounter
0521   //! (undefined, or defined for another kind of variable)
0522   Standard_EXPORT occ::handle<IFSelect_SignCounter> SignCounter(const int id) const;
0523 
0524   //! Computes the content of a SignCounter when it is defined with
0525   //! a Selection, then returns True
0526   //! Returns False if the SignCounter is not defined with a
0527   //! Selection, or if its Selection Mode is inhibited
0528   //! <forced> to work around optimisations
0529   Standard_EXPORT bool ComputeCounter(const occ::handle<IFSelect_SignCounter>& counter,
0530                                       const bool                               forced = false);
0531 
0532   //! Computes the content of a SignCounter from an input list
0533   //! If <list> is Null, uses internal definition of the Counter :
0534   //! a Selection, else the whole Model (recomputation forced)
0535   //! If <clear> is True (D), starts from scratch
0536   //! Else, cumulates computations
0537   Standard_EXPORT bool ComputeCounterFromList(
0538     const occ::handle<IFSelect_SignCounter>&                                   counter,
0539     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list,
0540     const bool                                                                 clear = true);
0541 
0542   //! Returns the ordered list of dispatches stored by the ShareOut
0543   Standard_EXPORT occ::handle<NCollection_HSequence<int>> AppliedDispatches() const;
0544 
0545   //! Clears the list of Dispatches recorded by the ShareOut
0546   //! if <only> disp is True, tha's all. Else, clears also the lists
0547   //! of Modifiers recorded by the ShareOut
0548   Standard_EXPORT void ClearShareOut(const bool onlydisp);
0549 
0550   //! Returns a Dispatch, given its Ident in the Session
0551   //! Null result if <id> is not suitable for a Dispatch
0552   //! (undefined, or defined for another kind of variable)
0553   Standard_EXPORT occ::handle<IFSelect_Dispatch> Dispatch(const int id) const;
0554 
0555   //! Returns the rank of a Dispatch in the ShareOut, or 0 if <disp>
0556   //! is not in the ShareOut or not in the WorkSession
0557   Standard_EXPORT int DispatchRank(const occ::handle<IFSelect_Dispatch>& disp) const;
0558 
0559   //! Gives access to the complete ModelCopier
0560   const occ::handle<IFSelect_ModelCopier>& ModelCopier() const { return thecopier; }
0561 
0562   //! Sets a new ModelCopier. Fills Items which its content
0563   Standard_EXPORT void SetModelCopier(const occ::handle<IFSelect_ModelCopier>& copier);
0564 
0565   //! Returns the count of Modifiers applied to final sending
0566   //! Model Modifiers if <formodel> is True, File Modifiers else
0567   //! (i.e. Modifiers which apply once the Models have been filled)
0568   Standard_EXPORT int NbFinalModifiers(const bool formodel) const;
0569 
0570   //! Fills a Sequence with a list of Idents, those attached to
0571   //! the Modifiers applied to final sending.
0572   //! Model Modifiers if <formodel> is True, File Modifiers else
0573   //! This list is given in the order in which they will be applied
0574   //! (which takes into account the Changes to Modifier Ranks)
0575   Standard_EXPORT occ::handle<NCollection_HSequence<int>> FinalModifierIdents(
0576     const bool formodel) const;
0577 
0578   //! Returns a Modifier, given its Ident in the Session
0579   //! Null result if <id> is not suitable for a Modifier
0580   //! (undefined, or defined for another kind of variable)
0581   Standard_EXPORT occ::handle<IFSelect_GeneralModifier> GeneralModifier(const int id) const;
0582 
0583   //! Returns a Model Modifier, given its Ident in the Session,
0584   //! i.e. typed as a Modifier (not simply a GeneralModifier)
0585   //! Null result if <id> is not suitable for a Modifier
0586   //! (undefined, or defined for another kind of variable)
0587   Standard_EXPORT occ::handle<IFSelect_Modifier> ModelModifier(const int id) const;
0588 
0589   //! Returns the Rank of a Modifier given its Ident. Model or File
0590   //! Modifier according its type (ModelModifier or not)
0591   //! Remember that Modifiers are applied sequentially following
0592   //! their Rank : first Model Modifiers then File Modifiers
0593   //! Rank is given by rank of call to AddItem and can be
0594   //! changed by ChangeModifierRank
0595   Standard_EXPORT int ModifierRank(const occ::handle<IFSelect_GeneralModifier>& item) const;
0596 
0597   //! Changes the Rank of a Modifier in the Session :
0598   //! Model Modifiers if <formodel> is True, File Modifiers else
0599   //! the Modifier n0 <before> is put to n0 <after>
0600   //! Return True if Done, False if <before> or <after> out of range
0601   Standard_EXPORT bool ChangeModifierRank(const bool formodel, const int before, const int after);
0602 
0603   //! Removes all the Modifiers active in the ModelCopier : they
0604   //! become inactive and they are removed from the Session
0605   Standard_EXPORT void ClearFinalModifiers();
0606 
0607   //! Sets a GeneralModifier to be applied to an item :
0608   //! - item = ShareOut : applies for final sending (all dispatches)
0609   //! - item is a Dispatch : applies for this dispatch only
0610   //! Returns True if done, False if <modif> or <item> not in <me>
0611   Standard_EXPORT bool SetAppliedModifier(const occ::handle<IFSelect_GeneralModifier>& modif,
0612                                           const occ::handle<Standard_Transient>&       item);
0613 
0614   //! Resets a GeneralModifier to be applied
0615   //! Returns True if done, False if <modif> was not applied
0616   Standard_EXPORT bool ResetAppliedModifier(const occ::handle<IFSelect_GeneralModifier>& modif);
0617 
0618   //! Returns the item on which a GeneralModifier is applied :
0619   //! the ShareOut, or a given Dispatch
0620   //! Returns a Null Handle if <modif> is not applied
0621   Standard_EXPORT occ::handle<Standard_Transient> UsesAppliedModifier(
0622     const occ::handle<IFSelect_GeneralModifier>& modif) const;
0623 
0624   //! Returns a Transformer, given its Ident in the Session
0625   //! Null result if <id> is not suitable for a Transformer
0626   //! (undefined, or defined for another kind of variable)
0627   Standard_EXPORT occ::handle<IFSelect_Transformer> Transformer(const int id) const;
0628 
0629   //! Runs a Transformer on starting Model, which can then be edited
0630   //! or replaced by a new one. The Protocol can also be changed.
0631   //! Fills LastRunCheckList
0632   //!
0633   //! Returned status is 0 if nothing done (<transf> or model
0634   //! undefined), positive if OK, negative else :
0635   //! 0  : Nothing done
0636   //! 1  : OK, edition on the spot with no change to the graph
0637   //! of dependencies (purely local)
0638   //! 2  : OK, model edited on the spot (graph recomputed, may
0639   //! have changed), protocol unchanged
0640   //! 3  : OK, new model produced, same protocol
0641   //! 4  : OK, model edited on the spot (graph recomputed),
0642   //! but protocol has changed
0643   //! 5  : OK, new model produced, protocol has changed
0644   //! -1 : Error on the spot (slight changes), data may be corrupted
0645   //! (remark : corruption should not be profound)
0646   //! -2 : Error on edition the spot, data may be corrupted
0647   //! (checking them is recommended)
0648   //! -3 : Error with a new data set, transformation ignored
0649   //! -4 : OK as 4, but graph of dependences count not be recomputed
0650   //! (the former one is kept) : check the protocol
0651   Standard_EXPORT int RunTransformer(const occ::handle<IFSelect_Transformer>& transf);
0652 
0653   //! Runs a Modifier on Starting Model. It can modify entities, or
0654   //! add new ones. But the Model or the Protocol is unchanged.
0655   //! The Modifier is applied on each entity of the Model. See also
0656   //! RunModifierSelected
0657   //! Fills LastRunCheckList
0658   //!
0659   //! <copy> : if True, a new data set is produced which brings
0660   //! the modifications (Model + its Entities)
0661   //! if False, data are modified on the spot
0662   //!
0663   //! It works through a TransformStandard defined with <modif>
0664   //! Returned status as RunTransformer : 0 nothing done, >0 OK,
0665   //! <0 problem, but only between -3 and 3 (protocol unchanged)
0666   //! Remark : <copy> True will give <effect> = 3 or -3
0667   Standard_EXPORT int RunModifier(const occ::handle<IFSelect_Modifier>& modif, const bool copy);
0668 
0669   //! Acts as RunModifier, but the Modifier is applied on the list
0670   //! determined by a Selection, rather than on the whole Model
0671   //! If the selection is a null handle, the whole model is taken
0672   Standard_EXPORT int RunModifierSelected(const occ::handle<IFSelect_Modifier>&  modif,
0673                                           const occ::handle<IFSelect_Selection>& sel,
0674                                           const bool                             copy);
0675 
0676   //! Creates and returns a TransformStandard, empty, with its
0677   //! Copy Option (True = Copy, False = On the Spot) and an
0678   //! optional name.
0679   //! To a TransformStandard, the method SetAppliedModifier applies
0680   Standard_EXPORT occ::handle<IFSelect_Transformer> NewTransformStandard(
0681     const bool        copy,
0682     const char* const name = "");
0683 
0684   //! Defines a new content from the former one
0685   //! If <keep> is True, it is given by entities selected by
0686   //! Selection <sel> (and all shared entities)
0687   //! Else, it is given by all the former content but entities
0688   //! selected by the Selection <sel> (and properly shared ones)
0689   //! Returns True if done. Returns False if the selected list
0690   //! (from <sel>) is empty, hence nothing is done
0691   Standard_EXPORT bool SetModelContent(const occ::handle<IFSelect_Selection>& sel, const bool keep);
0692 
0693   //! Returns the defined File Prefix. Null Handle if not defined
0694   Standard_EXPORT occ::handle<TCollection_HAsciiString> FilePrefix() const;
0695 
0696   //! Returns the defined Default File Root. It is used for
0697   //! Dispatches which have no specific root attached.
0698   //! Null Handle if not defined
0699   Standard_EXPORT occ::handle<TCollection_HAsciiString> DefaultFileRoot() const;
0700 
0701   //! Returns the defined File Extension. Null Handle if not defined
0702   Standard_EXPORT occ::handle<TCollection_HAsciiString> FileExtension() const;
0703 
0704   //! Returns the File Root defined for a Dispatch. Null if no
0705   //! Root Name is defined for it (hence, no File will be produced)
0706   Standard_EXPORT occ::handle<TCollection_HAsciiString> FileRoot(
0707     const occ::handle<IFSelect_Dispatch>& disp) const;
0708 
0709   //! Defines a File Prefix
0710   Standard_EXPORT void SetFilePrefix(const char* const name);
0711 
0712   //! Defines a Default File Root Name. Clears it is <name> = ""
0713   //! Returns True if OK, False if <name> already set for a Dispatch
0714   Standard_EXPORT bool SetDefaultFileRoot(const char* const name);
0715 
0716   //! Defines a File Extension
0717   Standard_EXPORT void SetFileExtension(const char* const name);
0718 
0719   //! Defines a Root for a Dispatch
0720   //! If <name> is empty, clears Root Name
0721   //! This has as effect to inhibit the production of File by <disp>
0722   //! Returns False if <disp> is not in the WorkSession or if a
0723   //! root name is already defined for it
0724   Standard_EXPORT bool SetFileRoot(const occ::handle<IFSelect_Dispatch>& disp,
0725                                    const char* const                     name);
0726 
0727   //! Extracts File Root Name from a given complete file name
0728   //! (uses OSD_Path)
0729   Standard_EXPORT const char* GiveFileRoot(const char* const file) const;
0730 
0731   //! Completes a file name as required, with Prefix and Extension
0732   //! (if defined; for a non-defined item, completes nothing)
0733   Standard_EXPORT const char* GiveFileComplete(const char* const file) const;
0734 
0735   //! Erases all stored data from the File Evaluation
0736   //! (i.e. ALL former naming information are lost)
0737   Standard_EXPORT void ClearFile();
0738 
0739   //! Performs and stores a File Evaluation. The Results are a List
0740   //! of produced Models and a List of names (Strings), in parallel
0741   //! Fills LastRunCheckList
0742   Standard_EXPORT void EvaluateFile();
0743 
0744   //! Returns the count of produced Models
0745   Standard_EXPORT int NbFiles() const;
0746 
0747   //! Returns a Model, given its rank in the Evaluation List
0748   Standard_EXPORT occ::handle<Interface_InterfaceModel> FileModel(const int num) const;
0749 
0750   //! Returns the name of a file corresponding to a produced Model,
0751   //! given its rank in the Evaluation List
0752   Standard_EXPORT TCollection_AsciiString FileName(const int num) const;
0753 
0754   //! Commands file sending to clear the list of already sent files,
0755   //! commands to record a new one if <record> is True
0756   //! This list is managed by the ModelCopier when SendSplit is called
0757   //! It allows a global exploitation of the set of sent files
0758   Standard_EXPORT void BeginSentFiles(const bool record);
0759 
0760   //! Returns the list of recorded sent files, or a Null Handle is
0761   //! recording has not been enabled
0762   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<TCollection_HAsciiString>>>
0763                   SentFiles() const;
0764 
0765   //! Performs creation of derived files from the input Model
0766   //! Takes its data (sub-models and names), from result EvaluateFile
0767   //! if active, else by dynamic Evaluation (not stored)
0768   //! After SendSplit, result of EvaluateFile is Cleared
0769   //! Fills LastRunCheckList
0770   //!
0771   //! Works with the WorkLibrary which acts on specific type of Model
0772   //! and can work with File Modifiers (managed by the Model Copier)
0773   //! and a ModelCopier, which can work with Model Modifiers
0774   //! Returns False if, either WorkLibrary has failed on at least
0775   //! one sub-file, or the Work Session is badly conditioned
0776   //! (no Model defined, or FileNaming not in phase with ShareOut)
0777   Standard_EXPORT bool SendSplit();
0778 
0779   //! Returns an Evaluation of the whole ShareOut definition : i.e.
0780   //! how the entities of the starting model are forecast to be sent
0781   //! to various files : list of packets according the dispatches,
0782   //! effective lists of roots for each packet (which determine the
0783   //! content of the corresponding file); plus evaluation of which
0784   //! entities are : forgotten (sent into no file), duplicated (sent
0785   //! into more than one file), sent into a given file.
0786   //! See the class PacketList for more details.
0787   Standard_EXPORT occ::handle<IFSelect_PacketList> EvalSplit() const;
0788 
0789   //! Returns the list of Entities sent in files, according to the
0790   //! count of files each one has been sent (these counts are reset
0791   //! by SetModel or SetRemaining(Forget) ) stored in Graph Status
0792   //! <count> = -1 (default) is for ENtities sent at least once
0793   //! <count> = 0 is for the Remaining List (entities not yet sent)
0794   //! <count> = 1 is for entities sent in one and only one file
0795   //! (the ideal case)
0796   //! Remaining Data are computed on each Sending/Copying output
0797   //! files (see methods EvaluateFile and SendSplit)
0798   //! Graph Status is 0 for Remaining Entity, <count> for Sent into
0799   //! <count> files
0800   //! This status is set to 0 (not yet sent) for all by SetModel
0801   //! and by SetRemaining(mode=Forget,Display)
0802   Standard_EXPORT Interface_EntityIterator SentList(const int count = -1) const;
0803 
0804   //! Returns the greater count of different files in which any of
0805   //! the starting entities could be sent.
0806   //! Before any file output, this count is 0.
0807   //! Ideal count is 1. More than 1 means that duplications occur.
0808   Standard_EXPORT int MaxSendingCount() const;
0809 
0810   //! Processes Remaining data (after having sent files), mode :
0811   //! Forget  : forget remaining info (i.e. clear all "Sent" status)
0812   //! Compute : compute and keep remaining (does nothing if :
0813   //! remaining is empty or if no files has been sent)
0814   //! Display : display entities recorded as remaining
0815   //! Undo    : restore former state of data (after Remaining(1) )
0816   //! Returns True if OK, False else (i.e. mode = 2 and Remaining
0817   //! List is either empty or takes all the entities, or mode = 3
0818   //! and no former computation of remaining data was done)
0819   Standard_EXPORT bool SetRemaining(const IFSelect_RemainMode mode);
0820 
0821   //! Sends the starting Model into one file, without splitting,
0822   //! managing remaining data or anything else.
0823   //! <computegraph> true commands the Graph to be recomputed before
0824   //! sending : required when a Model is filled in several steps
0825   //!
0826   //! The Model and File Modifiers recorded to be applied on sending
0827   //! files are.
0828   //! Returns a status of execution :
0829   //! Done if OK,
0830   //! Void if no data available,
0831   //! Error if errors occurred (work library is not defined), errors during translation
0832   //! Fail if exception during translation is raised
0833   //! Stop if no disk space or disk, file is write protected
0834   //! Fills LastRunCheckList
0835   Standard_EXPORT IFSelect_ReturnStatus SendAll(const char* const filename,
0836                                                 const bool        computegraph = false);
0837 
0838   //! Sends a part of the starting Model into one file, without
0839   //! splitting. But remaining data are managed.
0840   //! <computegraph> true commands the Graph to be recomputed before
0841   //! sending : required when a Model is filled in several steps
0842   //!
0843   //! The Model and File Modifiers recorded to be applied on sending
0844   //! files are.
0845   //! Returns a status : Done if OK, Fail if error during send,
0846   //! Error : WorkLibrary not defined, Void : selection list empty
0847   //! Fills LastRunCheckList
0848   Standard_EXPORT IFSelect_ReturnStatus SendSelected(const char* const filename,
0849                                                      const occ::handle<IFSelect_Selection>& sel,
0850                                                      const bool computegraph = false);
0851 
0852   //! Writes the current Interface Model globally to a File, and
0853   //! returns a write status which can be :
0854   //! Done OK, Fail file could not be written, Error no norm is selected
0855   //! Remark : It is a simple, one-file writing, other operations are
0856   //! available (such as splitting ...) which calls SendAll
0857   Standard_EXPORT IFSelect_ReturnStatus WriteFile(const char* const filename);
0858 
0859   //! Writes a sub-part of the current Interface Model to a File,
0860   //! as defined by a Selection <sel>, recomputes the Graph, and
0861   //! returns a write status which can be :
0862   //! Done OK, Fail file could not be written, Error no norm is selected
0863   //! Remark : It is a simple, one-file writing, other operations are
0864   //! available (such as splitting ...) which calls SendSelected
0865   Standard_EXPORT IFSelect_ReturnStatus WriteFile(const char* const                      filename,
0866                                                   const occ::handle<IFSelect_Selection>& sel);
0867 
0868   //! Returns the count of Input Selections known for a Selection,
0869   //! or 0 if <sel> not in the WorkSession. This count is one for a
0870   //! SelectDeduct / SelectExtract kind, two for SelectControl kind,
0871   //! variable for a SelectCombine (Union/Intersection), zero else
0872   Standard_EXPORT int NbSources(const occ::handle<IFSelect_Selection>& sel) const;
0873 
0874   //! Returns the <num>th Input Selection of a Selection
0875   //! (see NbSources).
0876   //! Returns a Null Handle if <sel> is not in the WorkSession or if
0877   //! <num> is out of the range <1-NbSources>
0878   //! To obtain more details, see the method Sources
0879   Standard_EXPORT occ::handle<IFSelect_Selection> Source(const occ::handle<IFSelect_Selection>& sel,
0880                                                          const int num = 1) const;
0881 
0882   //! Returns True if <sel> a Reversed SelectExtract, False else
0883   Standard_EXPORT bool IsReversedSelectExtract(const occ::handle<IFSelect_Selection>& sel) const;
0884 
0885   //! Toggles the Sense (Direct <-> Reversed) of a SelectExtract
0886   //! Returns True if Done, False if <sel> is not a SelectExtract or
0887   //! is not in the WorkSession
0888   Standard_EXPORT bool ToggleSelectExtract(const occ::handle<IFSelect_Selection>& sel);
0889 
0890   //! Sets an Input Selection (as <input>) to a SelectExtract or
0891   //! a SelectDeduct (as <sel>).
0892   //! Returns True if Done, False if <sel> is neither a
0893   //! SelectExtract nor a SelectDeduct, or not in the WorkSession
0894   Standard_EXPORT bool SetInputSelection(const occ::handle<IFSelect_Selection>& sel,
0895                                          const occ::handle<IFSelect_Selection>& input);
0896 
0897   //! Sets an Input Selection, Main if <formain> is True, Second else
0898   //! (as <sc>) to a SelectControl (as <sel>). Returns True if Done,
0899   //! False if <sel> is not a SelectControl, or <sc> or <sel> is not
0900   //! in the WorkSession
0901   Standard_EXPORT bool SetControl(const occ::handle<IFSelect_Selection>& sel,
0902                                   const occ::handle<IFSelect_Selection>& sc,
0903                                   const bool                             formain = true);
0904 
0905   //! Adds an input selection to a SelectCombine (Union or Inters.).
0906   //! Returns new count of inputs for this SelectCombine if Done or
0907   //! 0 if <sel> is not kind of SelectCombine, or if <seladd> or
0908   //! <sel> is not in the WorkSession
0909   //! By default, adding is done at the end of the list
0910   //! Else, it is an insertion to rank <atnum> (useful for Un-ReDo)
0911   Standard_EXPORT int CombineAdd(const occ::handle<IFSelect_Selection>& selcomb,
0912                                  const occ::handle<IFSelect_Selection>& seladd,
0913                                  const int                              atnum = 0);
0914 
0915   //! Removes an input selection from a SelectCombine (Union or
0916   //! Intersection). Returns True if done, False if <selcomb> is not
0917   //! kind of SelectCombine or <selrem> is not source of <selcomb>
0918   Standard_EXPORT bool CombineRemove(const occ::handle<IFSelect_Selection>& selcomb,
0919                                      const occ::handle<IFSelect_Selection>& selrem);
0920 
0921   //! Creates a new Selection, of type SelectPointed, its content
0922   //! starts with <list>. A name must be given (can be empty)
0923   Standard_EXPORT occ::handle<IFSelect_Selection> NewSelectPointed(
0924     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list,
0925     const char* const                                                          name);
0926 
0927   //! Changes the content of a Selection of type SelectPointed
0928   //! According <mode> : 0 set <list> as new content (clear former)
0929   //! 1  : adds <list> to actual content
0930   //! -1  : removes <list> from actual content
0931   //! Returns True if done, False if <sel> is not a SelectPointed
0932   Standard_EXPORT bool SetSelectPointed(
0933     const occ::handle<IFSelect_Selection>&                                     sel,
0934     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list,
0935     const int                                                                  mode) const;
0936 
0937   //! Returns a Selection from a Name :
0938   //! - the name of a Selection : this Selection
0939   //! - the name of a Signature + criteria between (..) : a new
0940   //! Selection from this Signature
0941   //! - an entity or a list of entities : a new SelectPointed
0942   //! Else, returns a Null Handle
0943   Standard_EXPORT occ::handle<IFSelect_Selection> GiveSelection(const char* const selname) const;
0944 
0945   //! Determines a list of entities from an object :
0946   //! <obj> already HSequenceOfTransient : returned itself
0947   //! <obj> Selection : its Result of Evaluation is returned
0948   //! <obj> an entity of the Model : a HSequence which contains it
0949   //! else, an empty HSequence
0950   //! <obj> the Model it self : ALL its content (not only the roots)
0951   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>> GiveList(
0952     const occ::handle<Standard_Transient>& obj) const;
0953 
0954   //! Computes a List of entities from two alphanums,
0955   //! first and second, as follows :
0956   //! if <first> is a Number or Label of an entity : this entity
0957   //! if <first> is a list of Numbers/Labels : the list of entities
0958   //! if <first> is the name of a Selection in <WS>, and <second>
0959   //! not defined, the standard result of this Selection
0960   //! else, let's consider "first second" : this whole phrase is
0961   //! split by blanks, as follows (RECURSIVE CALL) :
0962   //! - the leftest term is the final selection
0963   //! - the other terms define the result of the selection
0964   //! - and so on (the "leftest minus one" is a selection, of which
0965   //! the input is given by the remaining ...)
0966   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>> GiveList(
0967     const char* const first,
0968     const char* const second = "") const;
0969 
0970   //! Computes a List of entities from the model as follows
0971   //! <first> being a Selection or a combination of Selections,
0972   //! <ent> being an entity or a list
0973   //! of entities (as a HSequenceOfTransient) :
0974   //! the standard result of this selection applied to this list
0975   //! if <ent> is Null, the standard definition of the selection is
0976   //! used (which contains a default input selection)
0977   //! if <selname> is erroneous, a null handle is returned
0978   //!
0979   //! REMARK : selname is processed as <first second> of preceding
0980   //! GiveList
0981   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>
0982     GiveListFromList(const char* const selname, const occ::handle<Standard_Transient>& ent) const;
0983 
0984   //! Combines two lists and returns the result, according to mode :
0985   //! <mode> < 0 : entities in <l1> AND NOT in <l2>
0986   //! <mode> = 0 : entities in <l1> AND in <l2>
0987   //! <mode> > 0 : entities in <l1> OR  in <l2>
0988   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>
0989     GiveListCombined(const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& l1,
0990                      const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& l2,
0991                      const int mode) const;
0992 
0993   //! Loads data from a check iterator to query status on it
0994   Standard_EXPORT void QueryCheckList(const Interface_CheckIterator& chl);
0995 
0996   //! Determines check status for an entity regarding last call to
0997   //! QueryCheckList :
0998   //! -1 : <ent> unknown in the model, ignored
0999   //! 0 : no check at all, immediate or inherited thru Graph
1000   //! 1 : immediate warning (no fail), no inherited check
1001   //! 2 : immediate fail, no inherited check
1002   //! +10 : idem but some inherited warning (no fail)
1003   //! +20 : idem but some inherited fail
1004   Standard_EXPORT int QueryCheckStatus(const occ::handle<Standard_Transient>& ent) const;
1005 
1006   //! Determines if <entdad> is parent of <entson> (in the graph),
1007   //! returns : -1 if no; 0 if <entdad> = <entson>
1008   //! 1 if immediate parent, > 1 if parent, gives count of steps
1009   Standard_EXPORT int QueryParent(const occ::handle<Standard_Transient>& entdad,
1010                                   const occ::handle<Standard_Transient>& entson) const;
1011 
1012   //! Sets a list of Parameters, i.e. TypedValue, to be handled
1013   //! through an Editor
1014   //! The two lists are parallel, if <params> is longer than <uses>,
1015   //! surnumeral parameters are for general use
1016   //!
1017   //! EditForms are created to handle these parameters (list, edit)
1018   //! on the basis of a ParamEditor xst-params-edit
1019   //!
1020   //! A use number dispatches the parameter to a given EditForm
1021   //! EditForms are defined as follows
1022   //! Name                Use   Means
1023   //! xst-params          all   All Parameters (complete list)
1024   //! xst-params-general  1     Generals
1025   //! xst-params-load     2     LoadFile (no Transfer)
1026   //! xst-params-send     3     SendFile (Write, no Transfer)
1027   //! xst-params-split    4     Split
1028   //! xst-param-read      5     Transfer on Reading
1029   //! xst-param-write     6     Transfer on Writing
1030   Standard_EXPORT void SetParams(
1031     const NCollection_DynamicArray<occ::handle<Standard_Transient>>& params,
1032     const NCollection_DynamicArray<int>&                             uselist);
1033 
1034   //! Traces the Statics attached to a given use number
1035   //! If <use> is given positive (normal), the trace is embedded
1036   //! with a header and a trailer
1037   //! If <use> is negative, just values are printed
1038   //! (this allows to make compositions)
1039   //! Remark : use number  5 commands use -2 to be traced
1040   //! Remark : use numbers 4 and 6 command use -3 to be traced
1041   Standard_EXPORT void TraceStatics(const int use, const int mode = 0) const;
1042 
1043   //! Dumps contents of the ShareOut (on "cout")
1044   Standard_EXPORT void DumpShare() const;
1045 
1046   //! Lists the Labels of all Items of the WorkSession
1047   //! If <label> is defined, lists labels which contain it
1048   Standard_EXPORT void ListItems(const char* const label = "") const;
1049 
1050   //! Lists the Modifiers of the session (for each one, displays
1051   //! its Label). Listing is done following Ranks (Modifiers are
1052   //! invoked following their ranks)
1053   //! Model Modifiers if <formodel> is True, File Modifiers else
1054   Standard_EXPORT void ListFinalModifiers(const bool formodel) const;
1055 
1056   //! Lists a Selection and its Sources (see SelectionIterator),
1057   //! given its rank in the list
1058   Standard_EXPORT void DumpSelection(const occ::handle<IFSelect_Selection>& sel) const;
1059 
1060   //! Lists the content of the Input Model (if there is one)
1061   //! According level : 0 -> gives only count of Entities and Roots
1062   //! 1 -> Lists also Roots; 2 -> Lists all Entities (by TraceType)
1063   //! 3 -> Performs a call to CheckList (Fails) and lists the result
1064   //! 4 -> as 3 but all CheckList (Fails + Warnings)
1065   //! 5,6,7  : as 3 but resp. Count,List,Labels by Fail
1066   //! 8,9,10 : as 4 but resp. Count,List,Labels by message
1067   Standard_EXPORT void DumpModel(const int level, Standard_OStream& S);
1068 
1069   //! Dumps the current Model (as inherited DumpModel), on currently
1070   //! defined Default Trace File (default is standard output)
1071   Standard_EXPORT void TraceDumpModel(const int mode);
1072 
1073   //! Dumps a starting entity according to the current norm.
1074   //! To do this, it calls DumpEntity from WorkLibrary.
1075   //! <level> is to be interpreted for each norm : see specific
1076   //! classes of WorkLibrary for it. Generally, 0 if for very basic
1077   //! (only type ...), greater values give more and more details.
1078   Standard_EXPORT void DumpEntity(const occ::handle<Standard_Transient>& ent,
1079                                   const int                              level,
1080                                   Standard_OStream&                      S) const;
1081 
1082   //! Prints main information about an entity : its number, type,
1083   //! validity (and checks if any), category, shareds and sharings..
1084   //! mutable because it can recompute checks as necessary
1085   Standard_EXPORT void PrintEntityStatus(const occ::handle<Standard_Transient>& ent,
1086                                          Standard_OStream&                      S);
1087 
1088   //! Dumps an entity from the current Model as inherited DumpEntity
1089   //! on currently defined Default Trace File
1090   //! (<level> interpreted according to the Norm, see WorkLibrary)
1091   Standard_EXPORT void TraceDumpEntity(const occ::handle<Standard_Transient>& ent,
1092                                        const int                              level) const;
1093 
1094   //! Prints a CheckIterator to the current Trace File, controlled
1095   //! with the current Model
1096   //! complete or fails only, according to <failsonly>
1097   //! <mode> defines the mode of printing
1098   //! 0 : sequential, according entities; else with a CheckCounter
1099   //! 1 : according messages, count of entities
1100   //! 2 : id but with list of entities, designated by their numbers
1101   //! 3 : as 2 but with labels of entities
1102   Standard_EXPORT void PrintCheckList(Standard_OStream&              S,
1103                                       const Interface_CheckIterator& checklist,
1104                                       const bool                     failsonly,
1105                                       const IFSelect_PrintCount      mode) const;
1106 
1107   //! Prints a SignatureList to the current Trace File, controlled
1108   //! with the current Model
1109   //! <mode> defines the mode of printing (see SignatureList)
1110   Standard_EXPORT void PrintSignatureList(Standard_OStream&                          S,
1111                                           const occ::handle<IFSelect_SignatureList>& signlist,
1112                                           const IFSelect_PrintCount                  mode) const;
1113 
1114   //! Displays the list of Entities selected by a Selection (i.e.
1115   //! the result of EvalSelection).
1116   Standard_EXPORT void EvaluateSelection(const occ::handle<IFSelect_Selection>& sel) const;
1117 
1118   //! Displays the result of applying a Dispatch on the input Model
1119   //! (also shows Remainder if there is)
1120   //! <mode> = 0 (default), displays nothing else
1121   //! <mode> = 1 : displays also duplicated entities (because of
1122   //! this dispatch)
1123   //! <mode> = 2 : displays the entities of the starting Model
1124   //! which are not taken by this dispatch (forgotten entities)
1125   //! <mode> = 3 : displays both duplicated and forgotten entities
1126   //! Remark : EvaluateComplete displays these data evaluated for
1127   //! for all the dispatches, if there are several
1128   Standard_EXPORT void EvaluateDispatch(const occ::handle<IFSelect_Dispatch>& disp,
1129                                         const int                             mode = 0) const;
1130 
1131   //! Displays the effect of applying the ShareOut on the input
1132   //! Model.
1133   //! <mode> = 0 (default) : displays only roots for each packet,
1134   //! <mode> = 1 : displays all entities for each packet, plus
1135   //! duplicated entities
1136   //! <mode> = 2 : same as <mode> = 1, plus displays forgotten
1137   //! entities (which are in no packet at all)
1138   Standard_EXPORT void EvaluateComplete(const int mode = 0) const;
1139 
1140   //! Internal method which displays an EntityIterator
1141   //! <mode> 0 gives short display (only entity numbers)
1142   //! 1 gives a more complete trace (1 line per Entity)
1143   //! (can be used each time a trace has to be output from a list)
1144   //! 2 gives a form suitable for givelist : (n1,n2,n3...)
1145   Standard_EXPORT void ListEntities(const Interface_EntityIterator& iter,
1146                                     const int                       mode,
1147                                     Standard_OStream&               S) const;
1148 
1149   DEFINE_STANDARD_RTTIEXT(IFSelect_WorkSession, Standard_Transient)
1150 
1151 protected:
1152   occ::handle<Interface_HGraph> thegraph;
1153   Interface_CheckIterator       thecheckrun;
1154   NCollection_IndexedDataMap<occ::handle<Standard_Transient>, occ::handle<Standard_Transient>>
1155                                                                                 theitems;
1156   NCollection_DataMap<TCollection_AsciiString, occ::handle<Standard_Transient>> thenames;
1157 
1158 private:
1159   bool                                  theerrhand;
1160   occ::handle<IFSelect_ShareOut>        theshareout;
1161   occ::handle<IFSelect_WorkLibrary>     thelibrary;
1162   occ::handle<Interface_Protocol>       theprotocol;
1163   occ::handle<Interface_InterfaceModel> myModel;
1164   TCollection_AsciiString               theloaded;
1165   occ::handle<Interface_GTool>          thegtool;
1166   bool                                  thecheckdone;
1167   Interface_CheckIterator               thechecklist;
1168   TCollection_AsciiString               thecheckana;
1169   occ::handle<IFSelect_ModelCopier>     thecopier;
1170   occ::handle<Interface_InterfaceModel> theoldel;
1171   bool                                  themodelstat;
1172 };
1173 
1174 #endif // _IFSelect_WorkSession_HeaderFile