b311480e |
1 | // Created on: 1999-06-11 |
2 | // Created by: Sergey RUIN |
3 | // Copyright (c) 1999-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | #include <TDataStd_UAttribute.ixx> |
18 | #include <TDataStd.hxx> |
19 | #include <TDF_Label.hxx> |
20 | |
21 | //======================================================================= |
22 | //function : Set |
23 | //purpose : |
24 | //======================================================================= |
25 | |
26 | Handle(TDataStd_UAttribute) TDataStd_UAttribute::Set (const TDF_Label& label, const Standard_GUID& guid ) |
27 | { |
28 | Handle(TDataStd_UAttribute) A; |
29 | if (!label.FindAttribute(guid, A)) { |
30 | A = new TDataStd_UAttribute (); |
31 | A->SetID(guid); |
32 | label.AddAttribute(A); |
33 | } |
34 | return A; |
35 | } |
36 | |
37 | |
38 | //======================================================================= |
39 | //function : TDataStd_UAttribute |
40 | //purpose : |
41 | //======================================================================= |
42 | |
43 | TDataStd_UAttribute::TDataStd_UAttribute() |
44 | { |
45 | } |
46 | |
47 | //======================================================================= |
48 | //function : ID |
49 | //purpose : |
50 | //======================================================================= |
51 | |
52 | const Standard_GUID& TDataStd_UAttribute::ID() const |
53 | { return myID; } |
54 | |
55 | |
56 | //======================================================================= |
57 | //function : SetID |
58 | //purpose : |
59 | //======================================================================= |
60 | |
61 | void TDataStd_UAttribute::SetID( const Standard_GUID& guid) |
62 | { |
63 | // OCC2932 correction |
64 | if(myID == guid) return; |
65 | |
66 | Backup(); |
67 | myID = guid; |
68 | } |
69 | |
70 | |
71 | //======================================================================= |
72 | //function : NewEmpty |
73 | //purpose : |
74 | //======================================================================= |
75 | |
76 | Handle(TDF_Attribute) TDataStd_UAttribute::NewEmpty () const |
77 | { |
78 | Handle(TDataStd_UAttribute) A = new TDataStd_UAttribute(); |
79 | A->SetID(myID); |
80 | return A; |
81 | } |
82 | |
83 | //======================================================================= |
84 | //function : Restore |
85 | //purpose : |
86 | //======================================================================= |
87 | |
88 | void TDataStd_UAttribute::Restore(const Handle(TDF_Attribute)& with) |
89 | { |
90 | Handle(TDataStd_UAttribute) A = Handle(TDataStd_UAttribute)::DownCast(with); |
91 | SetID( A->ID() ); |
92 | } |
93 | |
94 | //======================================================================= |
95 | //function : Paste |
96 | //purpose : |
97 | //======================================================================= |
98 | |
99 | void TDataStd_UAttribute::Paste (const Handle(TDF_Attribute)& into, |
35e08fe8 |
100 | const Handle(TDF_RelocationTable)& /*RT*/) const |
7fd59977 |
101 | { |
102 | Handle(TDataStd_UAttribute) A = Handle(TDataStd_UAttribute)::DownCast(into); |
103 | A->SetID( myID ); |
104 | } |
105 | |
106 | //======================================================================= |
107 | //function : References |
108 | //purpose : |
109 | //======================================================================= |
110 | |
35e08fe8 |
111 | void TDataStd_UAttribute::References (const Handle(TDF_DataSet)& /*DS*/) const |
7fd59977 |
112 | { |
113 | } |
114 | |
115 | //======================================================================= |
116 | //function : Dump |
117 | //purpose : |
118 | //======================================================================= |
119 | |
120 | Standard_OStream& TDataStd_UAttribute::Dump (Standard_OStream& anOS) const |
121 | { |
122 | anOS << "UAttribute"; |
123 | TDF_Attribute::Dump(anOS); |
124 | return anOS; |
125 | } |
126 | |
127 | |