summaryrefslogtreecommitdiff
path: root/src/BinMDataStd/BinMDataStd_VariableDriver.cxx
blob: 623bd2fe48069ae165935f0c8b5ed0ce0ed4d7e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// File:        BinMDataStd_VariableDriver.cxx
// Created:     Fri Aug 24 20:46:58 2001
// Author:      Alexnder GRIGORIEV
// Copyright:   Open Cascade 2001
// History:

#include <BinMDataStd_VariableDriver.ixx>
#include <TDataStd_Variable.hxx>
#include <TCollection_AsciiString.hxx>

//=======================================================================
//function : BinMDataStd_VariableDriver
//purpose  : Constructor
//=======================================================================
BinMDataStd_VariableDriver::BinMDataStd_VariableDriver
                        (const Handle(CDM_MessageDriver)& theMsgDriver)
      : BinMDF_ADriver (theMsgDriver, NULL)
{}

//=======================================================================
//function : NewEmpty
//purpose  : 
//=======================================================================
Handle(TDF_Attribute) BinMDataStd_VariableDriver::NewEmpty() const
{
  return (new TDataStd_Variable());
}

//=======================================================================
//function : Paste
//purpose  : 
//=======================================================================
Standard_Boolean BinMDataStd_VariableDriver::Paste
                                (const BinObjMgt_Persistent&  theSource,
                                 const Handle(TDF_Attribute)& theTarget,
                                 BinObjMgt_RRelocationTable&  ) const
{
  Handle(TDataStd_Variable) aV = Handle(TDataStd_Variable)::DownCast(theTarget);

  Standard_Boolean isConstant;
  if (! (theSource >> isConstant))
    return Standard_False;
  aV->Constant (isConstant);

  TCollection_AsciiString anStr;
  if (! (theSource >> anStr))
    return Standard_False;
  aV->Unit(anStr);
  
  return Standard_True;
}

//=======================================================================
//function : Paste
//purpose  : 
//=======================================================================
void BinMDataStd_VariableDriver::Paste (const Handle(TDF_Attribute)& theSource,
                                        BinObjMgt_Persistent&        theTarget,
                                        BinObjMgt_SRelocationTable&  ) const
{
  Handle(TDataStd_Variable) aV = Handle(TDataStd_Variable)::DownCast(theSource);
  theTarget << aV->IsConstant() << aV->Unit();
}