1 /***************************************
2 $Header: /home/amb/routino/src/RCS/ways.h,v 1.37 2010/05/29 13:54:24 amb Exp $
4 A header file for the ways.
6 Part of the Routino routing software.
7 ******************/ /******************
8 This file Copyright 2008-2010 Andrew M. Bishop
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Affero 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.
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 Affero General Public License for more details.
20 You should have received a copy of the GNU Affero General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ***************************************/
26 #define WAYS_H /*+ To stop multiple inclusions. +*/
36 /*+ A structure containing a single way (members ordered to minimise overall size). +*/
39 index_t name; /*+ The offset of the name of the way in the names array. +*/
41 wayallow_t allow; /*+ The type of traffic allowed on the way. +*/
43 waytype_t type; /*+ The highway type of the way. +*/
45 wayprop_t props; /*+ The properties of the way. +*/
47 speed_t speed; /*+ The defined maximum speed limit of the way. +*/
49 weight_t weight; /*+ The defined maximum weight of traffic on the way. +*/
50 height_t height; /*+ The defined maximum height of traffic on the way. +*/
51 width_t width; /*+ The defined maximum width of traffic on the way. +*/
52 length_t length; /*+ The defined maximum length of traffic on the way. +*/
56 /*+ A structure containing a set of ways (mmap format). +*/
59 uint32_t number; /*+ How many ways are stored? +*/
60 uint32_t onumber; /*+ How many ways were there originally? +*/
62 wayallow_t allow; /*+ The types of traffic that were seen when parsing. +*/
63 wayprop_t props; /*+ The properties that were seen when parsing. +*/
65 Way *ways; /*+ An array of ways. +*/
66 char *names; /*+ An array of characters containing the names. +*/
68 void *data; /*+ The memory mapped data. +*/
75 /*+ Return a Way* pointer given a set of ways and an index. +*/
76 #define LookupWay(xxx,yyy) (&(xxx)->ways[yyy])
78 /*+ Return the raw name of a way given the Way pointer and a set of ways. +*/
79 #define WayNameRaw(xxx,yyy) (&(xxx)->names[(yyy)->name])
81 /*+ Decide if a way has a name or not. +*/
82 #define WayNamed(xxx,yyy) ((xxx)->names[(yyy)->name])
84 /*+ Return the name of a way if it has one or the name of the highway type otherwise. +*/
85 #define WayNameHighway(xxx,yyy) (WayNamed(xxx,yyy)?WayNameRaw(xxx,yyy):HighwayName(HIGHWAY(yyy->type)))
91 Ways *LoadWayList(const char *filename);
93 int WaysCompare(Way *way1,Way *way2);