Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-04 09:16:37

0001 // Created on: 1995-11-16
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1995-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 _Transfer_ResultFromModel_HeaderFile
0018 #define _Transfer_ResultFromModel_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TCollection_AsciiString.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <Interface_CheckStatus.hxx>
0026 #include <Standard_Transient.hxx>
0027 #include <NCollection_Sequence.hxx>
0028 #include <NCollection_HSequence.hxx>
0029 class Interface_InterfaceModel;
0030 class Transfer_ResultFromTransient;
0031 class Transfer_TransientProcess;
0032 class Interface_CheckIterator;
0033 
0034 //! ResultFromModel is used to store a final result stored in a
0035 //! TransientProcess, respectfully to its structuration in scopes
0036 //! by using a set of ResultFromTransient
0037 //! Hence, it can be regarded as a passive equivalent of the
0038 //! stored data in the TransientProcess, while an Iterator gives
0039 //! a flat view of it.
0040 //!
0041 //! A ResultFromModel is intended to be attached to the transfer
0042 //! of one entity (typically root entity but it is not mandatory)
0043 //!
0044 //! It is then possible to :
0045 //! - Create and fill a ResultFromModel from a TransientProcess,
0046 //! by designating a starting entity
0047 //! - Fill back the TransientProcess from a ResultFromModel, as it
0048 //! were filled by the operation which filled it the first time
0049 class Transfer_ResultFromModel : public Standard_Transient
0050 {
0051 
0052 public:
0053   //! Creates a ResultFromModel, empty
0054   Standard_EXPORT Transfer_ResultFromModel();
0055 
0056   //! Sets starting Model
0057   Standard_EXPORT void SetModel(const occ::handle<Interface_InterfaceModel>& model);
0058 
0059   //! Sets starting File Name
0060   Standard_EXPORT void SetFileName(const char* const filename);
0061 
0062   //! Returns starting Model (null if not set)
0063   Standard_EXPORT occ::handle<Interface_InterfaceModel> Model() const;
0064 
0065   //! Returns starting File Name (empty if not set)
0066   Standard_EXPORT const char* FileName() const;
0067 
0068   //! Fills from a TransientProcess, with the result attached to
0069   //! a starting entity. Considers its Model if it is set.
0070   //! This action produces a structured set of ResultFromTransient,
0071   //! considering scopes, starting by that of <ent>.
0072   //! If <ent> has no recorded result, it remains empty
0073   //! Returns True if a result is recorded, False else
0074   Standard_EXPORT bool Fill(const occ::handle<Transfer_TransientProcess>& TP,
0075                             const occ::handle<Standard_Transient>&        ent);
0076 
0077   //! Clears some data attached to binders used by TransientProcess,
0078   //! which become useless once the transfer has been done,
0079   //! by calling Strip on its ResultFromTransient
0080   //!
0081   //! mode = 0  : minimum, clears data remaining from TransferProcess
0082   //! mode = 10 : just keeps file name, label, check status ...,
0083   //! and MainResult but only the result (Binder)
0084   //! mode = 11 : also clears MainResult (status and names remain)
0085   Standard_EXPORT void Strip(const int mode);
0086 
0087   //! Fills back a TransientProcess from the structured set of
0088   //! binders. Also sets the Model.
0089   Standard_EXPORT void FillBack(const occ::handle<Transfer_TransientProcess>& TP) const;
0090 
0091   //! Returns True if a Result is recorded
0092   Standard_EXPORT bool HasResult() const;
0093 
0094   //! Returns the main recorded ResultFromTransient, or a null
0095   Standard_EXPORT occ::handle<Transfer_ResultFromTransient> MainResult() const;
0096 
0097   //! Sets a new value for the main recorded ResultFromTransient
0098   Standard_EXPORT void SetMainResult(const occ::handle<Transfer_ResultFromTransient>& amain);
0099 
0100   //! Returns the label in starting model attached to main entity
0101   //! (updated by Fill or SetMainResult, if Model is known)
0102   Standard_EXPORT const char* MainLabel() const;
0103 
0104   //! Returns the label in starting model attached to main entity
0105   Standard_EXPORT int MainNumber() const;
0106 
0107   //! Searches for a key (starting entity) and returns its result
0108   //! Returns a null handle if not found
0109   Standard_EXPORT occ::handle<Transfer_ResultFromTransient> ResultFromKey(
0110     const occ::handle<Standard_Transient>& start) const;
0111 
0112   //! Internal method which returns the list of ResultFromTransient,
0113   //! according level (2:complete; 1:sub-level 1; 0:main only)
0114   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>> Results(
0115     const int level) const;
0116 
0117   //! Returns the list of recorded starting entities, ending by the
0118   //! root. Entities with check but no transfer result are ignored
0119   //! <level> = 2 (D), considers the complete list
0120   //! <level> = 1      considers the main result plus immediate subs
0121   //! <level> = 0      just the main result
0122   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>
0123                   TransferredList(const int level = 2) const;
0124 
0125   //! Returns the list of starting entities to which a check status
0126   //! is attached.
0127   //! <check> = -2  all entities whatever the check (see result)
0128   //! <check> = -1  entities with no fail (warning allowed)
0129   //! <check> =  0  entities with no check at all
0130   //! <check> =  1  entities with warning but no fail
0131   //! <check> =  2  entities with fail
0132   //! <result> : if True, only entities with an attached result
0133   //! Remark : result True and check=0 will give an empty list
0134   Standard_EXPORT occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>> CheckedList(
0135     const Interface_CheckStatus check,
0136     const bool                  result) const;
0137 
0138   //! Returns the check-list of this set of results
0139   //! <erronly> true : only fails are considered
0140   //! <level> = 0 : considers only main binder
0141   //! <level> = 1 : considers main binder plus immediate subs
0142   //! <level> = 2 (D) : considers all checks
0143   Standard_EXPORT Interface_CheckIterator CheckList(const bool erronly, const int level = 2) const;
0144 
0145   //! Returns the check status with corresponds to the content
0146   //! of this ResultFromModel; considers all levels of transfer
0147   //! (worst status). Returns CheckAny if not yet computed
0148   //! Reads it from recorded status if already computed, else
0149   //! recomputes one
0150   Standard_EXPORT Interface_CheckStatus CheckStatus() const;
0151 
0152   //! Computes and records check status (see CheckStatus)
0153   //! Does not computes it if already done and <enforce> False
0154   Standard_EXPORT Interface_CheckStatus ComputeCheckStatus(const bool enforce);
0155 
0156   DEFINE_STANDARD_RTTIEXT(Transfer_ResultFromModel, Standard_Transient)
0157 
0158 private:
0159   occ::handle<Interface_InterfaceModel>     themodel;
0160   TCollection_AsciiString                   thename;
0161   occ::handle<Transfer_ResultFromTransient> themain;
0162   TCollection_AsciiString                   themlab;
0163   int                                       themnum;
0164   Interface_CheckStatus                     themchk;
0165 };
0166 
0167 #endif // _Transfer_ResultFromModel_HeaderFile