Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Annotation of /trunk/src/waysx.h
Parent Directory
|
Revision Log
Revision 310 -
(hide annotations)
(download)
(as text)
Fri Dec 11 19:27:39 2009 UTC (15 years, 4 months ago) by amb
File MIME type: text/x-chdr
File size: 2807 byte(s)
Fri Dec 11 19:27:39 2009 UTC (15 years, 4 months ago) by amb
File MIME type: text/x-chdr
File size: 2807 byte(s)
Added a new function to sort variable length data - simplifies the compacting of ways, reduces memory usage potentially required for it and simplifies the code.
1 | amb | 110 | /*************************************** |
2 | amb | 310 | $Header: /home/amb/CVS/routino/src/waysx.h,v 1.19 2009-12-11 19:27:39 amb Exp $ |
3 | amb | 110 | |
4 | A header file for the extended Ways structure. | ||
5 | amb | 151 | |
6 | Part of the Routino routing software. | ||
7 | amb | 110 | ******************/ /****************** |
8 | amb | 151 | This file Copyright 2008,2009 Andrew M. Bishop |
9 | amb | 110 | |
10 | amb | 151 | 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 | amb | 110 | ***************************************/ |
23 | |||
24 | |||
25 | #ifndef WAYSX_H | ||
26 | #define WAYSX_H /*+ To stop multiple inclusions. +*/ | ||
27 | |||
28 | #include <stdint.h> | ||
29 | |||
30 | amb | 199 | #include "typesx.h" |
31 | amb | 110 | #include "types.h" |
32 | amb | 262 | #include "ways.h" |
33 | amb | 307 | #include "profiles.h" |
34 | amb | 110 | |
35 | |||
36 | /* Data structures */ | ||
37 | |||
38 | |||
39 | /*+ An extended structure containing a single way. +*/ | ||
40 | struct _WayX | ||
41 | { | ||
42 | amb | 203 | way_t id; /*+ The way identifier. +*/ |
43 | |||
44 | amb | 310 | index_t prop; /*+ The index of the properties of the way in the compacted list. +*/ |
45 | |||
46 | amb | 262 | Way way; /*+ The real Way data. +*/ |
47 | amb | 110 | }; |
48 | |||
49 | |||
50 | /*+ A structure containing a set of ways (memory format). +*/ | ||
51 | struct _WaysX | ||
52 | { | ||
53 | amb | 262 | 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 | amb | 216 | |
56 | amb | 262 | uint32_t xnumber; /*+ The number of unsorted extended ways. +*/ |
57 | amb | 216 | |
58 | amb | 262 | 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 | amb | 215 | uint32_t number; /*+ How many entries are still useful? +*/ |
62 | amb | 110 | |
63 | amb | 262 | uint32_t cnumber; /*+ How many entries are there after compacting? +*/ |
64 | amb | 203 | |
65 | amb | 310 | index_t *idata; /*+ The index of the extended data for the Ways (sorted by ID). +*/ |
66 | amb | 203 | |
67 | amb | 262 | char *nfilename; /*+ The name of the temporary file (for the names). +*/ |
68 | amb | 203 | |
69 | amb | 262 | uint32_t nlength; /*+ How long is the string of name entries? +*/ |
70 | amb | 110 | }; |
71 | |||
72 | |||
73 | /* Functions */ | ||
74 | |||
75 | |||
76 | WaysX *NewWayList(void); | ||
77 | amb | 226 | void FreeWayList(WaysX *waysx); |
78 | amb | 110 | |
79 | amb | 307 | void SaveWayList(WaysX *waysx,const char *filename,Profile *profile); |
80 | amb | 110 | |
81 | amb | 262 | index_t IndexWayX(WaysX* waysx,way_t id); |
82 | WayX *LookupWayX(WaysX* waysx,index_t index,int position); | ||
83 | amb | 110 | |
84 | amb | 262 | void AppendWay(WaysX* waysx,way_t id,Way *way,const char *name); |
85 | amb | 203 | |
86 | amb | 110 | void SortWayList(WaysX *waysx); |
87 | |||
88 | #endif /* WAYSX_H */ |
Properties
Name | Value |
---|---|
cvs:description | Extended ways header. |