1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SALOMEDS_AttributeFlags_i.cxx
24 // Author : Sergey RUIN
27 #include "SALOMEDS_AttributeFlags_i.hxx"
28 #include "SALOMEDS.hxx"
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).
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.
42 //=======================================================================
43 // function : SALOMEDS_AttributeFlags_i::GetFlags
44 // purpose : Get all flags as integer value
45 //=======================================================================
46 CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags()
48 SALOMEDS::Locker lock;
49 return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get();
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 )
58 SALOMEDS::Locker lock;
59 dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Set( theFlags );
62 //=======================================================================
63 // function : SALOMEDS_AttributeFlags_i::Get
64 // purpose : Get specified flag
65 //=======================================================================
66 CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag )
68 SALOMEDS::Locker lock;
69 return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get() & theFlag ? true : false;
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 )
78 SALOMEDS::Locker lock;
79 SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl);
81 anAttr->Set( anAttr->Get() | theFlag );
83 anAttr->Set( anAttr->Get() & ~theFlag );