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/waysx.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 262 - (show annotations) (download) (as text)
Thu Sep 17 12:55:15 2009 UTC (15 years, 6 months ago) by amb
File MIME type: text/x-chdr
File size: 3147 byte(s)
Added the slim mode to Ways as well.

1 /***************************************
2 $Header: /home/amb/CVS/routino/src/waysx.h,v 1.16 2009-09-17 12:55:15 amb Exp $
3
4 A header file for the extended Ways structure.
5
6 Part of the Routino routing software.
7 ******************/ /******************
8 This file Copyright 2008,2009 Andrew M. Bishop
9
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.
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 Affero General Public License for more details.
19
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 ***************************************/
23
24
25 #ifndef WAYSX_H
26 #define WAYSX_H /*+ To stop multiple inclusions. +*/
27
28 #include <stdint.h>
29
30 #include "typesx.h"
31 #include "types.h"
32 #include "ways.h"
33
34
35 /* Data structures */
36
37
38 /*+ An extended structure containing a single way. +*/
39 struct _WayX
40 {
41 way_t id; /*+ The way identifier. +*/
42 index_t cid; /*+ The index of the way in the compacted ways. +*/
43
44 Way way; /*+ The real Way data. +*/
45
46 index_t name; /*+ The index of the name of the way. +*/
47 };
48
49
50 /*+ A structure containing a set of ways (memory format). +*/
51 struct _WaysX
52 {
53 char *filename; /*+ The name of the temporary file (for the WaysX). +*/
54 int fd; /*+ The file descriptor of the temporary file (for the WaysX). +*/
55
56 uint32_t xnumber; /*+ The number of unsorted extended ways. +*/
57
58 WayX *xdata; /*+ The extended data for the Ways (sorted). +*/
59 WayX cached[2]; /*+ Two cached ways read from the file in slim mode. +*/
60
61 uint32_t number; /*+ How many entries are still useful? +*/
62
63 uint32_t cnumber; /*+ How many entries are there after compacting? +*/
64
65 index_t *idata; /*+ The extended data for the Ways (sorted by ID). +*/
66
67 char *nfilename; /*+ The name of the temporary file (for the names). +*/
68 int nfd; /*+ The file descriptor of the temporary file (for the names). +*/
69
70 char *names; /*+ The names of the ways (unsorted). +*/
71
72 uint32_t nnumber; /*+ How many names are there after compacting? +*/
73
74 uint32_t nlength; /*+ How long is the string of name entries? +*/
75 };
76
77
78 /* Functions */
79
80
81 WaysX *NewWayList(void);
82 void FreeWayList(WaysX *waysx);
83
84 void SaveWayList(WaysX *waysx,const char *filename);
85
86 index_t IndexWayX(WaysX* waysx,way_t id);
87 WayX *LookupWayX(WaysX* waysx,index_t index,int position);
88
89 void AppendWay(WaysX* waysx,way_t id,Way *way,const char *name);
90
91 void SortWayList(WaysX *waysx);
92
93 void CompactWayNames(WaysX* waysx);
94 void CompactWayProperties(WaysX* waysx);
95
96 #endif /* WAYSX_H */

Properties

Name Value
cvs:description Extended ways header.