1 // Created on: 1997-03-06
2 // Created by: Denis PASCAL
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Standard_GUID.hxx>
19 #include <Standard_Type.hxx>
20 #include <TDataStd.hxx>
21 #include <TDataStd_Real.hxx>
22 #include <TDF_Attribute.hxx>
23 #include <TDF_Label.hxx>
24 #include <TDF_Reference.hxx>
25 #include <TDF_RelocationTable.hxx>
27 //=======================================================================
30 //=======================================================================
31 const Standard_GUID& TDataStd_Real::GetID()
33 static Standard_GUID TDataStd_RealID("2a96b60f-ec8b-11d0-bee7-080009dc3333");
34 return TDataStd_RealID;
38 //=======================================================================
41 //=======================================================================
43 Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L,
44 const Standard_Real V)
46 Handle(TDataStd_Real) A;
47 if (!L.FindAttribute(TDataStd_Real::GetID(), A)) {
48 A = new TDataStd_Real ();
56 //=======================================================================
57 //function : TDataStd_Real
58 //purpose : Empty constructor
59 //=======================================================================
61 TDataStd_Real::TDataStd_Real ()
62 : myValue (RealFirst()),
63 myDimension (TDataStd_SCALAR)
68 //=======================================================================
69 //function : IsCaptured
71 //=======================================================================
73 Standard_Boolean TDataStd_Real::IsCaptured() const
75 Handle(TDF_Reference) reference;
78 if (Label().FindAttribute(TDF_Reference::GetID(),reference)) {
79 const TDF_Label& label = reference->Get();
80 return label.IsAttribute (TDataStd_Real::GetID());
82 return Standard_False;
86 //=======================================================================
89 //=======================================================================
91 void TDataStd_Real::Set(const Standard_Real v)
94 if( myValue == v) return;
100 //=======================================================================
103 //=======================================================================
105 Standard_Real TDataStd_Real::Get() const { return myValue; }
108 //=======================================================================
109 //function : SetDimension
111 //=======================================================================
113 void TDataStd_Real::SetDimension (const TDataStd_RealEnum DIM)
115 // OCC2932 correction
116 if(myDimension == DIM) return;
123 //=======================================================================
124 //function : GetDimension
126 //=======================================================================
128 TDataStd_RealEnum TDataStd_Real::GetDimension () const
134 //=======================================================================
137 //=======================================================================
139 const Standard_GUID& TDataStd_Real::ID() const { return GetID(); }
142 //=======================================================================
143 //function : NewEmpty
145 //=======================================================================
147 Handle(TDF_Attribute) TDataStd_Real::NewEmpty () const
149 return new TDataStd_Real();
152 //=======================================================================
155 //=======================================================================
157 void TDataStd_Real::Restore(const Handle(TDF_Attribute)& With)
159 Handle(TDataStd_Real) R = Handle(TDataStd_Real)::DownCast (With);
161 myDimension = R->GetDimension();
166 //=======================================================================
169 //=======================================================================
171 void TDataStd_Real::Paste (const Handle(TDF_Attribute)& Into,
172 const Handle(TDF_RelocationTable)& /*RT*/) const
174 Handle(TDataStd_Real) R = Handle(TDataStd_Real)::DownCast (Into);
176 R->SetDimension(myDimension);
179 //=======================================================================
182 //=======================================================================
184 Standard_OStream& TDataStd_Real::Dump (Standard_OStream& anOS) const
187 TDataStd::Print(GetDimension(),anOS);