Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Annotation of /trunk/src/results.h
Parent Directory
|
Revision Log
Revision 151 -
(hide annotations)
(download)
(as text)
Wed Apr 8 16:54:34 2009 UTC (15 years, 11 months ago) by amb
File MIME type: text/x-chdr
File size: 3322 byte(s)
Wed Apr 8 16:54:34 2009 UTC (15 years, 11 months ago) by amb
File MIME type: text/x-chdr
File size: 3322 byte(s)
Changed the license to Affero GPLv3.
1 | amb | 29 | /*************************************** |
2 | amb | 151 | $Header: /home/amb/CVS/routino/src/results.h,v 1.11 2009-04-08 16:54:34 amb Exp $ |
3 | amb | 29 | |
4 | A header file for the results. | ||
5 | amb | 151 | |
6 | Part of the Routino routing software. | ||
7 | amb | 29 | ******************/ /****************** |
8 | amb | 151 | This file Copyright 2008,2009 Andrew M. Bishop |
9 | amb | 29 | |
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 | 29 | ***************************************/ |
23 | |||
24 | |||
25 | #ifndef RESULTS_H | ||
26 | #define RESULTS_H /*+ To stop multiple inclusions. +*/ | ||
27 | |||
28 | #include <stdint.h> | ||
29 | |||
30 | amb | 116 | #include "types.h" |
31 | amb | 29 | |
32 | |||
33 | /* Data structures */ | ||
34 | |||
35 | amb | 113 | /*+ The result for a node. +*/ |
36 | amb | 29 | typedef struct _Result |
37 | { | ||
38 | amb | 116 | index_t node; /*+ The node for which this result applies. +*/ |
39 | amb | 113 | |
40 | amb | 116 | index_t prev; /*+ The previous node following the best path. +*/ |
41 | index_t next; /*+ The next node following the best path. +*/ | ||
42 | |||
43 | amb | 113 | distance_t distance; /*+ The distance travelled to the node following the best path. +*/ |
44 | duration_t duration; /*+ The time taken to the node following the best path. +*/ | ||
45 | amb | 116 | |
46 | distance_t sortby; /*+ The value to sort the results by in the queue. +*/ | ||
47 | amb | 29 | } |
48 | Result; | ||
49 | |||
50 | /*+ A list of results. +*/ | ||
51 | typedef struct _Results | ||
52 | { | ||
53 | amb | 71 | uint32_t nbins; /*+ The number of bins. +*/ |
54 | uint32_t mask; /*+ A bit mask to select the bottom 'nbins' bits. +*/ | ||
55 | |||
56 | amb | 79 | uint32_t alloced; /*+ The amount of space allocated for results |
57 | (the length of the number and pointers arrays and | ||
58 | 1/nbins times the amount in the real results). +*/ | ||
59 | amb | 45 | uint32_t number; /*+ The total number of occupied results. +*/ |
60 | amb | 71 | |
61 | amb | 79 | uint32_t *count; /*+ An array of nbins counters of results in each array. +*/ |
62 | Result ***point; /*+ An array of nbins arrays of pointers to actual results. +*/ | ||
63 | amb | 71 | |
64 | amb | 79 | Result **data; /*+ An array of arrays containing the actual results |
65 | (don't need to realloc the array of data when adding more, | ||
66 | only realloc the array that points to the array of data). | ||
67 | Most importantly pointers into the real data don't change | ||
68 | amb | 113 | as more space is allocated (since realloc is not being used). +*/ |
69 | amb | 29 | } |
70 | Results; | ||
71 | |||
72 | |||
73 | /* Functions */ | ||
74 | |||
75 | amb | 71 | Results *NewResultsList(int nbins); |
76 | amb | 29 | void FreeResultsList(Results *results); |
77 | |||
78 | amb | 116 | Result *InsertResult(Results *results,index_t node); |
79 | amb | 29 | |
80 | amb | 116 | Result *FindResult(Results *results,index_t node); |
81 | amb | 29 | |
82 | amb | 79 | Result *FirstResult(Results *results); |
83 | Result *NextResult(Results *results,Result *result); | ||
84 | amb | 29 | |
85 | amb | 67 | /* Queue Functions */ |
86 | |||
87 | amb | 79 | void insert_in_queue(Result *result); |
88 | Result *pop_from_queue(void); | ||
89 | amb | 67 | |
90 | |||
91 | amb | 29 | #endif /* RESULTS_H */ |
Properties
Name | Value |
---|---|
cvs:description | Results data type. |