1 // Created on: 1999-07-20
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <TFunction_Logbook.ixx>
25 #include <TDF_Tool.hxx>
26 #include <TDF_Label.hxx>
27 #include <TDF_LabelMap.hxx>
28 #include <TDF_MapIteratorOfLabelMap.hxx>
29 #include <TDF_ChildIterator.hxx>
31 #include <TCollection_AsciiString.hxx>
33 #include <Standard_OStream.hxx>
36 //=======================================================================
37 //function : TFunction_Logbook
38 //purpose : A Logbook creation
39 //=======================================================================
41 TFunction_Logbook::TFunction_Logbook():isDone(Standard_False)
44 //=======================================================================
46 //purpose : Clears the valid and modified labels
47 //=======================================================================
49 void TFunction_Logbook::Clear()
56 //=======================================================================
58 //purpose : Returns Standard_True if the nothing is reccorded in the logbook
59 //=======================================================================
61 Standard_Boolean TFunction_Logbook::IsEmpty () const
63 return (myTouched.IsEmpty() && myImpacted.IsEmpty() && myValid.IsEmpty());
66 //=======================================================================
67 //function : IsModified
68 //purpose : Returns Standard_True if the label is modified
69 //=======================================================================
71 Standard_Boolean TFunction_Logbook::IsModified(const TDF_Label& L,
72 const Standard_Boolean WithChildren) const
74 if (myTouched.Contains(L)) return Standard_True;
75 if (myImpacted.Contains(L)) return Standard_True;
77 TDF_ChildIterator itr(L);
78 for (; itr.More(); itr.Next())
79 if (IsModified(itr.Value(), Standard_True))
82 return Standard_False;
85 //=======================================================================
88 //=======================================================================
90 void TFunction_Logbook::SetValid(const TDF_Label& L,
91 const Standard_Boolean WithChildren)
95 TDF_ChildIterator itr(L, Standard_True);
96 for (; itr.More(); itr.Next()) {
97 myValid.Add(itr.Value());
102 //=======================================================================
103 //function : SetImpacted
105 //=======================================================================
107 void TFunction_Logbook::SetImpacted(const TDF_Label& L,
108 const Standard_Boolean WithChildren)
112 TDF_ChildIterator itr(L, Standard_True);
113 for (; itr.More(); itr.Next()) {
114 myImpacted.Add(itr.Value());
119 //=======================================================================
121 //purpose : Dump of modifications
122 //=======================================================================
124 Standard_OStream& TFunction_Logbook::Dump(Standard_OStream& stream) const
126 TDF_MapIteratorOfLabelMap itr;
127 TCollection_AsciiString as;
129 stream<<"Done = "<<isDone<<endl;
130 stream<<"Touched labels: "<<endl;
131 for (itr.Initialize(myTouched); itr.More(); itr.Next()) {
132 TDF_Tool::Entry(itr.Key(), as);
135 stream<<"Impacted labels: "<<endl;
136 for (itr.Initialize(myImpacted); itr.More(); itr.Next()) {
137 TDF_Tool::Entry(itr.Key(), as);
140 stream<<"Valid labels: "<<endl;
141 for (itr.Initialize(myValid); itr.More(); itr.Next()) {
142 TDF_Tool::Entry(itr.Key(), as);