0025748: Parallel version of progress indicator
[occt.git] / src / XSControl / XSControl_Writer.hxx
1 // Created on: 1997-05-14
2 // Created by: Christian CAILLET
3 // Copyright (c) 1997-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_Writer_HeaderFile
18 #define _XSControl_Writer_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_CString.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <IFSelect_ReturnStatus.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Message_ProgressRange.hxx>
29
30 class XSControl_WorkSession;
31 class Interface_InterfaceModel;
32 class TopoDS_Shape;
33
34 //! This class gives a simple way to create then write a
35 //! Model compliant to a given norm, from a Shape
36 //! The model can then be edited by tools by other appropriate tools
37 class XSControl_Writer 
38 {
39 public:
40
41   DEFINE_STANDARD_ALLOC
42
43   
44   //! Creates a Writer from scratch
45   Standard_EXPORT XSControl_Writer();
46   
47   //! Creates a Writer from scratch, with a norm name which
48   //! identifie a Controller
49   Standard_EXPORT XSControl_Writer(const Standard_CString norm);
50   
51   //! Creates a Writer from an already existing Session
52   //! If <scratch> is True (D), clears already recorded data
53   Standard_EXPORT XSControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
54   
55   //! Sets a specific norm to <me>
56   //! Returns True if done, False if <norm> is not available
57   Standard_EXPORT Standard_Boolean SetNorm (const Standard_CString norm);
58   
59   //! Sets a specific session to <me>
60   Standard_EXPORT void SetWS (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
61   
62   //! Returns the session used in <me>
63   Standard_EXPORT Handle(XSControl_WorkSession) WS() const;
64   
65   //! Returns the produced model. Produces a new one if not yet done
66   //! or if <newone> is True
67   //! This method allows for instance to edit product or header
68   //! data before writing
69   Standard_EXPORT Handle(Interface_InterfaceModel) Model (const Standard_Boolean newone = Standard_False);
70   
71   //! Transfers a Shape according to the mode
72   Standard_EXPORT IFSelect_ReturnStatus TransferShape (const TopoDS_Shape& sh,
73                                                        const Standard_Integer mode = 0,
74                                                        const Message_ProgressRange& theProgress = Message_ProgressRange());
75   
76   //! Writes the produced model
77   Standard_EXPORT IFSelect_ReturnStatus WriteFile (const Standard_CString filename);
78   
79   //! Prints Statistics about Transfer
80   Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const;
81
82
83
84
85 protected:
86
87
88
89
90
91 private:
92
93
94
95   Handle(XSControl_WorkSession) thesession;
96
97
98 };
99
100
101
102
103
104
105
106 #endif // _XSControl_Writer_HeaderFile