0025394: Make it possible to store/retrieve the list-based attributes containing...
[occt.git] / src / MDataStd / MDataStd_BooleanListRetrievalDriver.cxx
1 // Created on: 2007-05-29
2 // Created by: Vlad Romashko
3 // Copyright (c) 2007-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <MDataStd_BooleanListRetrievalDriver.ixx>
17 #include <PDataStd_BooleanList.hxx>
18 #include <TDataStd_BooleanList.hxx>
19 #include <MDataStd.hxx>
20 #include <CDM_MessageDriver.hxx>
21
22 //=======================================================================
23 //function : MDataStd_BooleanListRetrievalDriver
24 //purpose  : 
25 //=======================================================================
26 MDataStd_BooleanListRetrievalDriver::MDataStd_BooleanListRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
27 {
28
29 }
30
31 //=======================================================================
32 //function : VersionNumber
33 //purpose  : 
34 //=======================================================================
35 Standard_Integer MDataStd_BooleanListRetrievalDriver::VersionNumber() const
36
37   return 0; 
38 }
39
40 //=======================================================================
41 //function : SourceType
42 //purpose  : 
43 //=======================================================================
44 Handle(Standard_Type) MDataStd_BooleanListRetrievalDriver::SourceType() const
45 {
46   static Handle(Standard_Type) sourceType = STANDARD_TYPE(PDataStd_BooleanList);
47   return sourceType;
48 }
49
50 //=======================================================================
51 //function : NewEmpty
52 //purpose  : 
53 //=======================================================================
54 Handle(TDF_Attribute) MDataStd_BooleanListRetrievalDriver::NewEmpty () const 
55 {
56   return new TDataStd_BooleanList();
57 }
58
59 //=======================================================================
60 //function : Paste
61 //purpose  : 
62 //=======================================================================
63 void MDataStd_BooleanListRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,
64                                                 const Handle(TDF_Attribute)& Target,
65                                                 const Handle(MDF_RRelocationTable)& ) const
66 {
67   const Handle(PDataStd_BooleanList) S = Handle(PDataStd_BooleanList)::DownCast (Source);
68   const Handle(TDataStd_BooleanList) T = Handle(TDataStd_BooleanList)::DownCast (Target);
69   if(!S.IsNull()) {
70     Standard_Integer i, lower = S->Lower(), upper = S->Upper();
71      if(upper > 0)
72       for (i = lower; i <= upper; i++) {
73         T->Append(S->Value(i));
74      }
75   }
76 }