//=======================================================================
void TDocStd_Owner::SetDocument (const Handle(TDF_Data)& indata,
- const Handle(TDocStd_Document)& D)
+ const Handle(TDocStd_Document)& doc)
{
Handle(TDocStd_Owner) A;
if (!indata->Root().FindAttribute (TDocStd_Owner::GetID(), A)) {
A = new TDocStd_Owner ();
- A->SetDocument(D);
+ A->SetDocument(doc);
+ indata->Root().AddAttribute(A);
+ }
+ else {
+ throw Standard_DomainError("TDocStd_Owner::SetDocument : already called");
+ }
+}
+
+//=======================================================================
+//function : SetDocument
+//purpose :
+//=======================================================================
+
+void TDocStd_Owner::SetDocument (const Handle(TDF_Data)& indata,
+ TDocStd_Document* doc)
+{
+ Handle(TDocStd_Owner) A;
+ if (!indata->Root().FindAttribute (TDocStd_Owner::GetID(), A)) {
+ A = new TDocStd_Owner ();
+ A->SetDocument(doc);
indata->Root().AddAttribute(A);
}
else {
//purpose :
//=======================================================================
-TDocStd_Owner::TDocStd_Owner () { }
+TDocStd_Owner::TDocStd_Owner() { }
//=======================================================================
//purpose :
//=======================================================================
-void TDocStd_Owner::SetDocument(const Handle( TDocStd_Document)& D)
+void TDocStd_Owner::SetDocument (const Handle( TDocStd_Document)& document)
{
- myDocument = D;
+ myDocument = document.get();
}
+//=======================================================================
+//function : SetDocument
+//purpose :
+//=======================================================================
+
+void TDocStd_Owner::SetDocument (TDocStd_Document* document)
+{
+ myDocument = document;
+}
//=======================================================================
//function : Get
//purpose :
//=======================================================================
-Handle(TDocStd_Document) TDocStd_Owner::GetDocument () const
-{ return myDocument;
+Handle(TDocStd_Document) TDocStd_Owner::GetDocument() const
+{
+ return Handle(TDocStd_Document)(myDocument);
}
//purpose :
//=======================================================================
-const Standard_GUID& TDocStd_Owner::ID () const { return GetID(); }
+const Standard_GUID& TDocStd_Owner::ID() const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) TDocStd_Owner::NewEmpty () const
+Handle(TDF_Attribute) TDocStd_Owner::NewEmpty() const
{
Handle(TDF_Attribute) dummy;
return dummy;
//purpose :
//=======================================================================
-void TDocStd_Owner::Restore(const Handle(TDF_Attribute)&)
+void TDocStd_Owner::Restore (const Handle(TDF_Attribute)&)
{
}
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
- OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDocument.get())
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDocument)
}
Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT static void SetDocument (const Handle(TDF_Data)& indata, const Handle(TDocStd_Document)& doc);
-
+
+ Standard_EXPORT static void SetDocument (const Handle(TDF_Data)& indata, TDocStd_Document* doc);
+
//! Owner methods
//! ===============
Standard_EXPORT static Handle(TDocStd_Document) GetDocument (const Handle(TDF_Data)& ofdata);
Standard_EXPORT TDocStd_Owner();
Standard_EXPORT void SetDocument (const Handle(TDocStd_Document)& document);
-
+
+ Standard_EXPORT void SetDocument (TDocStd_Document* document);
+
Standard_EXPORT Handle(TDocStd_Document) GetDocument() const;
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
private:
-
- Handle(TDocStd_Document) myDocument;
+ //! It keeps pointer to the document to avoid handles cyclic dependency
+ TDocStd_Document* myDocument;
};