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 | |
42cf5bc1 |
17 | |
18 | #include <Standard_GUID.hxx> |
19 | #include <Standard_Type.hxx> |
7fd59977 |
20 | #include <TDataStd.hxx> |
42cf5bc1 |
21 | #include <TDataStd_UAttribute.hxx> |
22 | #include <TDF_Attribute.hxx> |
23 | #include <TDF_DataSet.hxx> |
7fd59977 |
24 | #include <TDF_Label.hxx> |
42cf5bc1 |
25 | #include <TDF_RelocationTable.hxx> |
7fd59977 |
26 | |
27 | //======================================================================= |
28 | //function : Set |
29 | //purpose : |
30 | //======================================================================= |
7fd59977 |
31 | Handle(TDataStd_UAttribute) TDataStd_UAttribute::Set (const TDF_Label& label, const Standard_GUID& guid ) |
32 | { |
33 | Handle(TDataStd_UAttribute) A; |
34 | if (!label.FindAttribute(guid, A)) { |
35 | A = new TDataStd_UAttribute (); |
36 | A->SetID(guid); |
37 | label.AddAttribute(A); |
38 | } |
39 | return A; |
40 | } |
41 | |
42 | |
43 | //======================================================================= |
44 | //function : TDataStd_UAttribute |
45 | //purpose : |
46 | //======================================================================= |
47 | |
48 | TDataStd_UAttribute::TDataStd_UAttribute() |
49 | { |
50 | } |
51 | |
52 | //======================================================================= |
53 | //function : ID |
54 | //purpose : |
55 | //======================================================================= |
56 | |
57 | const Standard_GUID& TDataStd_UAttribute::ID() const |
58 | { return myID; } |
59 | |
60 | |
61 | //======================================================================= |
62 | //function : SetID |
63 | //purpose : |
64 | //======================================================================= |
65 | |
66 | void TDataStd_UAttribute::SetID( const Standard_GUID& guid) |
67 | { |
68 | // OCC2932 correction |
69 | if(myID == guid) return; |
70 | |
71 | Backup(); |
72 | myID = guid; |
73 | } |
74 | |
75 | |
76 | //======================================================================= |
77 | //function : NewEmpty |
78 | //purpose : |
79 | //======================================================================= |
80 | |
81 | Handle(TDF_Attribute) TDataStd_UAttribute::NewEmpty () const |
82 | { |
83 | Handle(TDataStd_UAttribute) A = new TDataStd_UAttribute(); |
84 | A->SetID(myID); |
85 | return A; |
86 | } |
87 | |
88 | //======================================================================= |
89 | //function : Restore |
90 | //purpose : |
91 | //======================================================================= |
92 | |
93 | void TDataStd_UAttribute::Restore(const Handle(TDF_Attribute)& with) |
94 | { |
95 | Handle(TDataStd_UAttribute) A = Handle(TDataStd_UAttribute)::DownCast(with); |
96 | SetID( A->ID() ); |
97 | } |
98 | |
99 | //======================================================================= |
100 | //function : Paste |
101 | //purpose : |
102 | //======================================================================= |
103 | |
104 | void TDataStd_UAttribute::Paste (const Handle(TDF_Attribute)& into, |
35e08fe8 |
105 | const Handle(TDF_RelocationTable)& /*RT*/) const |
7fd59977 |
106 | { |
107 | Handle(TDataStd_UAttribute) A = Handle(TDataStd_UAttribute)::DownCast(into); |
108 | A->SetID( myID ); |
109 | } |
110 | |
111 | //======================================================================= |
112 | //function : References |
113 | //purpose : |
114 | //======================================================================= |
115 | |
35e08fe8 |
116 | void TDataStd_UAttribute::References (const Handle(TDF_DataSet)& /*DS*/) const |
7fd59977 |
117 | { |
118 | } |
119 | |
120 | //======================================================================= |
121 | //function : Dump |
122 | //purpose : |
123 | //======================================================================= |
124 | |
125 | Standard_OStream& TDataStd_UAttribute::Dump (Standard_OStream& anOS) const |
126 | { |
127 | anOS << "UAttribute"; |
128 | TDF_Attribute::Dump(anOS); |
129 | return anOS; |
130 | } |
131 | |
132 | |