0032696: Coding - get rid of unused forward declarations [StepSelect to Xw]
[occt.git] / src / TransferBRep / TransferBRep_Reader.hxx
1 // Created on: 1994-10-03
2 // Created by: Christian CAILLET
3 // Copyright (c) 1994-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 _TransferBRep_Reader_HeaderFile
18 #define _TransferBRep_Reader_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <TopTools_HSequenceOfShape.hxx>
27 #include <TColStd_HSequenceOfTransient.hxx>
28 #include <Message_ProgressRange.hxx>
29
30 class Interface_Protocol;
31 class Transfer_ActorOfTransientProcess;
32 class Interface_InterfaceModel;
33 class Transfer_TransientProcess;
34 class Interface_CheckIterator;
35 class TopoDS_Shape;
36 class Standard_Transient;
37
38 //! This class offers a simple, easy to call, way of transferring
39 //! data from interface files to Shapes from CasCade
40 //! It must be specialized according to each norm/protocol, by :
41 //! - defining how to read a file (specific method with protocol)
42 //! - definig transfer, by providing an Actor
43 class TransferBRep_Reader 
44 {
45 public:
46
47   DEFINE_STANDARD_ALLOC
48
49   
50   //! Initializes a non-specialised Reader. Typically, for each norm
51   //! or protocol, is will be required to define a specific Create
52   //! to load a file and transfer it
53   Standard_EXPORT TransferBRep_Reader();
54   
55   //! Records the protocol to be used for read and transfer roots
56   Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& protocol);
57   
58   //! Returns the recorded Protocol
59   Standard_EXPORT virtual Handle(Interface_Protocol) Protocol() const;
60   
61   //! Records the actor to be used for transfers
62   Standard_EXPORT void SetActor (const Handle(Transfer_ActorOfTransientProcess)& actor);
63   
64   //! Returns the recorded Actor
65   Standard_EXPORT virtual Handle(Transfer_ActorOfTransientProcess) Actor() const;
66   
67   //! Sets File Status to be interpreted as follows :
68   //! = 0 OK
69   //! < 0 file not found
70   //! > 0 read error, no Model could be created
71   Standard_EXPORT void SetFileStatus (const Standard_Integer status);
72   
73   //! Returns the File Status
74   Standard_EXPORT Standard_Integer FileStatus() const;
75   
76   //! Returns True if FileStatus is for FileNotFound
77   Standard_EXPORT Standard_Boolean FileNotFound() const;
78   
79   //! Returns True if FileStatus is for Error during read
80   //! (major error; for local error, see CheckModel)
81   Standard_EXPORT Standard_Boolean SyntaxError() const;
82   
83   //! Specifies a Model to work on
84   //! Also clears the result and Done status
85   Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
86   
87   //! Returns the Model to be worked on
88   Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
89   
90   //! clears the result and Done status. But not the Model.
91   Standard_EXPORT void Clear();
92   
93   //! Checks the Model. Returns True if there is NO FAIL at all
94   //! (regardless Warnings)
95   //! If <withprint> is True, also sends Checks on standard output
96   Standard_EXPORT Standard_Boolean CheckStatusModel (const Standard_Boolean withprint) const;
97   
98   //! Checks the Model (complete : syntax + semantic) and returns
99   //! the produced Check List
100   Standard_EXPORT Interface_CheckIterator CheckListModel() const;
101   
102   //! Returns (by Reference, hence can be changed) the Mode for new
103   //! Transfer : True (D) means that each new Transfer produces a
104   //! new TransferProcess. Else keeps the original one but each
105   //! Transfer clears its (former results are not kept)
106   Standard_EXPORT Standard_Boolean& ModeNewTransfer();
107   
108   //! Initializes the Reader for a Transfer (one,roots, or list)
109   //! Also calls PrepareTransfer
110   //! Returns True when done, False if could not be done
111   Standard_EXPORT Standard_Boolean BeginTransfer();
112   
113   //! Ebds a Transfer (one, roots or list) by recording its result
114   Standard_EXPORT void EndTransfer();
115   
116   //! Prepares the Transfer. Also can act on the Actor or change the
117   //! TransientProcess if required.
118   //! Should not set the Actor into the TransientProcess, it is done
119   //! by caller. The provided default does nothing.
120   Standard_EXPORT virtual void PrepareTransfer();
121   
122   //! Transfers all Root Entities which are recognized as Geom-Topol
123   //! The result will be a list of Shapes.
124   //! This method calls user redefinable PrepareTransfer
125   //! Remark : former result is cleared
126   Standard_EXPORT virtual void TransferRoots(const Message_ProgressRange& theProgress = Message_ProgressRange());
127   
128   //! Transfers an Entity given its rank in the Model (Root or not)
129   //! Returns True if it is recognized as Geom-Topol.
130   //! (But it can have failed : see IsDone)
131   Standard_EXPORT virtual Standard_Boolean Transfer (const Standard_Integer num,
132                                                      const Message_ProgressRange& theProgress = Message_ProgressRange());
133   
134   //! Transfers a list of Entities (only the ones also in the Model)
135   //! Remark : former result is cleared
136   Standard_EXPORT virtual void TransferList (const Handle(TColStd_HSequenceOfTransient)& list,
137                                              const Message_ProgressRange& theProgress = Message_ProgressRange());
138   
139   //! Returns True if the LAST Transfer/TransferRoots was a success
140   Standard_EXPORT Standard_Boolean IsDone() const;
141   
142   //! Returns the count of produced Shapes (roots)
143   Standard_EXPORT Standard_Integer NbShapes() const;
144   
145   //! Returns the complete list of produced Shapes
146   Standard_EXPORT Handle(TopTools_HSequenceOfShape) Shapes() const;
147   
148   //! Returns a Shape given its rank, by default the first one
149   Standard_EXPORT const TopoDS_Shape& Shape (const Standard_Integer num = 1) const;
150   
151   //! Returns a Shape produced from a given entity (if it was
152   //! individually transferred or if an intermediate result is
153   //! known). If no Shape is bound with <ent>, returns a Null Shape
154   //! Warning : Runs on the last call to Transfer,TransferRoots,TransferList
155   Standard_EXPORT TopoDS_Shape ShapeResult (const Handle(Standard_Transient)& ent) const;
156   
157   //! Returns a unique Shape for the result :
158   //! - a void Shape (type = SHAPE) if result is empty
159   //! - a simple Shape if result has only one : returns this one
160   //! - a Compound if result has more than one Shape
161   Standard_EXPORT TopoDS_Shape OneShape() const;
162   
163   //! Returns the count of produced Transient Results (roots)
164   Standard_EXPORT Standard_Integer NbTransients() const;
165   
166   //! Returns the complete list of produced Transient Results
167   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Transients() const;
168   
169   //! Returns a Transient Root Result, given its rank (by default
170   //! the first one)
171   Standard_EXPORT Handle(Standard_Transient) Transient (const Standard_Integer num = 1) const;
172   
173   //! Checks the Result of last Transfer (individual or roots, no
174   //! cumulation on several transfers). Returns True if NO fail
175   //! occurred during Transfer (queries the TransientProcess)
176   Standard_EXPORT Standard_Boolean CheckStatusResult (const Standard_Boolean withprints) const;
177   
178   //! Checks the Result of last Transfer (individual or roots, no
179   //! cumulation on several transfers) and returns the produced list
180   Standard_EXPORT Interface_CheckIterator CheckListResult() const;
181   
182   //! Returns the TransientProcess. It records information about
183   //! the very last transfer done. Null if no transfer yet done.
184   //! Can be used for queries more accurate than the default ones.
185   Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const;
186   
187   Standard_EXPORT virtual ~TransferBRep_Reader();
188
189 protected:
190
191
192
193   Standard_Boolean theDone;
194   Handle(Transfer_TransientProcess) theProc;
195
196
197 private:
198
199
200
201   Handle(Interface_Protocol) theProto;
202   Handle(Transfer_ActorOfTransientProcess) theActor;
203   Handle(Interface_InterfaceModel) theModel;
204   Standard_Integer theFilest;
205   Standard_Boolean theNewpr;
206   Handle(TopTools_HSequenceOfShape) theShapes;
207   Handle(TColStd_HSequenceOfTransient) theTransi;
208
209
210 };
211
212
213
214
215
216
217
218 #endif // _TransferBRep_Reader_HeaderFile