Developer Documentation

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 #pragma once
43
44 #include <OpenFlipper/common/GlobalDefines.hh>
45 #include <bitset>
46 #include <QString>
47
48 typedef std::bitset<64> UpdateTypeSet;
49
60 class DLLEXPORT UpdateType {
61 public:
62 UpdateType();
63
64 UpdateType(const UpdateType& _type);
65
66 UpdateType(const UpdateTypeSet& _set);
67
69 bool operator==(const UpdateType& _type) const;
70
71 UpdateType operator|(const UpdateType& _type) const;
72
73 UpdateType& operator|=(const UpdateType& _type);
74
75 UpdateType& operator++();
76
77 bool operator<( const UpdateType& _i ) const;
78
80 bool contains( const UpdateType& _type ) const;
81
82 friend std::ostream &operator<< (
83 std::ostream &os, const UpdateType &type) {
84 return os << type.type_;
85 }
86
87 protected:
88 UpdateTypeSet type_;
89 };
90
97 const UpdateType UPDATE_NONE( UpdateTypeSet(0) );
99
101 const UpdateType UPDATE_ALL( UpdateTypeSet(1) );
102
104 const UpdateType UPDATE_VISIBILITY( UpdateTypeSet(1) << 1 );
105
106
112 const UpdateType UPDATE_GEOMETRY( UpdateTypeSet(1) << 2 );
113
119 const UpdateType UPDATE_TOPOLOGY( UpdateTypeSet(1) << 3 );
120
121
127 const UpdateType UPDATE_SELECTION( UpdateTypeSet(1) << 4 );
128
133 const UpdateType UPDATE_SELECTION_VERTICES( UpdateTypeSet(1) << 5 );
134
135
140 const UpdateType UPDATE_SELECTION_EDGES( UpdateTypeSet(1) << 6 );
141
142
147 const UpdateType UPDATE_SELECTION_HALFEDGES( UpdateTypeSet(1) << 7 );
148
153 const UpdateType UPDATE_SELECTION_FACES( UpdateTypeSet(1) << 8 );
154
159 const UpdateType UPDATE_SELECTION_KNOTS( UpdateTypeSet(1) << 9 );
160
165 const UpdateType UPDATE_COLOR( UpdateTypeSet(1) << 10 );
166
171 const UpdateType UPDATE_TEXTURE( UpdateTypeSet(1) << 11 );
172
177 const UpdateType UPDATE_STATE( UpdateTypeSet(1) << 12 );
178
180 const UpdateType UPDATE_UNUSED ( UpdateTypeSet(1) << 13 );
181
184 //=====================================================================================
185 // FUNCTIONS
186 //=====================================================================================
187
188
200 DLLEXPORT
201 UpdateType addUpdateType(QString _name, bool _resetNeeded = true);
202
204 DLLEXPORT
205 UpdateType updateType(QString _name);
206
212 DLLEXPORT
213 QString updateTypeName(UpdateType _id);
214
220 DLLEXPORT
221 size_t updateTypeCount();
222
UPDATE_SELECTION_VERTICES
const UpdateType UPDATE_SELECTION_VERTICES(UpdateTypeSet(1)<< 5)
Vertex selection has changed.
UpdateType
Update type class.
Definition: UpdateType.hh:60
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
GlobalDefines.hh
UPDATE_SELECTION
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
UPDATE_TEXTURE
const UpdateType UPDATE_TEXTURE(UpdateTypeSet(1)<< 11)
Textures have changed.
UPDATE_STATE
const UpdateType UPDATE_STATE(UpdateTypeSet(1)<< 12)
State has changed.
updateTypeCount
DLLEXPORT size_t updateTypeCount()
Get the number of registered types.
Definition: UpdateType.cc:299
UPDATE_VISIBILITY
const UpdateType UPDATE_VISIBILITY(UpdateTypeSet(1)<< 1)
This is the update identifier for global Object visibility ( show/hide )
UPDATE_NONE
const UpdateType UPDATE_NONE(UpdateTypeSet(0))
Empty update for empty initialization of update type.
UPDATE_UNUSED
const UpdateType UPDATE_UNUSED(UpdateTypeSet(1)<< 13)
marks the last used ID
UPDATE_GEOMETRY
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
UPDATE_SELECTION_KNOTS
const UpdateType UPDATE_SELECTION_KNOTS(UpdateTypeSet(1)<< 9)
Knot selection has changed.
updateTypeName
DLLEXPORT QString updateTypeName(UpdateType _id)
Get the name of a type with given id.
Definition: UpdateType.cc:267
updateType
DLLEXPORT UpdateType updateType(QString _name)
Given an UpdateType Identifier string this function will return the id of the UpdateType.
Definition: UpdateType.cc:252
UPDATE_SELECTION_HALFEDGES
const UpdateType UPDATE_SELECTION_HALFEDGES(UpdateTypeSet(1)<< 7)
Halfedge selection has changed.
UPDATE_TOPOLOGY
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(1)<< 3)
Topology updated.
UPDATE_SELECTION_EDGES
const UpdateType UPDATE_SELECTION_EDGES(UpdateTypeSet(1)<< 6)
Edge selection has changed.
UPDATE_COLOR
const UpdateType UPDATE_COLOR(UpdateTypeSet(1)<< 10)
Colors have changed.
UPDATE_SELECTION_FACES
const UpdateType UPDATE_SELECTION_FACES(UpdateTypeSet(1)<< 8)
Face selection has changed.
DLLEXPORT
#define DLLEXPORT
Definition: GlobalDefines.hh:95
addUpdateType
DLLEXPORT UpdateType addUpdateType(QString _name, bool _resetNeeded=true)
Adds a updateType and returns the id for the new type.
Definition: UpdateType.cc:229