]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDSImpl/SALOMEDSImpl_AttributeLocalID.cxx
Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeLocalID.cxx
1 //  File   : SALOMEDSImpl_AttributeLocalID.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5
6 #include "SALOMEDSImpl_AttributeLocalID.hxx"
7 #include <Standard_GUID.hxx>
8
9 using namespace std;
10
11 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
12 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
13
14 //=======================================================================
15 //function : GetID
16 //purpose  : 
17 //=======================================================================
18
19 const Standard_GUID& SALOMEDSImpl_AttributeLocalID::GetID () 
20 {
21   static Standard_GUID SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F");
22   return SALOMEDSImpl_AttributeLocalID;
23 }
24
25
26
27 //=======================================================================
28 //function : Set
29 //purpose  : 
30 //=======================================================================
31
32 Handle(SALOMEDSImpl_AttributeLocalID) SALOMEDSImpl_AttributeLocalID::Set (const TDF_Label& L,
33                                                                           const Standard_Integer value) 
34 {
35   Handle(SALOMEDSImpl_AttributeLocalID) A;
36   if (!L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(),A)) {
37     A = new  SALOMEDSImpl_AttributeLocalID(); 
38     L.AddAttribute(A);
39   }
40   
41   A->SetValue(value); 
42   return A;
43 }
44
45
46 //=======================================================================
47 //function : constructor
48 //purpose  : 
49 //=======================================================================
50 SALOMEDSImpl_AttributeLocalID::SALOMEDSImpl_AttributeLocalID()
51 :SALOMEDSImpl_GenericAttribute("AttributeLocalID")
52 {
53   myValue = 0; 
54 }
55
56 //=======================================================================
57 //function : Set
58 //purpose  :
59 //=======================================================================
60 void SALOMEDSImpl_AttributeLocalID::SetValue(const Standard_Integer theValue)
61 {
62   CheckLocked();
63
64   Backup();
65
66   myValue = theValue;
67
68   SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved 
69 }
70     
71
72 //=======================================================================
73 //function : ID
74 //purpose  : 
75 //=======================================================================
76
77 const Standard_GUID& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); }
78
79
80 //=======================================================================
81 //function : NewEmpty
82 //purpose  : 
83 //=======================================================================
84
85 Handle(TDF_Attribute) SALOMEDSImpl_AttributeLocalID::NewEmpty () const
86 {  
87   return new SALOMEDSImpl_AttributeLocalID(); 
88 }
89
90 //=======================================================================
91 //function : Restore
92 //purpose  : 
93 //=======================================================================
94
95 void SALOMEDSImpl_AttributeLocalID::Restore(const Handle(TDF_Attribute)& with) 
96 {
97   myValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (with)->Value();
98 }
99
100 //=======================================================================
101 //function : Paste
102 //purpose  : 
103 //=======================================================================
104
105 void SALOMEDSImpl_AttributeLocalID::Paste (const Handle(TDF_Attribute)& into,
106                                            const Handle(TDF_RelocationTable)& RT) const
107 {
108   Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (into)->SetValue(myValue);
109 }
110