]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDSImpl/SALOMEDSImpl_AttributeFlags.cxx
Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeFlags.cxx
1 //  File   : SALOMEDSImpl_AttributeFlags.cxx
2 //  Author : Sergey LITONIN
3 //  Module : SALOME
4
5 #include "SALOMEDSImpl_AttributeFlags.hxx"
6 #include <Standard_GUID.hxx>
7
8 using namespace std;
9
10
11 /*
12   Class       : SALOMEDSImpl_AttributeFlags
13   Description : This class is intended for storing different object attributes that
14                 have only two states (0 and 1).
15 */
16
17 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
18 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
19
20 //=======================================================================
21 //function : SALOMEDSImpl_AttributeFlags::GetID
22 //purpose  : Get GUID of this attribute
23 //=======================================================================
24 const Standard_GUID& SALOMEDSImpl_AttributeFlags::GetID ()
25 {
26   static Standard_GUID SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" );
27   return SALOMEDSImpl_AttributeFlagsID;                
28 }
29
30 //=======================================================================
31 //function : SALOMEDSImpl_AttributeFlags::Set
32 //purpose  : Set value of the attribute
33 //=======================================================================
34 Handle(SALOMEDSImpl_AttributeFlags) SALOMEDSImpl_AttributeFlags::Set(const TDF_Label& L,
35                                                                      const Standard_Integer value )
36 {
37   Handle(SALOMEDSImpl_AttributeFlags) A;
38   if ( !L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID(),A ) )
39   {
40     A = new  SALOMEDSImpl_AttributeFlags();
41     L.AddAttribute( A );
42   }
43
44   A->Set( value );
45   return A;
46 }
47
48 //=======================================================================
49 //function : SALOMEDSImpl_AttributeFlags::SALOMEDSImpl_AttributeFlags
50 //purpose  : Constructor
51 //=======================================================================
52 SALOMEDSImpl_AttributeFlags::SALOMEDSImpl_AttributeFlags()
53 :SALOMEDSImpl_GenericAttribute("AttributeFlags")
54 {
55   myValue = 0;
56 }
57
58 SALOMEDSImpl_AttributeFlags::~SALOMEDSImpl_AttributeFlags()
59 {
60 }
61
62 //=======================================================================
63 //function : SALOMEDSImpl_AttributeFlags::ID
64 //purpose  : Get GUID of this attribute
65 //=======================================================================
66 const Standard_GUID& SALOMEDSImpl_AttributeFlags::ID () const
67 {
68   return GetID();
69 }
70
71 //=======================================================================
72 //function : SALOMEDSImpl_AttributeFlags::NewEmpty
73 //purpose  : Create new empty attribute
74 //=======================================================================
75
76 Handle(TDF_Attribute) SALOMEDSImpl_AttributeFlags::NewEmpty () const
77 {
78   return new SALOMEDSImpl_AttributeFlags();
79 }
80
81 //=======================================================================
82 //function : SALOMEDSImpl_AttributeFlags::Restore
83 //purpose  : Assign given value to the attribute
84 //=======================================================================
85 void SALOMEDSImpl_AttributeFlags::Restore( const Handle(TDF_Attribute)& with )
86 {
87   myValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast( with )->Get();
88   return;
89 }
90
91 //=======================================================================
92 //function : SALOMEDSImpl_AttributeFlags::Paste
93 //purpose  : Assign internal value to the given attribute
94 //=======================================================================
95 void SALOMEDSImpl_AttributeFlags::Paste(const Handle(TDF_Attribute)& into,
96                                         const Handle(TDF_RelocationTable)& RT ) const
97 {
98   Handle(SALOMEDSImpl_AttributeFlags)::DownCast( into )->Set( myValue );
99 }
100
101 //=======================================================================
102 //function : SALOMEDSImpl_AttributeFlags::Set
103 //purpose  : Set value
104 //=======================================================================
105 void SALOMEDSImpl_AttributeFlags::Set( const Standard_Integer v )
106 {
107   Backup();
108   myValue=v;
109 }
110
111 //=======================================================================
112 //function : SALOMEDSImpl_AttributeFlags::Get
113 //purpose  : GetValue
114 //=======================================================================
115 Standard_Integer SALOMEDSImpl_AttributeFlags::Get() const
116 {
117   return myValue;
118 }
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138