1 // Created on: 1999-07-20
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Standard_OStream.hxx>
19 #include <TCollection_AsciiString.hxx>
20 #include <TDF_ChildIterator.hxx>
21 #include <TDF_Label.hxx>
22 #include <TDF_LabelMap.hxx>
23 #include <TDF_MapIteratorOfLabelMap.hxx>
24 #include <TDF_Tool.hxx>
25 #include <TFunction_Logbook.hxx>
27 //=======================================================================
28 //function : TFunction_Logbook
29 //purpose : A Logbook creation
30 //=======================================================================
31 TFunction_Logbook::TFunction_Logbook():isDone(Standard_False)
34 //=======================================================================
36 //purpose : Clears the valid and modified labels
37 //=======================================================================
39 void TFunction_Logbook::Clear()
46 //=======================================================================
48 //purpose : Returns Standard_True if the nothing is reccorded in the logbook
49 //=======================================================================
51 Standard_Boolean TFunction_Logbook::IsEmpty () const
53 return (myTouched.IsEmpty() && myImpacted.IsEmpty() && myValid.IsEmpty());
56 //=======================================================================
57 //function : IsModified
58 //purpose : Returns Standard_True if the label is modified
59 //=======================================================================
61 Standard_Boolean TFunction_Logbook::IsModified(const TDF_Label& L,
62 const Standard_Boolean WithChildren) const
64 if (myTouched.Contains(L)) return Standard_True;
65 if (myImpacted.Contains(L)) return Standard_True;
67 TDF_ChildIterator itr(L);
68 for (; itr.More(); itr.Next())
69 if (IsModified(itr.Value(), Standard_True))
72 return Standard_False;
75 //=======================================================================
78 //=======================================================================
80 void TFunction_Logbook::SetValid(const TDF_Label& L,
81 const Standard_Boolean WithChildren)
85 TDF_ChildIterator itr(L, Standard_True);
86 for (; itr.More(); itr.Next()) {
87 myValid.Add(itr.Value());
92 //=======================================================================
93 //function : SetImpacted
95 //=======================================================================
97 void TFunction_Logbook::SetImpacted(const TDF_Label& L,
98 const Standard_Boolean WithChildren)
102 TDF_ChildIterator itr(L, Standard_True);
103 for (; itr.More(); itr.Next()) {
104 myImpacted.Add(itr.Value());
109 //=======================================================================
111 //purpose : Dump of modifications
112 //=======================================================================
114 Standard_OStream& TFunction_Logbook::Dump(Standard_OStream& stream) const
116 TDF_MapIteratorOfLabelMap itr;
117 TCollection_AsciiString as;
119 stream<<"Done = "<<isDone<<endl;
120 stream<<"Touched labels: "<<endl;
121 for (itr.Initialize(myTouched); itr.More(); itr.Next()) {
122 TDF_Tool::Entry(itr.Key(), as);
125 stream<<"Impacted labels: "<<endl;
126 for (itr.Initialize(myImpacted); itr.More(); itr.Next()) {
127 TDF_Tool::Entry(itr.Key(), as);
130 stream<<"Valid labels: "<<endl;
131 for (itr.Initialize(myValid); itr.More(); itr.Next()) {
132 TDF_Tool::Entry(itr.Key(), as);