1 // Created on: 2018/03/21
2 // Created by: Eugeny MALTCHIKOV
3 // Copyright (c) 2018 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <BRepTest_Objects.hxx>
18 //=======================================================================
19 //function : BRepTest_Session
20 //purpose : Class for the objects in the session
21 //=======================================================================
22 class BRepTest_Session
32 //! Sets the default values for the options
33 void SetDefaultValues()
35 myFillHistory = Standard_True;
38 //! Sets the History in the session
39 void SetHistory(const Handle(BRepTools_History)& theHistory)
41 myHistory = theHistory;
44 //! Add the History to the history in the session
45 void AddHistory(const Handle(BRepTools_History)& theHistory)
47 if (myHistory.IsNull())
48 myHistory = new BRepTools_History;
49 myHistory->Merge(theHistory);
52 //! Returns the history from the session
53 const Handle(BRepTools_History)& History() const
58 //! Enables/Disables the history saving
59 void SetToFillHistory(const Standard_Boolean theFillHist)
61 myFillHistory = theFillHist;
64 //! Returns the flag controlling the history saving
65 Standard_Boolean IsHistoryNeeded() const { return myFillHistory; }
69 Handle(BRepTools_History) myHistory;
70 Standard_Boolean myFillHistory;
73 //=======================================================================
74 //function : GetSession
76 //=======================================================================
77 static BRepTest_Session& GetSession()
79 static BRepTest_Session* pSession = new BRepTest_Session();
83 //=======================================================================
84 //function : SetHistory
86 //=======================================================================
87 void BRepTest_Objects::SetHistory(const Handle(BRepTools_History)& theHistory)
89 GetSession().SetHistory(theHistory);
92 //=======================================================================
93 //function : AddHistory
95 //=======================================================================
96 void BRepTest_Objects::AddHistory(const Handle(BRepTools_History)& theHistory)
98 GetSession().AddHistory(theHistory);
101 //=======================================================================
104 //=======================================================================
105 Handle(BRepTools_History) BRepTest_Objects::History()
107 return GetSession().History();
110 //=======================================================================
111 //function : SetToFillHistory
113 //=======================================================================
114 void BRepTest_Objects::SetToFillHistory(const Standard_Boolean theFillHist)
116 return GetSession().SetToFillHistory(theFillHist);
119 //=======================================================================
120 //function : IsHistoryNeeded
122 //=======================================================================
123 Standard_Boolean BRepTest_Objects::IsHistoryNeeded()
125 return GetSession().IsHistoryNeeded();