b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | #include <XCAFDoc_Datum.ixx> |
19 | |
20 | #include <TDF_RelocationTable.hxx> |
21 | |
22 | |
23 | //======================================================================= |
24 | //function : XCAFDoc_Datum |
25 | //purpose : |
26 | //======================================================================= |
27 | |
28 | XCAFDoc_Datum::XCAFDoc_Datum() |
29 | { |
30 | } |
31 | |
32 | |
33 | //======================================================================= |
34 | //function : GetID |
35 | //purpose : |
36 | //======================================================================= |
37 | |
38 | const Standard_GUID& XCAFDoc_Datum::GetID() |
39 | { |
40 | static Standard_GUID DID("58ed092e-44de-11d8-8776-001083004c77"); |
41 | //static Standard_GUID ID("efd212e2-6dfd-11d4-b9c8-0060b0ee281b"); |
42 | return DID; |
43 | //return ID; |
44 | } |
45 | |
46 | |
47 | //======================================================================= |
48 | //function : Set |
49 | //purpose : |
50 | //======================================================================= |
51 | |
52 | Handle(XCAFDoc_Datum) XCAFDoc_Datum::Set(const TDF_Label& label, |
53 | const Handle(TCollection_HAsciiString)& aName, |
54 | const Handle(TCollection_HAsciiString)& aDescription, |
55 | const Handle(TCollection_HAsciiString)& anIdentification) |
56 | { |
57 | Handle(XCAFDoc_Datum) A; |
58 | if (!label.FindAttribute(XCAFDoc_Datum::GetID(), A)) { |
59 | A = new XCAFDoc_Datum(); |
60 | label.AddAttribute(A); |
61 | } |
62 | A->Set(aName,aDescription,anIdentification); |
63 | return A; |
64 | } |
65 | |
66 | |
67 | //======================================================================= |
68 | //function : Set |
69 | //purpose : |
70 | //======================================================================= |
71 | |
72 | void XCAFDoc_Datum::Set(const Handle(TCollection_HAsciiString)& aName, |
73 | const Handle(TCollection_HAsciiString)& aDescription, |
74 | const Handle(TCollection_HAsciiString)& anIdentification) |
75 | { |
76 | myName = aName; |
77 | myDescription = aDescription; |
78 | myIdentification = anIdentification; |
79 | } |
80 | |
81 | |
82 | //======================================================================= |
83 | //function : GetName |
84 | //purpose : |
85 | //======================================================================= |
86 | |
87 | Handle(TCollection_HAsciiString) XCAFDoc_Datum::GetName() const |
88 | { |
89 | return myName; |
90 | } |
91 | |
92 | |
93 | //======================================================================= |
94 | //function : GetDescription |
95 | //purpose : |
96 | //======================================================================= |
97 | |
98 | Handle(TCollection_HAsciiString) XCAFDoc_Datum::GetDescription() const |
99 | { |
100 | return myDescription; |
101 | } |
102 | |
103 | |
104 | //======================================================================= |
105 | //function : GetIdentification |
106 | //purpose : |
107 | //======================================================================= |
108 | |
109 | Handle(TCollection_HAsciiString) XCAFDoc_Datum::GetIdentification() const |
110 | { |
111 | return myIdentification; |
112 | } |
113 | |
114 | |
115 | //======================================================================= |
116 | //function : ID |
117 | //purpose : |
118 | //======================================================================= |
119 | |
120 | const Standard_GUID& XCAFDoc_Datum::ID() const |
121 | { |
122 | return GetID(); |
123 | } |
124 | |
125 | |
126 | //======================================================================= |
127 | //function : Restore |
128 | //purpose : |
129 | //======================================================================= |
130 | |
131 | void XCAFDoc_Datum::Restore(const Handle(TDF_Attribute)& With) |
132 | { |
133 | myName = Handle(XCAFDoc_Datum)::DownCast(With)->GetName(); |
134 | myDescription = Handle(XCAFDoc_Datum)::DownCast(With)->GetDescription(); |
135 | myIdentification = Handle(XCAFDoc_Datum)::DownCast(With)->GetIdentification(); |
136 | } |
137 | |
138 | |
139 | //======================================================================= |
140 | //function : NewEmpty |
141 | //purpose : |
142 | //======================================================================= |
143 | |
144 | Handle(TDF_Attribute) XCAFDoc_Datum::NewEmpty() const |
145 | { |
146 | return new XCAFDoc_Datum(); |
147 | } |
148 | |
149 | |
150 | //======================================================================= |
151 | //function : Paste |
152 | //purpose : |
153 | //======================================================================= |
154 | |
155 | void XCAFDoc_Datum::Paste(const Handle(TDF_Attribute)& Into, |
156 | const Handle(TDF_RelocationTable)& /*RT*/) const |
157 | { |
158 | Handle(XCAFDoc_Datum)::DownCast(Into)->Set(myName,myDescription,myIdentification); |
159 | } |
160 | |