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 457 -
(hide annotations)
(download)
(as text)
Fri Jul 23 14:32:48 2010 UTC (14 years, 8 months ago) by amb
File MIME type: text/x-chdr
File size: 3859 byte(s)
Fri Jul 23 14:32:48 2010 UTC (14 years, 8 months ago) by amb
File MIME type: text/x-chdr
File size: 3859 byte(s)
Change the results structure to hold the index of the segment instead of a pointer to it.
1 | amb | 29 | /*************************************** |
2 | amb | 457 | $Header: /home/amb/CVS/routino/src/results.h,v 1.18 2010-07-23 14:32:16 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 | 457 | This file Copyright 2008-2010 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 | amb | 302 | /* Constants */ |
34 | |||
35 | /*+ A result is not currently queued. +*/ | ||
36 | #define NOT_QUEUED (uint32_t)(~0) | ||
37 | |||
38 | |||
39 | amb | 29 | /* Data structures */ |
40 | |||
41 | amb | 113 | /*+ The result for a node. +*/ |
42 | amb | 29 | typedef struct _Result |
43 | { | ||
44 | amb | 170 | index_t node; /*+ The node for which this result applies. +*/ |
45 | amb | 457 | index_t segment; /*+ The segment for the path to here (from prev). +*/ |
46 | amb | 113 | |
47 | amb | 170 | index_t prev; /*+ The previous node following the best path. +*/ |
48 | index_t next; /*+ The next node following the best path. +*/ | ||
49 | amb | 116 | |
50 | amb | 236 | score_t score; /*+ The best actual weighted distance or duration score from the start to the node. +*/ |
51 | amb | 116 | |
52 | amb | 236 | score_t sortby; /*+ The best possible weighted distance or duration score from the start to the finish. +*/ |
53 | uint32_t queued; /*+ The position of this result in the queue. +*/ | ||
54 | amb | 29 | } |
55 | Result; | ||
56 | |||
57 | /*+ A list of results. +*/ | ||
58 | typedef struct _Results | ||
59 | { | ||
60 | amb | 165 | uint32_t nbins; /*+ The number of bins. +*/ |
61 | uint32_t mask; /*+ A bit mask to select the bottom 'nbins' bits. +*/ | ||
62 | amb | 71 | |
63 | amb | 165 | uint32_t alloced; /*+ The amount of space allocated for results |
64 | amb | 79 | (the length of the number and pointers arrays and |
65 | 1/nbins times the amount in the real results). +*/ | ||
66 | amb | 165 | uint32_t number; /*+ The total number of occupied results. +*/ |
67 | amb | 71 | |
68 | amb | 79 | uint32_t *count; /*+ An array of nbins counters of results in each array. +*/ |
69 | Result ***point; /*+ An array of nbins arrays of pointers to actual results. +*/ | ||
70 | amb | 71 | |
71 | amb | 79 | Result **data; /*+ An array of arrays containing the actual results |
72 | (don't need to realloc the array of data when adding more, | ||
73 | only realloc the array that points to the array of data). | ||
74 | Most importantly pointers into the real data don't change | ||
75 | amb | 113 | as more space is allocated (since realloc is not being used). +*/ |
76 | amb | 165 | |
77 | index_t start; /*+ The start node. +*/ | ||
78 | index_t finish; /*+ The finish node. +*/ | ||
79 | amb | 29 | } |
80 | Results; | ||
81 | |||
82 | |||
83 | amb | 236 | /* Forward definitions for opaque type */ |
84 | |||
85 | typedef struct _Queue Queue; | ||
86 | |||
87 | |||
88 | amb | 234 | /* Results Functions */ |
89 | amb | 29 | |
90 | amb | 71 | Results *NewResultsList(int nbins); |
91 | amb | 29 | void FreeResultsList(Results *results); |
92 | |||
93 | amb | 116 | Result *InsertResult(Results *results,index_t node); |
94 | amb | 166 | void ZeroResult(Result *result); |
95 | amb | 29 | |
96 | amb | 116 | Result *FindResult(Results *results,index_t node); |
97 | amb | 29 | |
98 | amb | 79 | Result *FirstResult(Results *results); |
99 | Result *NextResult(Results *results,Result *result); | ||
100 | amb | 29 | |
101 | amb | 234 | |
102 | amb | 67 | /* Queue Functions */ |
103 | |||
104 | amb | 236 | Queue *NewQueueList(void); |
105 | void FreeQueueList(Queue *queue); | ||
106 | amb | 67 | |
107 | amb | 236 | void InsertInQueue(Queue *queue,Result *result); |
108 | Result *PopFromQueue(Queue *queue); | ||
109 | amb | 67 | |
110 | amb | 236 | |
111 | amb | 29 | #endif /* RESULTS_H */ |
Properties
Name | Value |
---|---|
cvs:description | Results data type. |