Moka kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
kernel-types.hh
Go to the documentation of this file.
1 /*
2  * lib-gmapkernel : Un noyau de 3-G-cartes et des opérations.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-gmapkernel
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #ifndef KERNEL_TYPES_HH
26 #define KERNEL_TYPES_HH
27 //******************************************************************************
28 #include "attributes-id.hh"
29 #include "alt-stdint.hh"
30 
31 #include <bitset>
32 #include <string>
33 //******************************************************************************
41 //******************************************************************************
42 // @name Macros
43 // @{
44 
48 #define NB_MARKS (32)
49 
53 #define NB_DIRECT_INFO (4)
54 
55 // @}
56 
57 //******************************************************************************
59 typedef int8_t TOrbit;
60 
61 // @name Orbites de base
62 // @{
63 enum
64 {
65  ORBIT_NONE = -1,
82 
87 };
88 
89 // @}
90 //******************************************************************************
91 // @name Types d'attributs
92 // @{
93 
94 typedef int TAttributeId;
95 
98 
99 // @}
100 //******************************************************************************
106 // @{
107 
115 #define NEG_ORBIT(O1) \
116  (static_cast<TOrbit> (0xF ^ (static_cast<unsigned int>(O1))))
117 
126 #define ADD_ORBIT(O1,O2) \
127  (static_cast<TOrbit>( \
128  static_cast<unsigned int>(O1) | \
129  static_cast<unsigned int>(O2)))
130 
139 #define AND_ORBIT(O1,O2) \
140  (static_cast<TOrbit>( \
141  static_cast<unsigned int>(O1) & \
142  static_cast<unsigned int>(O2)))
143 
152 #define SUB_ORBIT(O1,O2) \
153  (static_cast<TOrbit>( \
154  static_cast<unsigned int>(O1) & \
155  static_cast<unsigned int>(NEG_ORBIT(O2))))
156 
164 #define IS_ORBIT_INCLUDED(O1,O2) \
165  (static_cast<TOrbit>( \
166  static_cast<unsigned int>(O1) & \
167  static_cast<unsigned int>(O2)) == O1)
168 
169 // @}
170 //****************************************************************************
171 // @name Orbites ayant une sémantique géométrique.
172 // @{
173 
174 const TOrbit ORBIT_VERTEX = ORBIT_123 ; //@< Orbite sommet.
175 const TOrbit ORBIT_EDGE = ORBIT_023 ; //@< Orbite arête.
176 const TOrbit ORBIT_FACE = ORBIT_013 ; //@< Orbite face.
177 const TOrbit ORBIT_VOLUME = ORBIT_012 ; //@< Orbite volume.
178 const TOrbit ORBIT_CC = ORBIT_0123; //@< Orbite composante connexe.
179 
180 // @}
181 
182 //****************************************************************************
183 // @name Ensembles d'orbites particuliers.
184 // @{
185 
188 const TOrbit ORBIT_INF[4] =
189 {
191 };
192 
194 const TOrbit ORBIT_CELL[5] =
195 {
197 };
198 
200 const TOrbit ORBIT_BORDER [4] =
201 {
203 };
204 
207 const TOrbit ORBIT_I_IM1[4] =
208 {
210 };
211 
214 const TOrbit ORBIT_I_IP1[4] =
215 {
217 };
218 
221 const TOrbit ORBIT_INVO[4] =
222 {
224 };
225 
227 const TOrbit ORBIT_SEWS[4] =
228 {
230 };
231 
233 const TOrbit ORBIT_DIM[4] =
234 {
236 };
237 
238 // @}
239 
240 //******************************************************************************
241 // @name Opérations (interne au fonctionnement des parcours).
242 
243 // @{
244 
248 
249 enum
250 {
252  OP_NONE = -1,
253 
269 
277 
278  // Lorsqu'on parcourt une liste de brins (static et multidynamic coverages).
280 };
281 
282 // @}
283 
284 //****************************************************************************
293 // @{
294 
296 typedef std::bitset<16> TMask16;
297 
298 //****************************************************************************
306 
307 
309 const TMask16 MASK_FALSE((unsigned int) 0x0000); // 0000 0000 0000 0000
311 const TMask16 MASK_TRUE((unsigned int) 0xFFFF); // 1111 1111 1111 1111
312 
315 const TMask16 MASK0((unsigned int) 0xAAAA); // 1010 1010 1010 1010
318 const TMask16 MASK1((unsigned int) 0xCCCC); // 1100 1100 1100 1100
321 const TMask16 MASK2((unsigned int) 0xF0F0); // 1111 0000 1111 0000
324 const TMask16 MASK3((unsigned int) 0xFF00); // 1111 1111 0000 0000
325 
327 const TMask16 MASK0M2(MASK0 & ~MASK2);
328 const TMask16 MASK0M3(MASK0 & ~MASK3);
329 const TMask16 MASK1M3(MASK1 & ~MASK3);
330 const TMask16 MASK2M0(MASK2 & ~MASK0);
331 const TMask16 MASK3M0(MASK3 & ~MASK0);
332 const TMask16 MASK3M1(MASK3 & ~MASK1);
333 
334 // @}
335 
336 //******************************************************************************
338 
342 
343 enum
344 {
346 
349 
351 };
352 
354 
355 //******************************************************************************
356 #endif // KERNEL_TYPES_HH
357 //******************************************************************************