Salome HOME
updated copyright message
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributeFlags_i.cxx
1 // Copyright (C) 2007-2023  CEA, EDF, 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, or (at your option) any later version.
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
23 //  File   : SALOMEDS_AttributeFlags_i.cxx
24 //  Author : Sergey RUIN
25 //  Module : SALOME
26 //
27 #include "SALOMEDS_AttributeFlags_i.hxx"
28 #include "SALOMEDS.hxx"  
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                 Available attributes:
36                 
37                 IS_VISIBLE - is equal to 1 if object is visible in 3D view (0 - otherwise).
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 dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_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   dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_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 dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_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   SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_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