Salome HOME
Issue 0020194: EDF 977 ALL: Get rid of warnings PACKAGE_VERSION already defined
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributeFlags_i.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   : SALOMEDS_AttributeFlags_i.cxx
23 //  Author : Sergey RUIN
24 //  Module : SALOME
25 //
26 #include "SALOMEDS_AttributeFlags_i.hxx"
27 #include "SALOMEDS.hxx"  
28
29 using namespace std;
30
31 /*
32   Class       : SALOMEDS_AttributeFlags_i
33   Description : This class is intended for storing different object attributes that
34                 have only two states (0 and 1).
35                 
36                 Avalable attributes:
37                 
38                 IS_VISIBLE - is equal to 1 if object is visible in 3D view (0 - overwise).
39                              This attribute is valid for active view only.
40 */
41
42
43 //=======================================================================
44 // function : SALOMEDS_AttributeFlags_i::GetFlags
45 // purpose  : Get all flags as integer value
46 //=======================================================================
47 CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags()
48 {
49   SALOMEDS::Locker lock;
50   return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get();
51 }
52
53 //=======================================================================
54 // function : SALOMEDS_AttributeFlags_i::SetFlags
55 // purpose  : Set all flags as integer value
56 //=======================================================================
57 void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags )
58 {
59   SALOMEDS::Locker lock;
60   dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Set( theFlags );
61 }
62
63 //=======================================================================
64 // function : SALOMEDS_AttributeFlags_i::Get
65 // purpose  : Get specified flag
66 //=======================================================================
67 CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag )
68 {
69   SALOMEDS::Locker lock;
70   return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get() & theFlag ? true : false;
71 }
72
73 //=======================================================================
74 // function : SALOMEDS_AttributeFlags_i::Set
75 // purpose  : Set/Unset specified flag
76 //=======================================================================
77 void SALOMEDS_AttributeFlags_i::Set( CORBA::Long theFlag, CORBA::Boolean theValue )
78 {
79   SALOMEDS::Locker lock;
80   SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl);
81   if ( theValue )
82     anAttr->Set( anAttr->Get() | theFlag );
83   else
84     anAttr->Set( anAttr->Get() & ~theFlag );
85 }
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103