OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Status.hh
1 /*===========================================================================*\
2  * *
3  * OpenMesh *
4  * Copyright (C) 2001-2015 by Computer Graphics Group, RWTH Aachen *
5  * www.openmesh.org *
6  * *
7  *---------------------------------------------------------------------------*
8  * This file is part of OpenMesh. *
9  * *
10  * OpenMesh is free software: you can redistribute it and/or modify *
11  * it under the terms of the GNU Lesser General Public License as *
12  * published by the Free Software Foundation, either version 3 of *
13  * the License, or (at your option) any later version with the *
14  * following exceptions: *
15  * *
16  * If other files instantiate templates or use macros *
17  * or inline functions from this file, or you compile this file and *
18  * link it with other files to produce an executable, this file does *
19  * not by itself cause the resulting executable to be covered by the *
20  * GNU Lesser General Public License. This exception does not however *
21  * invalidate any other reasons why the executable file might be *
22  * covered by the GNU Lesser General Public License. *
23  * *
24  * OpenMesh is distributed in the hope that it will be useful, *
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27  * GNU Lesser General Public License for more details. *
28  * *
29  * You should have received a copy of the GNU LesserGeneral Public *
30  * License along with OpenMesh. If not, *
31  * see <http://www.gnu.org/licenses/>. *
32  * *
33 \*===========================================================================*/
34 
35 /*===========================================================================*\
36  * *
37  * $Revision: 1188 $ *
38  * $Date: 2015-01-05 16:34:10 +0100 (Mo, 05 Jan 2015) $ *
39  * *
40 \*===========================================================================*/
41 
42 
43 //=============================================================================
44 //
45 // CLASS Status
46 //
47 //=============================================================================
48 
49 
50 #ifndef OPENMESH_ATTRIBUTE_STATUS_HH
51 #define OPENMESH_ATTRIBUTE_STATUS_HH
52 
53 
54 //== INCLUDES =================================================================
55 
56 #include <OpenMesh/Core/System/config.h>
57 
58 
59 //== NAMESPACES ===============================================================
60 
61 
62 namespace OpenMesh {
63 namespace Attributes {
64 
65 
66 //== CLASS DEFINITION ========================================================
67 
68 
72 enum StatusBits {
73 
74  DELETED = 1,
75  LOCKED = 2,
76  SELECTED = 4,
77  HIDDEN = 8,
78  FEATURE = 16,
79  TAGGED = 32,
80  TAGGED2 = 64,
82  UNUSED = 256
83 };
84 
85 
93 {
94 public:
95 
96  typedef unsigned int value_type;
97 
98  StatusInfo() : status_(0) {}
99 
101  bool deleted() const { return is_bit_set(DELETED); }
103  void set_deleted(bool _b) { change_bit(DELETED, _b); }
104 
105 
107  bool locked() const { return is_bit_set(LOCKED); }
109  void set_locked(bool _b) { change_bit(LOCKED, _b); }
110 
111 
113  bool selected() const { return is_bit_set(SELECTED); }
115  void set_selected(bool _b) { change_bit(SELECTED, _b); }
116 
117 
119  bool hidden() const { return is_bit_set(HIDDEN); }
121  void set_hidden(bool _b) { change_bit(HIDDEN, _b); }
122 
123 
125  bool feature() const { return is_bit_set(FEATURE); }
127  void set_feature(bool _b) { change_bit(FEATURE, _b); }
128 
129 
131  bool tagged() const { return is_bit_set(TAGGED); }
133  void set_tagged(bool _b) { change_bit(TAGGED, _b); }
134 
135 
137  bool tagged2() const { return is_bit_set(TAGGED2); }
139  void set_tagged2(bool _b) { change_bit(TAGGED2, _b); }
140 
141 
146 
147 
149  unsigned int bits() const { return status_; }
151  void set_bits(unsigned int _bits) { status_ = _bits; }
152 
153 
155  bool is_bit_set(unsigned int _s) const { return (status_ & _s) > 0; }
157  void set_bit(unsigned int _s) { status_ |= _s; }
159  void unset_bit(unsigned int _s) { status_ &= ~_s; }
161  void change_bit(unsigned int _s, bool _b) {
162  if (_b) status_ |= _s; else status_ &= ~_s; }
163 
164 
165 private:
166 
167  value_type status_;
168 };
169 
170 
171 //=============================================================================
172 } // namespace Attributes
173 } // namespace OpenMesh
174 //=============================================================================
175 #endif // OPENMESH_ATTRIBUTE_STATUS_HH defined
176 //=============================================================================
bool is_bit_set(unsigned int _s) const
is a certain bit set ?
Definition: Status.hh:155
void change_bit(unsigned int _s, bool _b)
set or unset a certain bit
Definition: Status.hh:161
bool tagged2() const
is tagged2 ? This is just one more tag info.
Definition: Status.hh:137
Item is selected.
Definition: Status.hh:76
bool feature() const
is feature ?
Definition: Status.hh:125
bool fixed_nonmanifold() const
is fixed non-manifold ?
Definition: Status.hh:143
void set_tagged(bool _b)
set tagged
Definition: Status.hh:133
void set_selected(bool _b)
set selected
Definition: Status.hh:115
Unused.
Definition: Status.hh:82
void unset_bit(unsigned int _s)
unset a certain bit
Definition: Status.hh:159
void set_bits(unsigned int _bits)
set whole status at once
Definition: Status.hh:151
void set_fixed_nonmanifold(bool _b)
set fixed non-manifold
Definition: Status.hh:145
bool hidden() const
is hidden ?
Definition: Status.hh:119
Item is a feature or belongs to a feature.
Definition: Status.hh:78
bool tagged() const
is tagged ?
Definition: Status.hh:131
void set_feature(bool _b)
set feature
Definition: Status.hh:127
void set_hidden(bool _b)
set hidden
Definition: Status.hh:121
void set_tagged2(bool _b)
set tagged
Definition: Status.hh:139
bool locked() const
is locked ?
Definition: Status.hh:107
bool selected() const
is selected ?
Definition: Status.hh:113
Item is tagged.
Definition: Status.hh:79
void set_deleted(bool _b)
set deleted
Definition: Status.hh:103
Item is locked.
Definition: Status.hh:75
Item is hidden.
Definition: Status.hh:77
Alternate bit for tagging an item.
Definition: Status.hh:80
Add status information to a base class.
Definition: Status.hh:92
void set_bit(unsigned int _s)
set a certain bit
Definition: Status.hh:157
unsigned int bits() const
return whole status
Definition: Status.hh:149
StatusBits
Status bits used by the Status class.
Definition: Status.hh:72
Item was non-two-manifold and had to be fixed.
Definition: Status.hh:81
void set_locked(bool _b)
set locked
Definition: Status.hh:109
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56
Item has been deleted.
Definition: Status.hh:74
bool deleted() const
is deleted ?
Definition: Status.hh:101

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