0027349: XtControl_Reader is not thread-safe
[occt.git] / src / IGESControl / IGESControl_Reader.hxx
1 // Created on: 1996-09-06
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 _IGESControl_Reader_HeaderFile
18 #define _IGESControl_Reader_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Boolean.hxx>
25 #include <XSControl_Reader.hxx>
26 #include <Standard_Integer.hxx>
27 #include <IFSelect_PrintFail.hxx>
28 #include <IFSelect_PrintCount.hxx>
29 class XSControl_WorkSession;
30 class IGESData_IGESModel;
31
32
33
34 //! Reads IGES files, checks them and translates their contents into Open CASCADE models.
35 //! The IGES data can be that of a whole model or that of a specific list of entities in the model.
36 //! As in XSControl_Reader, you specify the list using a selection.
37 //! For translation of iges files it is possible to use the following sequence:
38 //! To change parameters of translation
39 //! class Interface_Static should be used before the beginning of translation
40 //! (see IGES Parameters and General Parameters)
41 //! Creation of reader
42 //! IGESControl_Reader reader;
43 //! To load a file in a model use method:
44 //! reader.ReadFile("filename.igs")
45 //! To check a loading file use method Check:
46 //! reader.Check(failsonly); where failsonly is equal to Standard_True or
47 //! Standard_False;
48 //! To print the results of load:
49 //! reader.PrintCheckLoad(failsonly,mode) where mode is equal to the value of
50 //! enumeration IFSelect_PrintCount
51 //! To transfer entities from a model the following methods can be used:
52 //! for the whole model
53 //! reader.TransferRoots(onlyvisible); where onlyvisible is equal to
54 //! Standard_True or Standard_False;
55 //! To transfer a list of entities:
56 //! reader.TransferList(list);
57 //! To transfer one entity
58 //! reader.TransferEntity(ent) or reader.Transfer(num);
59 //! To obtain a result the following method can be used:
60 //! reader.IsDone()
61 //! reader.NbShapes() and reader.Shape(num); or reader.OneShape();
62 //! To print the results of transfer use method:
63 //! reader.PrintTransferInfo(failwarn,mode); where printfail is equal to the
64 //! value of enumeration IFSelect_PrintFail, mode see above.
65 //! Gets correspondence between an IGES entity and a result shape obtained therefrom.
66 //! reader.TransientProcess();
67 //! TopoDS_Shape shape =
68 //! TransferBRep::ShapeResult(reader.TransientProcess(),ent);
69 class IGESControl_Reader  : public XSControl_Reader
70 {
71 public:
72
73   DEFINE_STANDARD_ALLOC
74
75   
76   //! Creates a Reader from scratch
77   Standard_EXPORT IGESControl_Reader();
78   
79   //! Creates a Reader from an already existing Session
80   Standard_EXPORT IGESControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
81   
82   //! Set the transion of ALL Roots (if theReadOnlyVisible is False)
83   //! or of Visible Roots (if theReadOnlyVisible is True)
84     void SetReadVisible (const Standard_Boolean ReadRoot);
85   
86     Standard_Boolean GetReadVisible() const;
87   
88   //! Returns the model as a IGESModel.
89   //! It can then be consulted (header, product)
90   Standard_EXPORT Handle(IGESData_IGESModel) IGESModel() const;
91   
92   //! Determines the list of root entities from Model which are candidate for
93   //! a transfer to a Shape (type of entities is PRODUCT)
94   //! <theReadOnlyVisible> is taken into account to define roots
95   Standard_EXPORT virtual Standard_Integer NbRootsForTransfer() Standard_OVERRIDE;
96   
97   //! Prints Statistics and check list for Transfer
98   Standard_EXPORT void PrintTransferInfo (const IFSelect_PrintFail failwarn, const IFSelect_PrintCount mode) const;
99
100
101
102
103 protected:
104
105
106
107
108
109 private:
110
111
112
113   Standard_Boolean theReadOnlyVisible;
114
115
116 };
117
118
119 #include <IGESControl_Reader.lxx>
120
121
122
123
124
125 #endif // _IGESControl_Reader_HeaderFile