b311480e |
1 | // Created on: 1999-07-12 |
2 | // Created by: Denis PASCAL |
3 | // Copyright (c) 1999-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #include <TDocStd_Owner.ixx> |
24 | |
25 | //======================================================================= |
26 | //function : GetID |
27 | //purpose : |
28 | //======================================================================= |
29 | |
30 | const Standard_GUID& TDocStd_Owner::GetID() |
31 | { |
32 | static Standard_GUID TDocStd_OwnerID ("2a96b617-ec8b-11d0-bee7-080009dc3333"); |
33 | return TDocStd_OwnerID; |
34 | } |
35 | |
36 | |
37 | //======================================================================= |
38 | //function : SetDocument |
39 | //purpose : |
40 | //======================================================================= |
41 | |
42 | void TDocStd_Owner::SetDocument (const Handle(TDF_Data)& indata, |
43 | const Handle(TDocStd_Document)& D) |
44 | { |
45 | Handle(TDocStd_Owner) A; |
46 | if (!indata->Root().FindAttribute (TDocStd_Owner::GetID(), A)) { |
47 | A = new TDocStd_Owner (); |
48 | A->SetDocument(D); |
49 | indata->Root().AddAttribute(A); |
50 | } |
51 | else { |
52 | Standard_DomainError::Raise("TDocStd_Owner::SetDocument : already called"); |
53 | } |
54 | } |
55 | |
56 | //======================================================================= |
57 | //function : GetDocument |
58 | //purpose : |
59 | //======================================================================= |
60 | |
61 | Handle(TDocStd_Document) TDocStd_Owner::GetDocument (const Handle(TDF_Data)& ofdata) |
62 | { |
63 | Handle(TDocStd_Owner) A; |
64 | if (!ofdata->Root().FindAttribute (TDocStd_Owner::GetID(), A)) { |
65 | Standard_DomainError::Raise("TDocStd_Owner::GetDocument : document not found"); |
66 | } |
67 | return A->GetDocument(); |
68 | } |
69 | |
70 | //======================================================================= |
71 | //function : TDocStd_Owner |
72 | //purpose : |
73 | //======================================================================= |
74 | |
75 | TDocStd_Owner::TDocStd_Owner () { } |
76 | |
77 | |
78 | //======================================================================= |
79 | //function : SetDocument |
80 | //purpose : |
81 | //======================================================================= |
82 | |
83 | void TDocStd_Owner::SetDocument(const Handle( TDocStd_Document)& D) |
84 | { |
85 | myDocument = D; |
86 | } |
87 | |
88 | |
89 | //======================================================================= |
90 | //function : Get |
91 | //purpose : |
92 | //======================================================================= |
93 | |
94 | Handle(TDocStd_Document) TDocStd_Owner::GetDocument () const |
95 | { return myDocument; |
96 | } |
97 | |
98 | |
99 | //======================================================================= |
100 | //function : ID |
101 | //purpose : |
102 | //======================================================================= |
103 | |
104 | const Standard_GUID& TDocStd_Owner::ID () const { return GetID(); } |
105 | |
106 | |
107 | //======================================================================= |
108 | //function : NewEmpty |
109 | //purpose : |
110 | //======================================================================= |
111 | |
112 | Handle(TDF_Attribute) TDocStd_Owner::NewEmpty () const |
113 | { |
114 | Handle(TDF_Attribute) dummy; |
115 | return dummy; |
116 | } |
117 | |
118 | //======================================================================= |
119 | //function : Restore |
120 | //purpose : |
121 | //======================================================================= |
122 | |
35e08fe8 |
123 | void TDocStd_Owner::Restore(const Handle(TDF_Attribute)&) |
7fd59977 |
124 | { |
125 | } |
126 | |
127 | //======================================================================= |
128 | //function : Paste |
129 | //purpose : |
130 | //======================================================================= |
131 | |
35e08fe8 |
132 | void TDocStd_Owner::Paste (const Handle(TDF_Attribute)&, |
133 | const Handle(TDF_RelocationTable)&) const |
7fd59977 |
134 | { |
135 | } |
136 | |
137 | //======================================================================= |
138 | //function : Dump |
139 | //purpose : |
140 | //======================================================================= |
141 | |
142 | Standard_OStream& TDocStd_Owner::Dump (Standard_OStream& anOS) const |
143 | { |
144 | anOS << "Owner"; |
145 | return anOS; |
146 | } |
147 | |