1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <MDF_ReferenceRetrievalDriver.ixx>
15 #include <PCollection_HAsciiString.hxx>
16 #include <PDF_Reference.hxx>
17 #include <Standard_NoSuchObject.hxx>
18 #include <TCollection_AsciiString.hxx>
19 #include <TDF_Label.hxx>
20 #include <TDF_Tool.hxx>
21 #include <TDF_Reference.hxx>
22 #include <CDM_MessageDriver.hxx>
24 #define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = *((Handle(T)*)& V)
25 #define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V
26 #define SpeedCast(V,T,Vdown) Vdown = *((Handle(T)*)& V)
28 MDF_ReferenceRetrievalDriver::MDF_ReferenceRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
32 Standard_Integer MDF_ReferenceRetrievalDriver::VersionNumber() const
35 Handle(Standard_Type) MDF_ReferenceRetrievalDriver::SourceType() const
36 { return STANDARD_TYPE (PDF_Reference); }
38 Handle(TDF_Attribute) MDF_ReferenceRetrievalDriver::NewEmpty() const
39 { return new TDF_Reference; }
41 void MDF_ReferenceRetrievalDriver::Paste (
42 const Handle(PDF_Attribute)& Source,
43 const Handle(TDF_Attribute)& Target,
44 // const Handle(MDF_RRelocationTable)& RelocTable) const
45 const Handle(MDF_RRelocationTable)& ) const
48 DeclareAndSpeedCast(Source,PDF_Reference,S);
49 DeclareAndSpeedCast(Target,TDF_Reference,T);
50 TDF_Label tLab; // Null label.
51 Handle(PCollection_HAsciiString) pEntry = S->ReferencedLabel();
52 if (!pEntry.IsNull()) {
53 TCollection_AsciiString entry = pEntry->Convert();
54 TDF_Tool::Label(T->Label().Data(),entry,tLab,Standard_True);