Salome HOME
merge from branch BR_V5_DEV
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeFlags.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SALOMEDSImpl_AttributeFlags.cxx
23 //  Author : Sergey LITONIN
24 //  Module : SALOME
25 //
26 #include "SALOMEDSImpl_AttributeFlags.hxx"
27
28 using namespace std;
29
30
31 /*
32   Class       : SALOMEDSImpl_AttributeFlags
33   Description : This class is intended for storing different object attributes that
34                 have only two states (0 and 1).
35 */
36
37 //=======================================================================
38 //function : SALOMEDSImpl_AttributeFlags::GetID
39 //purpose  : Get GUID of this attribute
40 //=======================================================================
41 const std::string& SALOMEDSImpl_AttributeFlags::GetID ()
42 {
43   static std::string SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" );
44   return SALOMEDSImpl_AttributeFlagsID;                
45 }
46
47 //=======================================================================
48 //function : SALOMEDSImpl_AttributeFlags::Set
49 //purpose  : Set value of the attribute
50 //=======================================================================
51 SALOMEDSImpl_AttributeFlags* SALOMEDSImpl_AttributeFlags::Set(const DF_Label& L,
52                                                               const int value )
53 {
54   SALOMEDSImpl_AttributeFlags* A = NULL;
55   if ( !(A=(SALOMEDSImpl_AttributeFlags*)L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID())) )
56   {
57     A = new  SALOMEDSImpl_AttributeFlags();
58     L.AddAttribute( A );
59   }
60
61   A->Set( value );
62   return A;
63 }
64
65 //=======================================================================
66 //function : SALOMEDSImpl_AttributeFlags::SALOMEDSImpl_AttributeFlags
67 //purpose  : Constructor
68 //=======================================================================
69 SALOMEDSImpl_AttributeFlags::SALOMEDSImpl_AttributeFlags()
70 :SALOMEDSImpl_GenericAttribute("AttributeFlags")
71 {
72   myValue = 0;
73 }
74
75 SALOMEDSImpl_AttributeFlags::~SALOMEDSImpl_AttributeFlags()
76 {
77 }
78
79 //=======================================================================
80 //function : SALOMEDSImpl_AttributeFlags::ID
81 //purpose  : Get GUID of this attribute
82 //=======================================================================
83 const std::string& SALOMEDSImpl_AttributeFlags::ID () const
84 {
85   return GetID();
86 }
87
88 //=======================================================================
89 //function : SALOMEDSImpl_AttributeFlags::NewEmpty
90 //purpose  : Create new empty attribute
91 //=======================================================================
92
93 DF_Attribute* SALOMEDSImpl_AttributeFlags::NewEmpty () const
94 {
95   return new SALOMEDSImpl_AttributeFlags();
96 }
97
98 //=======================================================================
99 //function : SALOMEDSImpl_AttributeFlags::Restore
100 //purpose  : Assign given value to the attribute
101 //=======================================================================
102 void SALOMEDSImpl_AttributeFlags::Restore( DF_Attribute* with )
103 {
104   myValue = dynamic_cast<SALOMEDSImpl_AttributeFlags*>( with )->Get();
105   return;
106 }
107
108 //=======================================================================
109 //function : SALOMEDSImpl_AttributeFlags::Paste
110 //purpose  : Assign internal value to the given attribute
111 //=======================================================================
112 void SALOMEDSImpl_AttributeFlags::Paste( DF_Attribute* into)
113 {
114   dynamic_cast<SALOMEDSImpl_AttributeFlags*>( into )->Set( myValue );
115 }
116
117 //=======================================================================
118 //function : SALOMEDSImpl_AttributeFlags::Set
119 //purpose  : Set value
120 //=======================================================================
121 void SALOMEDSImpl_AttributeFlags::Set( const int v )
122 {
123   Backup();
124   myValue=v;
125 }
126
127 //=======================================================================
128 //function : SALOMEDSImpl_AttributeFlags::Get
129 //purpose  : GetValue
130 //=======================================================================
131 int SALOMEDSImpl_AttributeFlags::Get() const
132 {
133   return myValue;
134 }
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154