42cf5bc1 |
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 |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _XSControl_TransferWriter_HeaderFile |
18 | #define _XSControl_TransferWriter_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Integer.hxx> |
24 | #include <MMgt_TShared.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <IFSelect_ReturnStatus.hxx> |
27 | class XSControl_Controller; |
28 | class Transfer_FinderProcess; |
29 | class Standard_Transient; |
30 | class Interface_InterfaceModel; |
31 | class TopoDS_Shape; |
32 | class Interface_CheckIterator; |
33 | |
34 | |
35 | class XSControl_TransferWriter; |
36 | DEFINE_STANDARD_HANDLE(XSControl_TransferWriter, MMgt_TShared) |
37 | |
38 | //! TransferWriter gives help to control transfer to write a file |
39 | //! after having converted data from Cascade/Imagine |
40 | //! |
41 | //! It works with a Controller (which itself can work with an |
42 | //! Actor to Write) and a FinderProcess. It records results and |
43 | //! checks |
44 | class XSControl_TransferWriter : public MMgt_TShared |
45 | { |
46 | |
47 | public: |
48 | |
49 | |
50 | //! Creates a TransferWriter, empty, ready to run |
51 | //! with an empty FinderProcess (but no controller, etc) |
52 | Standard_EXPORT XSControl_TransferWriter(); |
53 | |
54 | //! Returns the FinderProcess itself |
55 | Standard_EXPORT Handle(Transfer_FinderProcess) FinderProcess() const; |
56 | |
57 | //! Sets a new FinderProcess and forgets the former one |
58 | Standard_EXPORT void SetFinderProcess (const Handle(Transfer_FinderProcess)& FP); |
59 | |
60 | //! Returns the currently used Controller |
61 | Standard_EXPORT Handle(XSControl_Controller) Controller() const; |
62 | |
63 | //! Sets a new Controller, also sets a new FinderProcess |
64 | Standard_EXPORT void SetController (const Handle(XSControl_Controller)& ctl); |
65 | |
66 | //! Clears recorded data according a mode |
67 | //! 0 clears FinderProcess (results, checks) |
68 | //! -1 create a new FinderProcess |
69 | Standard_EXPORT void Clear (const Standard_Integer mode); |
70 | |
71 | //! Returns the current Transfer Mode (an Integer) |
72 | //! It will be interpreted by the Controller to run Transfers |
73 | //! This call form could be later replaced by more specific ones |
74 | //! (parameters suited for each norm / transfer case) |
75 | Standard_EXPORT Standard_Integer TransferMode() const; |
76 | |
77 | //! Changes the Transfer Mode |
78 | Standard_EXPORT void SetTransferMode (const Standard_Integer mode); |
79 | |
80 | //! Prints statistics on current Trace File, according what,mode |
81 | //! See PrintStatsProcess for details |
82 | Standard_EXPORT void PrintStats (const Standard_Integer what, const Standard_Integer mode = 0) const; |
83 | |
84 | //! Tells if a transient object (from an application) is a valid |
85 | //! candidate for a transfer to a model |
86 | //! Asks the Controller (RecognizeWriteTransient) |
87 | //! If <obj> is a HShape, calls RecognizeShape |
88 | Standard_EXPORT Standard_Boolean RecognizeTransient (const Handle(Standard_Transient)& obj); |
89 | |
90 | //! Transfers a Transient object (from an application) to a model |
91 | //! of current norm, according to the last call to SetTransferMode |
92 | //! Works by calling the Controller |
93 | //! Returns status : =0 if OK, >0 if error during transfer, <0 if |
94 | //! transfer badly initialised |
95 | Standard_EXPORT IFSelect_ReturnStatus TransferWriteTransient (const Handle(Interface_InterfaceModel)& model, const Handle(Standard_Transient)& obj); |
96 | |
97 | //! Tells if a Shape is valid for a transfer to a model |
98 | //! Asks the Controller (RecognizeWriteShape) |
99 | Standard_EXPORT Standard_Boolean RecognizeShape (const TopoDS_Shape& shape); |
100 | |
101 | //! Transfers a Shape from CasCade to a model of current norm, |
102 | //! according to the last call to SetTransferMode |
103 | //! Works by calling the Controller |
104 | //! Returns status : =0 if OK, >0 if error during transfer, <0 if |
105 | //! transfer badly initialised |
106 | Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const Handle(Interface_InterfaceModel)& model, const TopoDS_Shape& shape); |
107 | |
108 | //! Returns the check-list of last transfer (write), i.e. the |
109 | //! check-list currently recorded in the FinderProcess |
110 | Standard_EXPORT Interface_CheckIterator CheckList() const; |
111 | |
112 | //! Returns the check-list of last transfer (write), but tries |
113 | //! to bind to each check, the resulting entity in the model |
114 | //! instead of keeping the original Mapper, whenever known |
115 | Standard_EXPORT Interface_CheckIterator ResultCheckList (const Handle(Interface_InterfaceModel)& model) const; |
116 | |
117 | //! Forecast to print statitics about a FinderProcess |
118 | Standard_EXPORT static void PrintStatsProcess (const Handle(Transfer_FinderProcess)& TP, const Standard_Integer what, const Standard_Integer mode = 0); |
119 | |
120 | |
121 | |
122 | |
92efcf78 |
123 | DEFINE_STANDARD_RTTIEXT(XSControl_TransferWriter,MMgt_TShared) |
42cf5bc1 |
124 | |
125 | protected: |
126 | |
127 | |
128 | |
129 | |
130 | private: |
131 | |
132 | |
133 | Handle(XSControl_Controller) theController; |
134 | Handle(Transfer_FinderProcess) theTransferWrite; |
135 | Standard_Integer theTransferMode; |
136 | |
137 | |
138 | }; |
139 | |
140 | |
141 | |
142 | |
143 | |
144 | |
145 | |
146 | #endif // _XSControl_TransferWriter_HeaderFile |