Salome HOME
b1276401a18709d59f2360590ed5e1bc7fc3c42d
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributeFlags_i.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20 //  File   : SALOMEDS_AttributeFlags_i.cxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24
25 #include "SALOMEDS_AttributeFlags_i.hxx"
26 #include "SALOMEDS.hxx"  
27
28 using namespace std;
29
30 /*
31   Class       : SALOMEDS_AttributeFlags_i
32   Description : This class is intended for storing different object attributes that
33                 have only two states (0 and 1).
34                 
35                 Avalable attributes:
36                 
37                 IS_VISIBLE - is equal to 1 if object is visible in 3D view (0 - overwise).
38                              This attribute is valid for active view only.
39 */
40
41
42 //=======================================================================
43 // function : SALOMEDS_AttributeFlags_i::GetFlags
44 // purpose  : Get all flags as integer value
45 //=======================================================================
46 CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags()
47 {
48   SALOMEDS::Locker lock;
49   return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get();
50 }
51
52 //=======================================================================
53 // function : SALOMEDS_AttributeFlags_i::SetFlags
54 // purpose  : Set all flags as integer value
55 //=======================================================================
56 void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags )
57 {
58   SALOMEDS::Locker lock;
59   Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Set( theFlags );
60 }
61
62 //=======================================================================
63 // function : SALOMEDS_AttributeFlags_i::Get
64 // purpose  : Get specified flag
65 //=======================================================================
66 CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag )
67 {
68   SALOMEDS::Locker lock;
69   return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get() & theFlag ? true : false;
70 }
71
72 //=======================================================================
73 // function : SALOMEDS_AttributeFlags_i::Set
74 // purpose  : Set/Unset specified flag
75 //=======================================================================
76 void SALOMEDS_AttributeFlags_i::Set( CORBA::Long theFlag, CORBA::Boolean theValue )
77 {
78   SALOMEDS::Locker lock;
79   Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl);
80   if ( theValue )
81     anAttr->Set( anAttr->Get() | theFlag );
82   else
83     anAttr->Set( anAttr->Get() & ~theFlag );
84 }
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102