Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Contents of /trunk/src/typesx.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1144 - (show annotations) (download) (as text)
Sat Nov 17 13:29:13 2012 UTC (12 years, 4 months ago) by amb
File MIME type: text/x-chdr
File size: 3510 byte(s)
Change the type-casting of some constants.

1 /***************************************
2 Type definitions for eXtended types.
3
4 Part of the Routino routing software.
5 ******************/ /******************
6 This file Copyright 2008-2012 Andrew M. Bishop
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Affero General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Affero General Public License for more details.
17
18 You should have received a copy of the GNU Affero General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ***************************************/
21
22
23 #ifndef TYPESX_H
24 #define TYPESX_H /*+ To stop multiple inclusions. +*/
25
26
27 #include <inttypes.h>
28 #include <stdint.h>
29 #include <string.h>
30 #include <stdlib.h>
31
32
33 /* Constants and macros for handling them */
34
35 /*+ An undefined node ID. +*/
36 #define NO_NODE_ID ((node_t)~0)
37
38 /*+ An undefined way ID. +*/
39 #define NO_WAY_ID ((way_t)~0)
40
41 /*+ An undefined relation ID. +*/
42 #define NO_RELATION_ID ((relation_t)~0)
43
44 /*+ The maximum number of segments per node (used to size temporary storage). +*/
45 #define MAX_SEG_PER_NODE 32
46
47
48 /* Bit mask macro types and functions */
49
50 #define BitMask uint32_t
51
52 #define AllocBitMask(xx) (BitMask*)calloc((1+(xx)/32),sizeof(BitMask))
53
54 #define ClearAllBits(xx,yy) memset((xx), 0,(1+(yy)/32)*sizeof(BitMask))
55 #define SetAllBits(xx,yy) memset((xx),~0,(1+(yy)/32)*sizeof(BitMask))
56
57 #define ClearBit(xx,yy) (xx)[(yy)/32]&=~(((BitMask)1)<<((yy)%32))
58 #define SetBit(xx,yy) (xx)[(yy)/32]|= (((BitMask)1)<<((yy)%32))
59
60 #define IsBitSet(xx,yy) ((xx)[(yy)/32]& (((BitMask)1)<<((yy)%32)))
61
62
63 /* Simple Types */
64
65 /*+ A node identifier - must be at least as large as index_t. +*/
66 typedef uint32_t node_t;
67
68 /*+ A way identifier - must be at least as large as index_t. +*/
69 typedef uint32_t way_t;
70
71 /*+ A relation identifier - must be at least as large as index_t. +*/
72 typedef uint32_t relation_t;
73
74
75 /*+ A printf formatting string for a node_t type (this should match the node_t definition above). +*/
76 #define Pnode_t PRIu32 /* PRIu32 and PRIu64 are defined in intypes.h */
77
78 /*+ A printf formatting string for a way_t type (this should match the way_t definition above). +*/
79 #define Pway_t PRIu32 /* PRIu32 and PRIu64 are defined in intypes.h */
80
81 /*+ A printf formatting string for a relation_t type (this should match the relation_t definition above). +*/
82 #define Prelation_t PRIu32 /* PRIu32 and PRIu64 are defined in intypes.h */
83
84
85 /* Enumerated types */
86
87 /*+ Turn restrictions. +*/
88 typedef enum _TurnRestriction
89 {
90 TurnRestrict_None =0,
91 TurnRestrict_no_right_turn,
92 TurnRestrict_no_left_turn,
93 TurnRestrict_no_u_turn,
94 TurnRestrict_no_straight_on,
95 TurnRestrict_only_right_turn,
96 TurnRestrict_only_left_turn,
97 TurnRestrict_only_straight_on
98 }
99 TurnRestriction;
100
101
102 /* Data structures */
103
104 typedef struct _NodeX NodeX;
105
106 typedef struct _NodesX NodesX;
107
108 typedef struct _SegmentX SegmentX;
109
110 typedef struct _SegmentsX SegmentsX;
111
112 typedef struct _WayX WayX;
113
114 typedef struct _WaysX WaysX;
115
116 typedef struct _RouteRelX RouteRelX;
117
118 typedef struct _TurnRestrictRelX TurnRestrictRelX;
119
120 typedef struct _RelationsX RelationsX;
121
122
123 #endif /* TYPESX_H */

Properties

Name Value
cvs:description Extended data types.