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 | // |
973c2be1 |
7 | // This library is free software; you can redistribute it and / or modify it |
8 | // under the terms of the GNU Lesser General Public 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. |
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_BooleanListStorageDriver.ixx> |
17 | #include <PDataStd_BooleanList.hxx> |
18 | #include <TDataStd_BooleanList.hxx> |
19 | #include <MDataStd.hxx> |
20 | #include <CDM_MessageDriver.hxx> |
21 | #include <TDataStd_ListIteratorOfListOfByte.hxx> |
22 | |
23 | //======================================================================= |
24 | //function : MDataStd_BooleanListStorageDriver |
25 | //purpose : |
26 | //======================================================================= |
27 | MDataStd_BooleanListStorageDriver::MDataStd_BooleanListStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver) |
28 | { |
29 | |
30 | } |
31 | |
32 | //======================================================================= |
33 | //function : VersionNumber |
34 | //purpose : |
35 | //======================================================================= |
36 | Standard_Integer MDataStd_BooleanListStorageDriver::VersionNumber() const |
37 | { |
38 | return 0; |
39 | } |
40 | |
41 | |
42 | //======================================================================= |
43 | //function : SourceType |
44 | //purpose : |
45 | //======================================================================= |
46 | Handle(Standard_Type) MDataStd_BooleanListStorageDriver::SourceType() const |
47 | { |
48 | static Handle(Standard_Type) sourceType = STANDARD_TYPE(TDataStd_BooleanList); |
49 | return sourceType; |
50 | } |
51 | |
52 | //======================================================================= |
53 | //function : NewEmpty |
54 | //purpose : |
55 | //======================================================================= |
56 | Handle(PDF_Attribute) MDataStd_BooleanListStorageDriver::NewEmpty() const |
57 | { |
58 | return new PDataStd_BooleanList(); |
59 | } |
60 | |
61 | //======================================================================= |
62 | //function : Paste |
63 | //purpose : |
64 | //======================================================================= |
65 | void MDataStd_BooleanListStorageDriver::Paste(const Handle(TDF_Attribute)& Source, |
66 | const Handle(PDF_Attribute)& Target, |
35e08fe8 |
67 | const Handle(MDF_SRelocationTable)& /*RelocTable*/) const |
7fd59977 |
68 | { |
69 | Handle(TDataStd_BooleanList) S = Handle(TDataStd_BooleanList)::DownCast (Source); |
70 | Handle(PDataStd_BooleanList) T = Handle(PDataStd_BooleanList)::DownCast (Target); |
71 | |
72 | Standard_Integer lower = 1, upper = S->Extent(), i = lower; |
73 | if (upper >= lower) |
74 | { |
75 | T->Init(lower, upper); |
76 | TDataStd_ListIteratorOfListOfByte itr(S->List()); |
77 | for (; itr.More(); itr.Next(), i++) |
78 | { |
79 | T->SetValue(i, itr.Value()); |
80 | } |
81 | } |
82 | } |