Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
UpdateType.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 
51 #ifndef UPDATETYPE_HH
52 #define UPDATETYPE_HH
53 
55 #include <bitset>
56 #include <QString>
57 
58 typedef std::bitset<64> UpdateTypeSet;
59 
71  public:
72  UpdateType();
73 
74  UpdateType(const UpdateType& _type);
75 
76  UpdateType(UpdateTypeSet _set);
77 
79  bool operator==(const UpdateType& _type) const;
80 
81  UpdateType operator|(const UpdateType& _type) const;
82 
83  UpdateType& operator|=(const UpdateType& _type);
84 
85  UpdateType& operator++();
86 
87  bool operator<( const UpdateType& _i ) const;
88 
90  bool contains( const UpdateType& _type ) const;
91 
92  friend std::ostream &operator<< (
93  std::ostream &os, const UpdateType &type) {
94  return os << type.type_;
95  }
96 
97  protected:
98  UpdateTypeSet type_;
99 };
100 
107 const UpdateType UPDATE_NONE( UpdateTypeSet(0) );
109 
111 const UpdateType UPDATE_ALL( UpdateTypeSet(1) );
112 
114 const UpdateType UPDATE_VISIBILITY( UpdateTypeSet(1) << 1 );
115 
116 
122 const UpdateType UPDATE_GEOMETRY( UpdateTypeSet(1) << 2 );
123 
129 const UpdateType UPDATE_TOPOLOGY( UpdateTypeSet(1) << 3 );
130 
131 
137 const UpdateType UPDATE_SELECTION( UpdateTypeSet(1) << 4 );
138 
143 const UpdateType UPDATE_SELECTION_VERTICES( UpdateTypeSet(1) << 5 );
144 
145 
150 const UpdateType UPDATE_SELECTION_EDGES( UpdateTypeSet(1) << 6 );
151 
152 
157 const UpdateType UPDATE_SELECTION_HALFEDGES( UpdateTypeSet(1) << 7 );
158 
163 const UpdateType UPDATE_SELECTION_FACES( UpdateTypeSet(1) << 8 );
164 
169 const UpdateType UPDATE_SELECTION_KNOTS( UpdateTypeSet(1) << 9 );
170 
175 const UpdateType UPDATE_COLOR( UpdateTypeSet(1) << 10 );
176 
181 const UpdateType UPDATE_TEXTURE( UpdateTypeSet(1) << 11 );
182 
187 const UpdateType UPDATE_STATE( UpdateTypeSet(1) << 12 );
188 
190 const UpdateType UPDATE_UNUSED ( UpdateTypeSet(1) << 13 );
191 
194 //=====================================================================================
195 // FUNCTIONS
196 //=====================================================================================
197 
198 
210 DLLEXPORT
211 UpdateType addUpdateType(QString _name, bool _resetNeeded = true);
212 
214 DLLEXPORT
215 UpdateType updateType(QString _name);
216 
222 DLLEXPORT
223 QString updateTypeName(UpdateType _id);
224 
230 DLLEXPORT
231 size_t updateTypeCount();
232 
235 #endif // UPDATETYPE_HH
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
const UpdateType UPDATE_SELECTION_VERTICES(UpdateTypeSet(1)<< 5)
Vertex selection has changed.
Update type class.
Definition: UpdateType.hh:70
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
DLLEXPORT UpdateType addUpdateType(QString _name, bool _resetNeeded=true)
Adds a updateType and returns the id for the new type.
Definition: UpdateType.cc:236
const UpdateType UPDATE_NONE(UpdateTypeSet(0))
Empty update for empty initialization of update type.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
const UpdateType UPDATE_STATE(UpdateTypeSet(1)<< 12)
State has changed.
const UpdateType UPDATE_UNUSED(UpdateTypeSet(1)<< 13)
marks the last used ID
const UpdateType UPDATE_TEXTURE(UpdateTypeSet(1)<< 11)
Textures have changed.
const UpdateType UPDATE_SELECTION_EDGES(UpdateTypeSet(1)<< 6)
Edge selection has changed.
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(1)<< 3)
Topology updated.
const UpdateType UPDATE_SELECTION_KNOTS(UpdateTypeSet(1)<< 9)
Knot selection has changed.
const UpdateType UPDATE_SELECTION_HALFEDGES(UpdateTypeSet(1)<< 7)
Halfedge selection has changed.
#define DLLEXPORT
const UpdateType UPDATE_COLOR(UpdateTypeSet(1)<< 10)
Colors have changed.
DLLEXPORT UpdateType updateType(QString _name)
Given an UpdateType Identifier string this function will return the id of the UpdateType.
Definition: UpdateType.cc:259
DLLEXPORT QString updateTypeName(UpdateType _id)
Get the name of a type with given id.
Definition: UpdateType.cc:274
DLLEXPORT size_t updateTypeCount()
Get the number of registered types.
Definition: UpdateType.cc:289
const UpdateType UPDATE_VISIBILITY(UpdateTypeSet(1)<< 1)
This is the update identifier for global Object visibility ( show/hide )
const UpdateType UPDATE_SELECTION_FACES(UpdateTypeSet(1)<< 8)
Face selection has changed.