1 // Copyright (C) 2007-2008 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
22 // File : SALOMEDS_AttributeFlags_i.cxx
23 // Author : Sergey RUIN
26 #include "SALOMEDS_AttributeFlags_i.hxx"
27 #include "SALOMEDS.hxx"
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).
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.
43 //=======================================================================
44 // function : SALOMEDS_AttributeFlags_i::GetFlags
45 // purpose : Get all flags as integer value
46 //=======================================================================
47 CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags()
49 SALOMEDS::Locker lock;
50 return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get();
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 )
59 SALOMEDS::Locker lock;
60 dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Set( theFlags );
63 //=======================================================================
64 // function : SALOMEDS_AttributeFlags_i::Get
65 // purpose : Get specified flag
66 //=======================================================================
67 CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag )
69 SALOMEDS::Locker lock;
70 return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get() & theFlag ? true : false;
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 )
79 SALOMEDS::Locker lock;
80 SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl);
82 anAttr->Set( anAttr->Get() | theFlag );
84 anAttr->Set( anAttr->Get() & ~theFlag );