1 // Created on: 2008-03-27
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 2008-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <MDataStd_ByteArrayRetrievalDriver_1.ixx>
18 #include <PDataStd_ByteArray.hxx>
19 #include <PDataStd_ByteArray_1.hxx>
20 #include <TDataStd_ByteArray.hxx>
21 #include <MDataStd.hxx>
22 #include <CDM_MessageDriver.hxx>
23 #include <TColStd_HArray1OfByte.hxx>
24 #include <PColStd_HArray1OfInteger.hxx>
26 //=======================================================================
27 //function : MDataStd_ByteArrayRetrievalDriver_1
29 //=======================================================================
30 MDataStd_ByteArrayRetrievalDriver_1::MDataStd_ByteArrayRetrievalDriver_1(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
35 //=======================================================================
36 //function : VersionNumber
38 //=======================================================================
39 Standard_Integer MDataStd_ByteArrayRetrievalDriver_1::VersionNumber() const
44 //=======================================================================
45 //function : SourceType
47 //=======================================================================
48 Handle(Standard_Type) MDataStd_ByteArrayRetrievalDriver_1::SourceType() const
50 static Handle(Standard_Type) sourceType = STANDARD_TYPE(PDataStd_ByteArray_1);
54 //=======================================================================
57 //=======================================================================
58 Handle(TDF_Attribute) MDataStd_ByteArrayRetrievalDriver_1::NewEmpty () const
60 return new TDataStd_ByteArray();
63 //=======================================================================
66 //=======================================================================
67 void MDataStd_ByteArrayRetrievalDriver_1::Paste(const Handle(PDF_Attribute)& Source,
68 const Handle(TDF_Attribute)& Target,
69 const Handle(MDF_RRelocationTable)& ) const
71 Handle(PDataStd_ByteArray_1) S = Handle(PDataStd_ByteArray_1)::DownCast (Source);
72 Handle(TDataStd_ByteArray) T = Handle(TDataStd_ByteArray)::DownCast (Target);
74 if (!S->Get().IsNull()) {
75 const Handle(PColStd_HArray1OfInteger)& pvalues = S->Get();
76 Handle(TColStd_HArray1OfByte) tvalues =
77 new TColStd_HArray1OfByte(pvalues->Lower(), pvalues->Upper());
78 Standard_Integer i = pvalues->Lower(), upper = pvalues->Upper();
79 for (; i <= upper; i++) {
80 Standard_Byte pvalue = (Standard_Byte) pvalues->Value(i);
81 tvalues->SetValue(i, pvalue);
83 T->ChangeArray(tvalues, Standard_False);
84 T->SetDelta(S->GetDelta());