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