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