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 
45 #include <QString>
46 
47 typedef uint64_t UpdateTypeSet;
48 
60  public:
61  UpdateType();
62 
63  UpdateType(const UpdateType& _type) = default;
64 
65  explicit UpdateType(const UpdateTypeSet& _set);
66 
68  bool operator==(const UpdateType& _type) const;
69 
70  UpdateType operator|(const UpdateType& _type) const;
71 
72  UpdateType& operator|=(const UpdateType& _type);
73 
74  UpdateType& operator++();
75 
76  bool operator<( const UpdateType& _i ) const;
77 
79  bool contains( const UpdateType& _type ) const;
80 
81 // friend std::ostream &operator<< (
82 // std::ostream &os, const UpdateType &type) {
83 // return os << type.type_;
84 // }
85 
86  private:
87  UpdateTypeSet type_;
88 };
89 
96 const UpdateType UPDATE_NONE( UpdateTypeSet(0) );
98 
100 const UpdateType UPDATE_ALL( UpdateTypeSet(1) );
101 
103 const UpdateType UPDATE_VISIBILITY( UpdateTypeSet(2) );
104 
105 
111 const UpdateType UPDATE_GEOMETRY( UpdateTypeSet(4) );
112 
118 const UpdateType UPDATE_TOPOLOGY( UpdateTypeSet(8) );
119 
120 
126 const UpdateType UPDATE_SELECTION( UpdateTypeSet(16) );
127 
132 const UpdateType UPDATE_SELECTION_VERTICES( UpdateTypeSet(32) );
133 
134 
139 const UpdateType UPDATE_SELECTION_EDGES( UpdateTypeSet(64) );
140 
141 
146 const UpdateType UPDATE_SELECTION_HALFEDGES( UpdateTypeSet(128) );
147 
152 const UpdateType UPDATE_SELECTION_FACES( UpdateTypeSet(256) );
153 
158 const UpdateType UPDATE_SELECTION_KNOTS( UpdateTypeSet(512) );
159 
164 const UpdateType UPDATE_COLOR( UpdateTypeSet(1024) );
165 
170 const UpdateType UPDATE_TEXTURE( UpdateTypeSet(2048) );
171 
176 const UpdateType UPDATE_STATE( UpdateTypeSet(4096) );
177 
179 const UpdateType UPDATE_UNUSED ( UpdateTypeSet(8192) );
180 
183 //=====================================================================================
184 // FUNCTIONS
185 //=====================================================================================
186 
187 
199 DLLEXPORT
200 UpdateType addUpdateType(QString _name, bool _resetNeeded = true);
201 
203 DLLEXPORT
204 UpdateType updateType(QString _name);
205 
211 DLLEXPORT
212 QString updateTypeName(UpdateType _id);
213 
219 DLLEXPORT
220 size_t updateTypeCount();
221 
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(8))
Topology updated.
DLLEXPORT UpdateType addUpdateType(QString _name, bool _resetNeeded=true)
Adds a updateType and returns the id for the new type.
Definition: UpdateType.cc:232
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
#define DLLEXPORT
DLLEXPORT QString updateTypeName(UpdateType _id)
Get the name of a type with given id.
Definition: UpdateType.cc:270
const UpdateType UPDATE_SELECTION(UpdateTypeSet(16))
Selection updated.
unsigned long long uint64_t
Definition: SR_types.hh:89
const UpdateType UPDATE_TEXTURE(UpdateTypeSet(2048))
Textures have changed.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(4))
Geometry updated.
const UpdateType UPDATE_SELECTION_HALFEDGES(UpdateTypeSet(128))
Halfedge selection has changed.
const UpdateType UPDATE_UNUSED(UpdateTypeSet(8192))
marks the last used ID
const UpdateType UPDATE_STATE(UpdateTypeSet(4096))
State has changed.
Update type class.
Definition: UpdateType.hh:59
const UpdateType UPDATE_SELECTION_KNOTS(UpdateTypeSet(512))
Knot selection has changed.
const UpdateType UPDATE_COLOR(UpdateTypeSet(1024))
Colors have changed.
const UpdateType UPDATE_SELECTION_EDGES(UpdateTypeSet(64))
Edge selection has changed.
const UpdateType UPDATE_VISIBILITY(UpdateTypeSet(2))
This is the update identifier for global Object visibility ( show/hide )
const UpdateType UPDATE_SELECTION_FACES(UpdateTypeSet(256))
Face selection has changed.
DLLEXPORT size_t updateTypeCount()
Get the number of registered types.
Definition: UpdateType.cc:302
const UpdateType UPDATE_NONE(UpdateTypeSet(0))
Empty update for empty initialization of update type.
DLLEXPORT UpdateType updateType(QString _name)
Given an UpdateType Identifier string this function will return the id of the UpdateType.
Definition: UpdateType.cc:255
const UpdateType UPDATE_SELECTION_VERTICES(UpdateTypeSet(32))
Vertex selection has changed.