0025923: Remove small wires on face read from STEP
[occt.git] / src / MDataStd / MDataStd_ByteArrayRetrievalDriver.cxx
CommitLineData
b311480e 1// Created on: 2007-05-29
2// Created by: Vlad Romashko
973c2be1 3// Copyright (c) 2007-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
16#include <MDataStd_ByteArrayRetrievalDriver.ixx>
17#include <PDataStd_ByteArray.hxx>
18#include <TDataStd_ByteArray.hxx>
19#include <MDataStd.hxx>
20#include <CDM_MessageDriver.hxx>
21#include <TColStd_HArray1OfByte.hxx>
22#include <PColStd_HArray1OfInteger.hxx>
23
24//=======================================================================
25//function : MDataStd_ByteArrayRetrievalDriver
26//purpose :
27//=======================================================================
28MDataStd_ByteArrayRetrievalDriver::MDataStd_ByteArrayRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
29{
30
31}
32
33//=======================================================================
34//function : VersionNumber
35//purpose :
36//=======================================================================
37Standard_Integer MDataStd_ByteArrayRetrievalDriver::VersionNumber() const
38{
39 return 0;
40}
41
42//=======================================================================
43//function : SourceType
44//purpose :
45//=======================================================================
46Handle(Standard_Type) MDataStd_ByteArrayRetrievalDriver::SourceType() const
47{
48 static Handle(Standard_Type) sourceType = STANDARD_TYPE(PDataStd_ByteArray);
49 return sourceType;
50}
51
52//=======================================================================
53//function : NewEmpty
54//purpose :
55//=======================================================================
56Handle(TDF_Attribute) MDataStd_ByteArrayRetrievalDriver::NewEmpty () const
57{
58 return new TDataStd_ByteArray();
59}
60
61//=======================================================================
62//function : Paste
63//purpose :
64//=======================================================================
65void MDataStd_ByteArrayRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,
66 const Handle(TDF_Attribute)& Target,
67 const Handle(MDF_RRelocationTable)& ) const
68{
69 Handle(PDataStd_ByteArray) S = Handle(PDataStd_ByteArray)::DownCast (Source);
70 Handle(TDataStd_ByteArray) T = Handle(TDataStd_ByteArray)::DownCast (Target);
71
72 if (!S->Get().IsNull())
73 {
74 const Handle(PColStd_HArray1OfInteger)& pvalues = S->Get();
75 Handle(TColStd_HArray1OfByte) tvalues = new TColStd_HArray1OfByte(pvalues->Lower(), pvalues->Upper());
76 Standard_Integer i = pvalues->Lower(), upper = pvalues->Upper();
77 for (; i <= upper; i++)
78 {
79 Standard_Byte pvalue = (Standard_Byte) pvalues->Value(i);
80 tvalues->SetValue(i, pvalue);
81 }
82 T->ChangeArray(tvalues, Standard_False);
83 }
84}