Salome HOME
Initialisation de la base KERNEL avec la version operationnelle de KERNEL_SRC issue...
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_SelectableAttribute.cxx
1 using namespace std;
2 //  File      : SALOMEDS_SelectableAttribute.cxx
3 //  Created   : Wed Nov 28 16:09:35 2001
4 //  Author    : Yves FRICAUD
5 //  Project   : SALOME
6 //  Module    : SALOMEDS
7 //  Copyright : Open CASCADE 2001
8 //  $Header:  
9
10 #include "SALOMEDS_SelectableAttribute.ixx"
11 #include <TDataStd_Integer.hxx>
12
13 //=======================================================================
14 //function : GetID
15 //purpose  : 
16 //=======================================================================
17
18 const Standard_GUID& SALOMEDS_SelectableAttribute::GetID () 
19 {
20   static Standard_GUID SALOMEDS_SelectableAttributeID ("12837188-8F52-11d6-A8A3-0001021E8C7F");
21   return SALOMEDS_SelectableAttributeID;
22 }
23
24
25
26 //=======================================================================
27 //function : Set
28 //purpose  : 
29 //=======================================================================
30
31 Handle(SALOMEDS_SelectableAttribute) SALOMEDS_SelectableAttribute::Set (const TDF_Label& L,
32                                                                   const Standard_Integer value) 
33 {
34   Handle(SALOMEDS_SelectableAttribute) A;
35   if (!L.FindAttribute(SALOMEDS_SelectableAttribute::GetID(),A)) {
36     A = new  SALOMEDS_SelectableAttribute(); 
37     L.AddAttribute(A);
38   }
39   
40   (Handle(TDataStd_Integer)::DownCast(A))->Set (value); 
41   return A;
42 }
43
44
45 //=======================================================================
46 //function : constructor
47 //purpose  : 
48 //=======================================================================
49 SALOMEDS_SelectableAttribute::SALOMEDS_SelectableAttribute()
50 {
51   TDataStd_Integer::Set(0);
52 }
53
54 //=======================================================================
55 //function : ID
56 //purpose  : 
57 //=======================================================================
58
59 const Standard_GUID& SALOMEDS_SelectableAttribute::ID () const { return GetID(); }
60
61
62 //=======================================================================
63 //function : NewEmpty
64 //purpose  : 
65 //=======================================================================
66
67 Handle(TDF_Attribute) SALOMEDS_SelectableAttribute::NewEmpty () const
68 {  
69   return new SALOMEDS_SelectableAttribute(); 
70 }
71
72 //=======================================================================
73 //function : Restore
74 //purpose  : 
75 //=======================================================================
76
77 void SALOMEDS_SelectableAttribute::Restore(const Handle(TDF_Attribute)& with) 
78 {
79   Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get ();
80   TDataStd_Integer::Set(s);
81   return;
82 }
83
84 //=======================================================================
85 //function : Paste
86 //purpose  : 
87 //=======================================================================
88
89 void SALOMEDS_SelectableAttribute::Paste (const Handle(TDF_Attribute)& into,
90                                     const Handle(TDF_RelocationTable)& RT) const
91 {
92   Handle(TDataStd_Integer)::DownCast (into)->Set (Get());
93 }
94