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.
17 #include <TDataStd_Real.ixx>
18 #include <TDF_Reference.hxx>
19 #include <TDataStd.hxx>
22 //=======================================================================
25 //=======================================================================
27 const Standard_GUID& TDataStd_Real::GetID()
29 static Standard_GUID TDataStd_RealID("2a96b60f-ec8b-11d0-bee7-080009dc3333");
30 return TDataStd_RealID;
34 //=======================================================================
37 //=======================================================================
39 Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L,
40 const Standard_Real V)
42 Handle(TDataStd_Real) A;
43 if (!L.FindAttribute(TDataStd_Real::GetID(), A)) {
44 A = new TDataStd_Real ();
52 //=======================================================================
53 //function : TDataStd_Real
54 //purpose : Empty constructor
55 //=======================================================================
57 TDataStd_Real::TDataStd_Real ()
58 : myValue (RealFirst()),
59 myDimension (TDataStd_SCALAR)
64 //=======================================================================
65 //function : IsCaptured
67 //=======================================================================
69 Standard_Boolean TDataStd_Real::IsCaptured() const
71 Handle(TDF_Reference) reference;
74 if (Label().FindAttribute(TDF_Reference::GetID(),reference)) {
75 const TDF_Label& label = reference->Get();
76 return label.IsAttribute (TDataStd_Real::GetID());
78 return Standard_False;
82 //=======================================================================
85 //=======================================================================
87 void TDataStd_Real::Set(const Standard_Real v)
90 if( myValue == v) return;
96 //=======================================================================
99 //=======================================================================
101 Standard_Real TDataStd_Real::Get() const { return myValue; }
104 //=======================================================================
105 //function : SetDimension
107 //=======================================================================
109 void TDataStd_Real::SetDimension (const TDataStd_RealEnum DIM)
111 // OCC2932 correction
112 if(myDimension == DIM) return;
119 //=======================================================================
120 //function : GetDimension
122 //=======================================================================
124 TDataStd_RealEnum TDataStd_Real::GetDimension () const
130 //=======================================================================
133 //=======================================================================
135 const Standard_GUID& TDataStd_Real::ID() const { return GetID(); }
138 //=======================================================================
139 //function : NewEmpty
141 //=======================================================================
143 Handle(TDF_Attribute) TDataStd_Real::NewEmpty () const
145 return new TDataStd_Real();
148 //=======================================================================
151 //=======================================================================
153 void TDataStd_Real::Restore(const Handle(TDF_Attribute)& With)
155 Handle(TDataStd_Real) R = Handle(TDataStd_Real)::DownCast (With);
157 myDimension = R->GetDimension();
162 //=======================================================================
165 //=======================================================================
167 void TDataStd_Real::Paste (const Handle(TDF_Attribute)& Into,
168 const Handle(TDF_RelocationTable)& /*RT*/) const
170 Handle(TDataStd_Real) R = Handle(TDataStd_Real)::DownCast (Into);
172 R->SetDimension(myDimension);
175 //=======================================================================
178 //=======================================================================
180 Standard_OStream& TDataStd_Real::Dump (Standard_OStream& anOS) const
183 TDataStd::Print(GetDimension(),anOS);