]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDSImpl/SALOMEDSImpl_AttributeReal.cxx
Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeReal.cxx
1 //  File   : SALOMEDSImpl_AttributeReal.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5 #include "SALOMEDSImpl_AttributeReal.hxx"
6
7 using namespace std;
8
9 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
10 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
11
12 //=======================================================================
13 //function : GetID
14 //purpose  :
15 //=======================================================================
16 const Standard_GUID& SALOMEDSImpl_AttributeReal::GetID ()
17 {
18   static Standard_GUID realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB");
19   return realID;
20 }   
21
22 Handle(SALOMEDSImpl_AttributeReal) SALOMEDSImpl_AttributeReal::Set (const TDF_Label& L, const Standard_Real Val) 
23 {
24   Handle(SALOMEDSImpl_AttributeReal) A;
25   if (!L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID(), A)) {
26     A = new  SALOMEDSImpl_AttributeReal(); 
27     L.AddAttribute(A);
28   }
29
30   A->SetValue(Val); 
31   return A;
32 }
33
34 //=======================================================================
35 //function : SetValue
36 //purpose  :
37 //=======================================================================
38 void SALOMEDSImpl_AttributeReal::SetValue(const Standard_Real v)
39 {
40   CheckLocked();
41
42   if( myValue == v) return;
43
44   Backup();
45   myValue = v;  
46
47   SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved 
48 }
49
50 //=======================================================================
51 //function : ID
52 //purpose  :
53 //=======================================================================
54 const Standard_GUID& SALOMEDSImpl_AttributeReal::ID () const 
55
56   return GetID(); 
57
58
59 //=======================================================================
60 //function : NewEmpty
61 //purpose  : 
62 //=======================================================================
63 Handle(TDF_Attribute) SALOMEDSImpl_AttributeReal::NewEmpty () const
64 {  
65   return new SALOMEDSImpl_AttributeReal(); 
66 }
67
68 //=======================================================================
69 //function : Restore
70 //purpose  : 
71 //=======================================================================
72 void SALOMEDSImpl_AttributeReal::Restore(const Handle(TDF_Attribute)& with) 
73 {
74   myValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast (with)->Value ();
75 }
76
77 //=======================================================================
78 //function : Paste
79 //purpose  : 
80 //=======================================================================
81 void SALOMEDSImpl_AttributeReal::Paste (const Handle(TDF_Attribute)& into,
82                                         const Handle(TDF_RelocationTable)& RT) const
83 {
84   Handle(SALOMEDSImpl_AttributeReal)::DownCast (into)->SetValue(myValue);
85 }