Integration of OCCT 6.5.0 from SVN
[occt.git] / src / MDataStd / MDataStd_IntegerListStorageDriver.cxx
CommitLineData
7fd59977 1// File: MDataStd_IntegerListStorageDriver.cxx
2// Created: May 29 11:40:00 2007
3// Author: Vlad Romashko
4// <vladislav.romashko@opencascade.com>
5// Copyright: Open CASCADE
6
7#include <MDataStd_IntegerListStorageDriver.ixx>
8#include <PDataStd_IntegerList.hxx>
9#include <TDataStd_IntegerList.hxx>
10#include <MDataStd.hxx>
11#include <CDM_MessageDriver.hxx>
12#include <TColStd_ListIteratorOfListOfInteger.hxx>
13
14//=======================================================================
15//function : MDataStd_IntegerListStorageDriver
16//purpose :
17//=======================================================================
18MDataStd_IntegerListStorageDriver::MDataStd_IntegerListStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver)
19{
20
21}
22
23//=======================================================================
24//function : VersionNumber
25//purpose :
26//=======================================================================
27Standard_Integer MDataStd_IntegerListStorageDriver::VersionNumber() const
28{
29 return 0;
30}
31
32
33//=======================================================================
34//function : SourceType
35//purpose :
36//=======================================================================
37Handle(Standard_Type) MDataStd_IntegerListStorageDriver::SourceType() const
38{
39 static Handle(Standard_Type) sourceType = STANDARD_TYPE(TDataStd_IntegerList);
40 return sourceType;
41}
42
43//=======================================================================
44//function : NewEmpty
45//purpose :
46//=======================================================================
47Handle(PDF_Attribute) MDataStd_IntegerListStorageDriver::NewEmpty() const
48{
49 return new PDataStd_IntegerList();
50}
51
52//=======================================================================
53//function : Paste
54//purpose :
55//=======================================================================
56void MDataStd_IntegerListStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
57 const Handle(PDF_Attribute)& Target,
58 const Handle(MDF_SRelocationTable)& RelocTable) const
59{
60 Handle(TDataStd_IntegerList) S = Handle(TDataStd_IntegerList)::DownCast (Source);
61 Handle(PDataStd_IntegerList) T = Handle(PDataStd_IntegerList)::DownCast (Target);
62
63 Standard_Integer lower = 1, upper = S->Extent(), i = lower;
64 if (upper >= lower)
65 {
66 T->Init(lower, upper);
67 TColStd_ListIteratorOfListOfInteger itr(S->List());
68 for (; itr.More(); itr.Next(), i++)
69 {
70 T->SetValue(i, itr.Value());
71 }
72 }
73}