1 // Created on: 1996-03-13
2 // Created by: Christian CAILLET
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _XSControl_TransferWriter_HeaderFile
18 #define _XSControl_TransferWriter_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Transient.hxx>
24 #include <IFSelect_ReturnStatus.hxx>
25 #include <Transfer_FinderProcess.hxx>
26 class XSControl_Controller;
27 class Standard_Transient;
28 class Interface_InterfaceModel;
30 class Interface_CheckIterator;
33 class XSControl_TransferWriter;
34 DEFINE_STANDARD_HANDLE(XSControl_TransferWriter, Standard_Transient)
36 //! TransferWriter gives help to control transfer to write a file
37 //! after having converted data from Cascade/Imagine
39 //! It works with a Controller (which itself can work with an
40 //! Actor to Write) and a FinderProcess. It records results and
42 class XSControl_TransferWriter : public Standard_Transient
46 //! Creates a TransferWriter, empty, ready to run
47 //! with an empty FinderProcess (but no controller, etc)
48 XSControl_TransferWriter()
49 : myTransferWriter(new Transfer_FinderProcess),
53 //! Returns the FinderProcess itself
54 const Handle(Transfer_FinderProcess) & FinderProcess() const
55 { return myTransferWriter; }
57 //! Sets a new FinderProcess and forgets the former one
58 void SetFinderProcess (const Handle(Transfer_FinderProcess)& theFP)
59 { myTransferWriter = theFP; }
61 //! Returns the currently used Controller
62 const Handle(XSControl_Controller) & Controller() const
63 { return myController; }
65 //! Sets a new Controller, also sets a new FinderProcess
66 void SetController (const Handle(XSControl_Controller)& theCtl)
68 myController = theCtl;
72 //! Clears recorded data according a mode
73 //! 0 clears FinderProcess (results, checks)
74 //! -1 create a new FinderProcess
75 Standard_EXPORT void Clear (const Standard_Integer theMode);
77 //! Returns the current Transfer Mode (an Integer)
78 //! It will be interpreted by the Controller to run Transfers
79 //! This call form could be later replaced by more specific ones
80 //! (parameters suited for each norm / transfer case)
81 Standard_Integer TransferMode() const
82 { return myTransferMode; }
84 //! Changes the Transfer Mode
85 void SetTransferMode (const Standard_Integer theMode)
86 { myTransferMode = theMode; }
88 //! Prints statistics on current Trace File, according what,mode
89 //! See PrintStatsProcess for details
90 Standard_EXPORT void PrintStats (const Standard_Integer theWhat, const Standard_Integer theMode = 0) const;
92 //! Tells if a transient object (from an application) is a valid
93 //! candidate for a transfer to a model
94 //! Asks the Controller (RecognizeWriteTransient)
95 //! If <obj> is a HShape, calls RecognizeShape
96 Standard_EXPORT Standard_Boolean RecognizeTransient (const Handle(Standard_Transient)& theObj);
98 //! Transfers a Transient object (from an application) to a model
99 //! of current norm, according to the last call to SetTransferMode
100 //! Works by calling the Controller
101 //! Returns status : =0 if OK, >0 if error during transfer, <0 if
102 //! transfer badly initialised
103 Standard_EXPORT IFSelect_ReturnStatus TransferWriteTransient (const Handle(Interface_InterfaceModel)& theModel, const Handle(Standard_Transient)& theObj);
105 //! Tells if a Shape is valid for a transfer to a model
106 //! Asks the Controller (RecognizeWriteShape)
107 Standard_EXPORT Standard_Boolean RecognizeShape (const TopoDS_Shape& theShape);
109 //! Transfers a Shape from CasCade to a model of current norm,
110 //! according to the last call to SetTransferMode
111 //! Works by calling the Controller
112 //! Returns status : =0 if OK, >0 if error during transfer, <0 if
113 //! transfer badly initialised
114 Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const Handle(Interface_InterfaceModel)& theModel, const TopoDS_Shape& theShape);
116 //! Returns the check-list of last transfer (write), i.e. the
117 //! check-list currently recorded in the FinderProcess
118 Standard_EXPORT Interface_CheckIterator CheckList() const;
120 //! Returns the check-list of last transfer (write), but tries
121 //! to bind to each check, the resulting entity in the model
122 //! instead of keeping the original Mapper, whenever known
123 Standard_EXPORT Interface_CheckIterator ResultCheckList (const Handle(Interface_InterfaceModel)& theModel) const;
125 DEFINE_STANDARD_RTTIEXT(XSControl_TransferWriter,Standard_Transient)
129 Handle(XSControl_Controller) myController;
130 Handle(Transfer_FinderProcess) myTransferWriter;
131 Standard_Integer myTransferMode;
134 #endif // _XSControl_TransferWriter_HeaderFile