OpenMesh
|
00001 /*===========================================================================*\ 00002 * * 00003 * OpenMesh * 00004 * Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen * 00005 * www.openmesh.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * This file is part of OpenMesh. * 00009 * * 00010 * OpenMesh is free software: you can redistribute it and/or modify * 00011 * it under the terms of the GNU Lesser General Public License as * 00012 * published by the Free Software Foundation, either version 3 of * 00013 * the License, or (at your option) any later version with the * 00014 * following exceptions: * 00015 * * 00016 * If other files instantiate templates or use macros * 00017 * or inline functions from this file, or you compile this file and * 00018 * link it with other files to produce an executable, this file does * 00019 * not by itself cause the resulting executable to be covered by the * 00020 * GNU Lesser General Public License. This exception does not however * 00021 * invalidate any other reasons why the executable file might be * 00022 * covered by the GNU Lesser General Public License. * 00023 * * 00024 * OpenMesh is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU Lesser General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU LesserGeneral Public * 00030 * License along with OpenMesh. If not, * 00031 * see <http://www.gnu.org/licenses/>. * 00032 * * 00033 \*===========================================================================*/ 00034 00035 /*===========================================================================*\ 00036 * * 00037 * $Revision: 362 $ * 00038 * $Date: 2011-01-26 10:21:12 +0100 (Mi, 26 Jan 2011) $ * 00039 * * 00040 \*===========================================================================*/ 00041 00042 00043 //============================================================================= 00044 // 00045 // CLASS Status 00046 // 00047 //============================================================================= 00048 00049 00050 #ifndef OPENMESH_ATTRIBUTE_STATUS_HH 00051 #define OPENMESH_ATTRIBUTE_STATUS_HH 00052 00053 00054 //== INCLUDES ================================================================= 00055 00056 #include <OpenMesh/Core/System/config.h> 00057 00058 00059 //== NAMESPACES =============================================================== 00060 00061 00062 namespace OpenMesh { 00063 namespace Attributes { 00064 00065 00066 //== CLASS DEFINITION ======================================================== 00067 00068 00072 enum StatusBits { 00073 00074 DELETED = 1, 00075 LOCKED = 2, 00076 SELECTED = 4, 00077 HIDDEN = 8, 00078 FEATURE = 16, 00079 TAGGED = 32, 00080 TAGGED2 = 64, 00081 FIXEDNONMANIFOLD = 128, 00082 UNUSED = 256 00083 }; 00084 00085 00092 class StatusInfo 00093 { 00094 public: 00095 00096 typedef unsigned int value_type; 00097 00098 StatusInfo() : status_(0) {} 00099 00101 bool deleted() const { return is_bit_set(DELETED); } 00103 void set_deleted(bool _b) { change_bit(DELETED, _b); } 00104 00105 00107 bool locked() const { return is_bit_set(LOCKED); } 00109 void set_locked(bool _b) { change_bit(LOCKED, _b); } 00110 00111 00113 bool selected() const { return is_bit_set(SELECTED); } 00115 void set_selected(bool _b) { change_bit(SELECTED, _b); } 00116 00117 00119 bool hidden() const { return is_bit_set(HIDDEN); } 00121 void set_hidden(bool _b) { change_bit(HIDDEN, _b); } 00122 00123 00125 bool feature() const { return is_bit_set(FEATURE); } 00127 void set_feature(bool _b) { change_bit(FEATURE, _b); } 00128 00129 00131 bool tagged() const { return is_bit_set(TAGGED); } 00133 void set_tagged(bool _b) { change_bit(TAGGED, _b); } 00134 00135 00137 bool tagged2() const { return is_bit_set(TAGGED2); } 00139 void set_tagged2(bool _b) { change_bit(TAGGED2, _b); } 00140 00141 00143 bool fixed_nonmanifold() const { return is_bit_set(FIXEDNONMANIFOLD); } 00145 void set_fixed_nonmanifold(bool _b) { change_bit(FIXEDNONMANIFOLD, _b); } 00146 00147 00149 unsigned int bits() const { return status_; } 00151 void set_bits(unsigned int _bits) { status_ = _bits; } 00152 00153 00155 bool is_bit_set(unsigned int _s) const { return (status_ & _s) > 0; } 00157 void set_bit(unsigned int _s) { status_ |= _s; } 00159 void unset_bit(unsigned int _s) { status_ &= ~_s; } 00161 void change_bit(unsigned int _s, bool _b) { 00162 if (_b) status_ |= _s; else status_ &= ~_s; } 00163 00164 00165 private: 00166 00167 value_type status_; 00168 }; 00169 00170 00171 //============================================================================= 00172 } // namespace Attributes 00173 } // namespace OpenMesh 00174 //============================================================================= 00175 #endif // OPENMESH_ATTRIBUTE_STATUS_HH defined 00176 //=============================================================================