7fd59977 |
1 | // File: TDataStd_UAttribute.cxx |
2 | // Created: Fri Jun 11 14:39:43 1999 |
3 | // Author: Sergey RUIN |
4 | // <s-ruin@nnov.matra-dtv.fr> |
5 | |
6 | |
7 | #include <TDataStd_UAttribute.ixx> |
8 | #include <TDataStd.hxx> |
9 | #include <TDF_Label.hxx> |
10 | |
11 | //======================================================================= |
12 | //function : Set |
13 | //purpose : |
14 | //======================================================================= |
15 | |
16 | Handle(TDataStd_UAttribute) TDataStd_UAttribute::Set (const TDF_Label& label, const Standard_GUID& guid ) |
17 | { |
18 | Handle(TDataStd_UAttribute) A; |
19 | if (!label.FindAttribute(guid, A)) { |
20 | A = new TDataStd_UAttribute (); |
21 | A->SetID(guid); |
22 | label.AddAttribute(A); |
23 | } |
24 | return A; |
25 | } |
26 | |
27 | |
28 | //======================================================================= |
29 | //function : TDataStd_UAttribute |
30 | //purpose : |
31 | //======================================================================= |
32 | |
33 | TDataStd_UAttribute::TDataStd_UAttribute() |
34 | { |
35 | } |
36 | |
37 | //======================================================================= |
38 | //function : ID |
39 | //purpose : |
40 | //======================================================================= |
41 | |
42 | const Standard_GUID& TDataStd_UAttribute::ID() const |
43 | { return myID; } |
44 | |
45 | |
46 | //======================================================================= |
47 | //function : SetID |
48 | //purpose : |
49 | //======================================================================= |
50 | |
51 | void TDataStd_UAttribute::SetID( const Standard_GUID& guid) |
52 | { |
53 | // OCC2932 correction |
54 | if(myID == guid) return; |
55 | |
56 | Backup(); |
57 | myID = guid; |
58 | } |
59 | |
60 | |
61 | //======================================================================= |
62 | //function : NewEmpty |
63 | //purpose : |
64 | //======================================================================= |
65 | |
66 | Handle(TDF_Attribute) TDataStd_UAttribute::NewEmpty () const |
67 | { |
68 | Handle(TDataStd_UAttribute) A = new TDataStd_UAttribute(); |
69 | A->SetID(myID); |
70 | return A; |
71 | } |
72 | |
73 | //======================================================================= |
74 | //function : Restore |
75 | //purpose : |
76 | //======================================================================= |
77 | |
78 | void TDataStd_UAttribute::Restore(const Handle(TDF_Attribute)& with) |
79 | { |
80 | Handle(TDataStd_UAttribute) A = Handle(TDataStd_UAttribute)::DownCast(with); |
81 | SetID( A->ID() ); |
82 | } |
83 | |
84 | //======================================================================= |
85 | //function : Paste |
86 | //purpose : |
87 | //======================================================================= |
88 | |
89 | void TDataStd_UAttribute::Paste (const Handle(TDF_Attribute)& into, |
90 | const Handle(TDF_RelocationTable)& RT) const |
91 | { |
92 | Handle(TDataStd_UAttribute) A = Handle(TDataStd_UAttribute)::DownCast(into); |
93 | A->SetID( myID ); |
94 | } |
95 | |
96 | //======================================================================= |
97 | //function : References |
98 | //purpose : |
99 | //======================================================================= |
100 | |
101 | void TDataStd_UAttribute::References (const Handle(TDF_DataSet)& DS) const |
102 | { |
103 | } |
104 | |
105 | //======================================================================= |
106 | //function : Dump |
107 | //purpose : |
108 | //======================================================================= |
109 | |
110 | Standard_OStream& TDataStd_UAttribute::Dump (Standard_OStream& anOS) const |
111 | { |
112 | anOS << "UAttribute"; |
113 | TDF_Attribute::Dump(anOS); |
114 | return anOS; |
115 | } |
116 | |
117 | |