Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeInteger.cxx
1 //  File   : SALOMEDSImpl_AttributeInteger.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5 #ifndef WNT
6 using namespace std;
7 #endif
8 #include "SALOMEDSImpl_AttributeInteger.hxx"
9
10 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger,  SALOMEDSImpl_GenericAttribute)
11 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute )
12
13
14 //=======================================================================
15 //function : GetID
16 //purpose  :
17 //=======================================================================
18 const Standard_GUID& SALOMEDSImpl_AttributeInteger::GetID ()
19 {
20   static Standard_GUID IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018");
21   return IntegerID;
22 }   
23
24 Handle(SALOMEDSImpl_AttributeInteger) SALOMEDSImpl_AttributeInteger::Set (const TDF_Label& L, Standard_Integer Val) 
25 {
26   Handle(SALOMEDSImpl_AttributeInteger) A;
27   if (!L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), A)) {
28     A = new  SALOMEDSImpl_AttributeInteger(); 
29     L.AddAttribute(A);
30   }
31
32   A->SetValue(Val); 
33   return A;
34 }
35
36 //=======================================================================
37 //function : SetValue
38 //purpose  :
39 //=======================================================================
40 void SALOMEDSImpl_AttributeInteger::SetValue(const Standard_Integer v)
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_AttributeInteger::ID () const { return GetID(); }
55
56
57 //=======================================================================
58 //function : NewEmpty
59 //purpose  :
60 //=======================================================================
61 Handle(TDF_Attribute) SALOMEDSImpl_AttributeInteger::NewEmpty () const
62 {
63   return new SALOMEDSImpl_AttributeInteger();
64 }
65
66 //=======================================================================
67 //function : Restore
68 //purpose  :
69 //=======================================================================
70 void SALOMEDSImpl_AttributeInteger::Restore(const Handle(TDF_Attribute)& With)
71 {
72   myValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast (With)->Value();
73 }
74
75 //=======================================================================
76 //function : Paste
77 //purpose  :
78 //=======================================================================
79 void SALOMEDSImpl_AttributeInteger::Paste (const Handle(TDF_Attribute)& Into,
80                                            const Handle(TDF_RelocationTable)& RT) const
81 {
82   Handle(SALOMEDSImpl_AttributeInteger)::DownCast(Into)->SetValue(myValue);
83 }