Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Status.hh

00001 //=============================================================================
00002 //                                                                            
00003 //                               OpenMesh                                     
00004 //      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen       
00005 //                           www.openmesh.org                                 
00006 //                                                                            
00007 //-----------------------------------------------------------------------------
00008 //                                                                            
00009 //                                License                                     
00010 //                                                                            
00011 //   This library is free software; you can redistribute it and/or modify it 
00012 //   under the terms of the GNU Library General Public License as published  
00013 //   by the Free Software Foundation, version 2.                             
00014 //                                                                             
00015 //   This library is distributed in the hope that it will be useful, but       
00016 //   WITHOUT ANY WARRANTY; without even the implied warranty of                
00017 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         
00018 //   Library General Public License for more details.                          
00019 //                                                                            
00020 //   You should have received a copy of the GNU Library General Public         
00021 //   License along with this library; if not, write to the Free Software       
00022 //   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 
00023 //                                                                            
00024 //-----------------------------------------------------------------------------
00025 //                                                                            
00026 //   $Revision: 1.1.1.1 $
00027 //   $Date: 2004/09/06 12:34:56 $
00028 //                                                                            
00029 //=============================================================================
00030 
00031 
00032 //=============================================================================
00033 //
00034 //  CLASS Status
00035 //
00036 //=============================================================================
00037 
00038 
00039 #ifndef OPENMESH_ATTRIBUTE_STATUS_HH
00040 #define OPENMESH_ATTRIBUTE_STATUS_HH
00041 
00042 
00043 //== INCLUDES =================================================================
00044 
00045 #include <OpenMesh/Core/System/config.hh>
00046 
00047 
00048 //== NAMESPACES ===============================================================
00049 
00050 
00051 namespace OpenMesh {
00052 namespace Attributes {
00053 
00054  
00055 //== CLASS DEFINITION  ========================================================
00056   
00057 
00061 enum StatusBits {
00062 
00063   DELETED  = 1,   
00064   LOCKED   = 2,   
00065   SELECTED = 4,   
00066   HIDDEN   = 8,   
00067   FEATURE  = 16,  
00068   TAGGED   = 32,  
00069   TAGGED2  = 64,  
00070   UNUSED   = 128  
00071 };
00072 
00073 
00080 class StatusInfo
00081 {
00082 public:
00083 
00084   typedef unsigned int value_type;
00085     
00086   StatusInfo() : status_(0) {}
00087 
00089   bool deleted() const  { return is_bit_set(DELETED); }
00091   void set_deleted(bool _b) { change_bit(DELETED, _b); }
00092 
00093 
00095   bool locked() const  { return is_bit_set(LOCKED); }
00097   void set_locked(bool _b) { change_bit(LOCKED, _b); }
00098 
00099 
00101   bool selected() const  { return is_bit_set(SELECTED); }
00103   void set_selected(bool _b) { change_bit(SELECTED, _b); }
00104 
00105 
00107   bool hidden() const  { return is_bit_set(HIDDEN); }
00109   void set_hidden(bool _b) { change_bit(HIDDEN, _b); }
00110 
00111 
00113   bool feature() const  { return is_bit_set(FEATURE); }
00115   void set_feature(bool _b) { change_bit(FEATURE, _b); }
00116 
00117 
00119   bool tagged() const  { return is_bit_set(TAGGED); }
00121   void set_tagged(bool _b) { change_bit(TAGGED, _b); }
00122 
00123 
00125   bool tagged2() const  { return is_bit_set(TAGGED2); }
00127   void set_tagged2(bool _b) { change_bit(TAGGED2, _b); }
00128 
00129 
00131   unsigned int bits() const { return status_; }
00133   void set_bits(unsigned int _bits) { status_ = _bits; }
00134 
00135 
00137   bool is_bit_set(unsigned int _s) const { return (status_ & _s) > 0; }
00139   void set_bit(unsigned int _s) { status_ |= _s; }
00141   void unset_bit(unsigned int _s) { status_ &= ~_s; }
00143   void change_bit(unsigned int _s, bool _b) {  
00144     if (_b) status_ |= _s; else status_ &= ~_s; }
00145 
00146 
00147 private: 
00148 
00149   value_type status_;
00150 };
00151 
00152 
00153 //=============================================================================
00154 } // namespace Attributes
00155 } // namespace OpenMesh
00156 //=============================================================================
00157 #endif // OPENMESH_ATTRIBUTE_STATUS_HH defined
00158 //=============================================================================

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .