Back to index

salome-kernel  6.5.0
SALOMEDS_AttributeFlags_i.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : SALOMEDS_AttributeFlags_i.cxx
00024 //  Author : Sergey RUIN
00025 //  Module : SALOME
00026 //
00027 #include "SALOMEDS_AttributeFlags_i.hxx"
00028 #include "SALOMEDS.hxx"  
00029 
00030 /*
00031   Class       : SALOMEDS_AttributeFlags_i
00032   Description : This class is intended for storing different object attributes that
00033                 have only two states (0 and 1).
00034                 
00035                 Avalable attributes:
00036                 
00037                 IS_VISIBLE - is equal to 1 if object is visible in 3D view (0 - overwise).
00038                              This attribute is valid for active view only.
00039 */
00040 
00041 
00042 //=======================================================================
00043 // function : SALOMEDS_AttributeFlags_i::GetFlags
00044 // purpose  : Get all flags as integer value
00045 //=======================================================================
00046 CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags()
00047 {
00048   SALOMEDS::Locker lock;
00049   return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get();
00050 }
00051 
00052 //=======================================================================
00053 // function : SALOMEDS_AttributeFlags_i::SetFlags
00054 // purpose  : Set all flags as integer value
00055 //=======================================================================
00056 void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags )
00057 {
00058   SALOMEDS::Locker lock;
00059   dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Set( theFlags );
00060 }
00061 
00062 //=======================================================================
00063 // function : SALOMEDS_AttributeFlags_i::Get
00064 // purpose  : Get specified flag
00065 //=======================================================================
00066 CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag )
00067 {
00068   SALOMEDS::Locker lock;
00069   return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get() & theFlag ? true : false;
00070 }
00071 
00072 //=======================================================================
00073 // function : SALOMEDS_AttributeFlags_i::Set
00074 // purpose  : Set/Unset specified flag
00075 //=======================================================================
00076 void SALOMEDS_AttributeFlags_i::Set( CORBA::Long theFlag, CORBA::Boolean theValue )
00077 {
00078   SALOMEDS::Locker lock;
00079   SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl);
00080   if ( theValue )
00081     anAttr->Set( anAttr->Get() | theFlag );
00082   else
00083     anAttr->Set( anAttr->Get() & ~theFlag );
00084 }
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102