1 // Created on: 1999-07-12
2 // Created by: Denis PASCAL
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.
17 #include <TDocStd_Modified.hxx>
19 #include <Standard_DomainError.hxx>
20 #include <Standard_GUID.hxx>
21 #include <Standard_Type.hxx>
22 #include <TDF_Attribute.hxx>
23 #include <TDF_Data.hxx>
24 #include <TDF_Label.hxx>
25 #include <TDF_RelocationTable.hxx>
27 IMPLEMENT_STANDARD_RTTIEXT(TDocStd_Modified,TDF_Attribute)
29 //=======================================================================
32 //=======================================================================
33 Standard_Boolean TDocStd_Modified::IsEmpty(const TDF_Label& access)
35 Handle(TDocStd_Modified) MDF;
36 if (!access.Root().FindAttribute (TDocStd_Modified::GetID(), MDF)) {
39 else return MDF->IsEmpty();
42 //=======================================================================
45 //=======================================================================
47 Standard_Boolean TDocStd_Modified::Add(const TDF_Label& alabel)
49 Handle(TDocStd_Modified) MDF;
50 if (!alabel.Root().FindAttribute (TDocStd_Modified::GetID(), MDF)) {
51 MDF = new TDocStd_Modified();
52 alabel.Root().AddAttribute(MDF);
54 return MDF->AddLabel (alabel);
57 //=======================================================================
60 //=======================================================================
62 Standard_Boolean TDocStd_Modified::Remove(const TDF_Label& alabel)
64 Handle(TDocStd_Modified) MDF;
65 if (!alabel.Root().FindAttribute (TDocStd_Modified::GetID(), MDF)) {
68 else return MDF->RemoveLabel (alabel);
71 //=======================================================================
74 //=======================================================================
76 Standard_Boolean TDocStd_Modified::Contains (const TDF_Label& alabel)
78 Handle(TDocStd_Modified) MDF;
79 if (!alabel.Root().FindAttribute (TDocStd_Modified::GetID(), MDF)) {
80 return Standard_False;
82 return (MDF->Get().Contains(alabel));
85 //=======================================================================
88 //=======================================================================
90 const TDF_LabelMap& TDocStd_Modified::Get (const TDF_Label& access)
92 Handle(TDocStd_Modified) MDF;
93 if (!access.Root().FindAttribute (TDocStd_Modified::GetID(), MDF)) {
94 throw Standard_DomainError("TDocStd_Modified::Get : IsEmpty");
99 //=======================================================================
102 //=======================================================================
104 void TDocStd_Modified::Clear (const TDF_Label& access)
106 Handle(TDocStd_Modified) MDF;
107 if (!access.Root().FindAttribute (TDocStd_Modified::GetID(), MDF)) {
113 //=======================================================================
116 //=======================================================================
118 const Standard_GUID& TDocStd_Modified::GetID()
120 static Standard_GUID TDocStd_ModifiedID ("2a96b622-ec8b-11d0-bee7-080009dc3333");
121 return TDocStd_ModifiedID;
125 //=======================================================================
126 //function : TDocStd_Modified
128 //=======================================================================
130 TDocStd_Modified::TDocStd_Modified () { }
133 //=======================================================================
134 //function : AddLabel
136 //=======================================================================
138 Standard_Boolean TDocStd_Modified::AddLabel (const TDF_Label& L)
141 return myModified.Add(L);
145 //=======================================================================
146 //function : RemoveLabel
148 //=======================================================================
150 Standard_Boolean TDocStd_Modified::RemoveLabel (const TDF_Label& L)
153 return myModified.Remove(L);
156 //=======================================================================
159 //=======================================================================
161 Standard_Boolean TDocStd_Modified::IsEmpty () const
163 return myModified.IsEmpty();
167 //=======================================================================
170 //=======================================================================
172 void TDocStd_Modified::Clear ()
178 //=======================================================================
181 //=======================================================================
183 const TDF_LabelMap& TDocStd_Modified::Get () const
189 //=======================================================================
192 //=======================================================================
194 const Standard_GUID& TDocStd_Modified::ID () const { return GetID(); }
197 //=======================================================================
198 //function : NewEmpty
200 //=======================================================================
202 Handle(TDF_Attribute) TDocStd_Modified::NewEmpty () const
204 return new TDocStd_Modified ();
207 //=======================================================================
210 //=======================================================================
212 void TDocStd_Modified::Restore(const Handle(TDF_Attribute)& With) {
213 Handle(TDocStd_Modified) MDF = Handle(TDocStd_Modified)::DownCast(With);
214 myModified = MDF->myModified;
217 //=======================================================================
220 //=======================================================================
222 void TDocStd_Modified::Paste (const Handle(TDF_Attribute)&,
223 const Handle(TDF_RelocationTable)&) const
227 //=======================================================================
230 //=======================================================================
232 Standard_OStream& TDocStd_Modified::Dump (Standard_OStream& anOS) const