Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:29

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