1 // Created on: 1999-06-17
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <MDataStd_TreeNodeStorageDriver.ixx>
19 #include <TDataStd_TreeNode.hxx>
20 #include <PDataStd_TreeNode.hxx>
21 #include <Standard_NoSuchObject.hxx>
22 #include <CDM_MessageDriver.hxx>
24 MDataStd_TreeNodeStorageDriver::MDataStd_TreeNodeStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver)
27 Standard_Integer MDataStd_TreeNodeStorageDriver::VersionNumber() const
30 Handle(Standard_Type) MDataStd_TreeNodeStorageDriver::SourceType() const
31 { return STANDARD_TYPE(TDataStd_TreeNode); }
33 Handle(PDF_Attribute) MDataStd_TreeNodeStorageDriver::NewEmpty() const
34 { return new PDataStd_TreeNode(); }
36 void MDataStd_TreeNodeStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
37 const Handle(PDF_Attribute)& Target,
38 const Handle(MDF_SRelocationTable)& RelocTable) const
40 Handle(TDataStd_TreeNode) S = Handle(TDataStd_TreeNode)::DownCast (Source);
41 Handle(PDataStd_TreeNode) T = Handle(PDataStd_TreeNode)::DownCast (Target);
43 Handle (PDataStd_TreeNode) TF;
44 // Only stores myFirst , myNext
45 // When retrieving the function
46 // myFirst is appended to me and the next of myFirst and subsequently the next of the next
47 // are appended to me.
49 Handle (TDataStd_TreeNode) F = S->First();
51 if (!RelocTable->HasRelocation(F, TF)) {
52 Standard_NoSuchObject::Raise("MDataStd_TreeNodeStorageDriver::Paste");
59 if (!RelocTable->HasRelocation(F, TF)) {
60 Standard_NoSuchObject::Raise("MDataStd_TreeNodeStorageDriver::Paste");
64 T->SetTreeID(S->ID());