973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
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> |
23 | |
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) |
27 | |
28 | MDF_ReferenceRetrievalDriver::MDF_ReferenceRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver) |
29 | { |
30 | } |
31 | |
32 | Standard_Integer MDF_ReferenceRetrievalDriver::VersionNumber() const |
33 | { return 0; } |
34 | |
35 | Handle(Standard_Type) MDF_ReferenceRetrievalDriver::SourceType() const |
36 | { return STANDARD_TYPE (PDF_Reference); } |
37 | |
38 | Handle(TDF_Attribute) MDF_ReferenceRetrievalDriver::NewEmpty() const |
39 | { return new TDF_Reference; } |
40 | |
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 |
46 | |
47 | { |
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); |
55 | } |
56 | T->Set(tLab); |
57 | } |
58 | |