Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-10 09:18:43

0001 // Created on: 1996-03-13
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1996-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 _XSControl_TransferWriter_HeaderFile
0018 #define _XSControl_TransferWriter_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Transient.hxx>
0024 #include <IFSelect_ReturnStatus.hxx>
0025 #include <Transfer_FinderProcess.hxx>
0026 class XSControl_Controller;
0027 class Interface_InterfaceModel;
0028 class TopoDS_Shape;
0029 class Interface_CheckIterator;
0030 
0031 class XSControl_TransferWriter;
0032 DEFINE_STANDARD_HANDLE(XSControl_TransferWriter, Standard_Transient)
0033 
0034 //! TransferWriter gives help to control transfer to write a file
0035 //! after having converted data from Cascade/Imagine
0036 //!
0037 //! It works with a Controller (which itself can work with an
0038 //! Actor to Write) and a FinderProcess. It records results and
0039 //! checks
0040 class XSControl_TransferWriter : public Standard_Transient
0041 {
0042 public:
0043   //! Creates a TransferWriter, empty, ready to run
0044   //! with an empty FinderProcess (but no controller, etc)
0045   XSControl_TransferWriter()
0046       : myTransferWriter(new Transfer_FinderProcess),
0047         myTransferMode(0)
0048   {
0049   }
0050 
0051   //! Returns the FinderProcess itself
0052   const Handle(Transfer_FinderProcess)& FinderProcess() const { return myTransferWriter; }
0053 
0054   //! Sets a new FinderProcess and forgets the former one
0055   void SetFinderProcess(const Handle(Transfer_FinderProcess)& theFP) { myTransferWriter = theFP; }
0056 
0057   //! Returns the currently used Controller
0058   const Handle(XSControl_Controller)& Controller() const { return myController; }
0059 
0060   //! Sets a new Controller, also sets a new FinderProcess
0061   void SetController(const Handle(XSControl_Controller)& theCtl)
0062   {
0063     myController = theCtl;
0064     Clear(-1);
0065   }
0066 
0067   //! Clears recorded data according a mode
0068   //! 0 clears FinderProcess (results, checks)
0069   //! -1 create a new FinderProcess
0070   Standard_EXPORT void Clear(const Standard_Integer theMode);
0071 
0072   //! Returns the current Transfer Mode (an Integer)
0073   //! It will be interpreted by the Controller to run Transfers
0074   //! This call form could be later replaced by more specific ones
0075   //! (parameters suited for each norm / transfer case)
0076   Standard_Integer TransferMode() const { return myTransferMode; }
0077 
0078   //! Changes the Transfer Mode
0079   void SetTransferMode(const Standard_Integer theMode) { myTransferMode = theMode; }
0080 
0081   //! Prints statistics on current Trace File, according what,mode
0082   //! See PrintStatsProcess for details
0083   Standard_EXPORT void PrintStats(const Standard_Integer theWhat,
0084                                   const Standard_Integer theMode = 0) const;
0085 
0086   //! Tells if a transient object (from an application) is a valid
0087   //! candidate for a transfer to a model
0088   //! Asks the Controller (RecognizeWriteTransient)
0089   //! If <obj> is a HShape, calls RecognizeShape
0090   Standard_EXPORT Standard_Boolean RecognizeTransient(const Handle(Standard_Transient)& theObj);
0091 
0092   //! Transfers a Transient object (from an application) to a model
0093   //! of current norm, according to the last call to SetTransferMode
0094   //! Works by calling the Controller
0095   //! Returns status : =0 if OK, >0 if error during transfer, <0 if
0096   //! transfer badly initialised
0097   Standard_EXPORT IFSelect_ReturnStatus
0098     TransferWriteTransient(const Handle(Interface_InterfaceModel)& theModel,
0099                            const Handle(Standard_Transient)&       theObj,
0100                            const Message_ProgressRange& theProgress = Message_ProgressRange());
0101 
0102   //! Tells if a Shape is valid for a transfer to a model
0103   //! Asks the Controller (RecognizeWriteShape)
0104   Standard_EXPORT Standard_Boolean RecognizeShape(const TopoDS_Shape& theShape);
0105 
0106   //! Transfers a Shape from CasCade to a model of current norm,
0107   //! according to the last call to SetTransferMode
0108   //! Works by calling the Controller
0109   //! Returns status : =0 if OK, >0 if error during transfer, <0 if
0110   //! transfer badly initialised
0111   Standard_EXPORT IFSelect_ReturnStatus
0112     TransferWriteShape(const Handle(Interface_InterfaceModel)& theModel,
0113                        const TopoDS_Shape&                     theShape,
0114                        const Message_ProgressRange& theProgress = Message_ProgressRange());
0115 
0116   //! Returns the check-list of last transfer (write), i.e. the
0117   //! check-list currently recorded in the FinderProcess
0118   Standard_EXPORT Interface_CheckIterator CheckList() const;
0119 
0120   //! Returns the check-list of last transfer (write), but tries
0121   //! to bind to each check, the resulting entity in the model
0122   //! instead of keeping the original Mapper, whenever known
0123   Standard_EXPORT Interface_CheckIterator
0124     ResultCheckList(const Handle(Interface_InterfaceModel)& theModel) const;
0125 
0126   DEFINE_STANDARD_RTTIEXT(XSControl_TransferWriter, Standard_Transient)
0127 
0128 private:
0129   Handle(XSControl_Controller)   myController;
0130   Handle(Transfer_FinderProcess) myTransferWriter;
0131   Standard_Integer               myTransferMode;
0132 };
0133 
0134 #endif // _XSControl_TransferWriter_HeaderFile