0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / TDocStd / TDocStd_Owner.cxx
CommitLineData
b311480e 1// Created on: 1999-07-12
2// Created by: Denis PASCAL
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 <TDocStd_Owner.ixx>
18
19//=======================================================================
20//function : GetID
21//purpose :
22//=======================================================================
23
24const Standard_GUID& TDocStd_Owner::GetID()
25{
26 static Standard_GUID TDocStd_OwnerID ("2a96b617-ec8b-11d0-bee7-080009dc3333");
27 return TDocStd_OwnerID;
28}
29
30
31//=======================================================================
32//function : SetDocument
33//purpose :
34//=======================================================================
35
36void TDocStd_Owner::SetDocument (const Handle(TDF_Data)& indata,
37 const Handle(TDocStd_Document)& D)
38{
39 Handle(TDocStd_Owner) A;
40 if (!indata->Root().FindAttribute (TDocStd_Owner::GetID(), A)) {
41 A = new TDocStd_Owner ();
42 A->SetDocument(D);
43 indata->Root().AddAttribute(A);
44 }
45 else {
46 Standard_DomainError::Raise("TDocStd_Owner::SetDocument : already called");
47 }
48}
49
50//=======================================================================
51//function : GetDocument
52//purpose :
53//=======================================================================
54
55Handle(TDocStd_Document) TDocStd_Owner::GetDocument (const Handle(TDF_Data)& ofdata)
56{
57 Handle(TDocStd_Owner) A;
58 if (!ofdata->Root().FindAttribute (TDocStd_Owner::GetID(), A)) {
59 Standard_DomainError::Raise("TDocStd_Owner::GetDocument : document not found");
60 }
61 return A->GetDocument();
62}
63
64//=======================================================================
65//function : TDocStd_Owner
66//purpose :
67//=======================================================================
68
69TDocStd_Owner::TDocStd_Owner () { }
70
71
72//=======================================================================
73//function : SetDocument
74//purpose :
75//=======================================================================
76
77void TDocStd_Owner::SetDocument(const Handle( TDocStd_Document)& D)
78{
79 myDocument = D;
80}
81
82
83//=======================================================================
84//function : Get
85//purpose :
86//=======================================================================
87
88Handle(TDocStd_Document) TDocStd_Owner::GetDocument () const
89{ return myDocument;
90}
91
92
93//=======================================================================
94//function : ID
95//purpose :
96//=======================================================================
97
98const Standard_GUID& TDocStd_Owner::ID () const { return GetID(); }
99
100
101//=======================================================================
102//function : NewEmpty
103//purpose :
104//=======================================================================
105
106Handle(TDF_Attribute) TDocStd_Owner::NewEmpty () const
107{
108 Handle(TDF_Attribute) dummy;
109 return dummy;
110}
111
112//=======================================================================
113//function : Restore
114//purpose :
115//=======================================================================
116
35e08fe8 117void TDocStd_Owner::Restore(const Handle(TDF_Attribute)&)
7fd59977 118{
119}
120
121//=======================================================================
122//function : Paste
123//purpose :
124//=======================================================================
125
35e08fe8 126void TDocStd_Owner::Paste (const Handle(TDF_Attribute)&,
127 const Handle(TDF_RelocationTable)&) const
7fd59977 128{
129}
130
131//=======================================================================
132//function : Dump
133//purpose :
134//=======================================================================
135
136Standard_OStream& TDocStd_Owner::Dump (Standard_OStream& anOS) const
137{
138 anOS << "Owner";
139 return anOS;
140}
141