0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / XSControl / XSControl_Writer.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14//:i1 gka 03.04.99 BUC60301
15
16#include <XSControl_Writer.ixx>
17#include <XSControl_Controller.hxx>
18#include <XSControl_TransferWriter.hxx>
19#include <Interface_InterfaceModel.hxx>
20#include <Interface_Macros.hxx>
21
22
b311480e 23XSControl_Writer::XSControl_Writer ()
7fd59977 24{
25 SetWS (new XSControl_WorkSession);
26}
27
28 XSControl_Writer::XSControl_Writer (const Standard_CString norm)
29{
30 SetNorm (norm);
31}
32
33 XSControl_Writer::XSControl_Writer
34 (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
35{
36 SetWS (WS,scratch);
37}
38
39 Standard_Boolean XSControl_Writer::SetNorm (const Standard_CString norm)
40{
41 if (thesession.IsNull()) SetWS (new XSControl_WorkSession);
42 Standard_Boolean sess = thesession->SelectNorm (norm);
43 Handle(Interface_InterfaceModel) model = Model (); //:i1 gka 03.04.99 BUC60301
44 return sess;
45}
46
47 void XSControl_Writer::SetWS
48 (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
49{
50 thesession = WS;
51// Un controller doit etre defini ...
52 thesession->InitTransferReader(0);
53 Handle(Interface_InterfaceModel) model = Model (scratch);
54}
55
56 Handle(XSControl_WorkSession) XSControl_Writer::WS () const
57 { return thesession; }
58
59 Handle(Interface_InterfaceModel) XSControl_Writer::Model
60 (const Standard_Boolean newone)
61{
62 Handle(Interface_InterfaceModel) model = thesession->Model();
63 if (newone || model.IsNull()) model = thesession->NewModel();
64 return model;
65}
66
67 IFSelect_ReturnStatus XSControl_Writer::TransferShape
68 (const TopoDS_Shape& sh, const Standard_Integer mode)
69{
70 thesession->SetModeWriteShape (mode);
71 return thesession->TransferWriteShape (sh);
72}
73
74 IFSelect_ReturnStatus XSControl_Writer::WriteFile
75 (const Standard_CString filename)
76 { return thesession->SendAll(filename); }
77
78 void XSControl_Writer::PrintStatsTransfer
79 (const Standard_Integer what, const Standard_Integer mode) const
80 { thesession->TransferWriter()->PrintStats (what,mode); }