Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /trunk/src/results.h
Parent Directory
|
Revision Log
Revision 31 -
(show annotations)
(download)
(as text)
Sun Jan 11 09:28:31 2009 UTC (16 years, 2 months ago) by amb
File MIME type: text/x-chdr
File size: 2552 byte(s)
Sun Jan 11 09:28:31 2009 UTC (16 years, 2 months ago) by amb
File MIME type: text/x-chdr
File size: 2552 byte(s)
Working version with supersegments and junctions.
1 | /*************************************** |
2 | $Header: /home/amb/CVS/routino/src/results.h,v 1.2 2009-01-11 09:28:31 amb Exp $ |
3 | |
4 | A header file for the results. |
5 | ******************/ /****************** |
6 | Written by Andrew M. Bishop |
7 | |
8 | This file Copyright 2009 Andrew M. Bishop |
9 | It may be distributed under the GNU Public License, version 2, or |
10 | any higher version. See section COPYING of the GNU Public license |
11 | for conditions under which this file may be redistributed. |
12 | ***************************************/ |
13 | |
14 | |
15 | #ifndef RESULTS_H |
16 | #define RESULTS_H /*+ To stop multiple inclusions. +*/ |
17 | |
18 | #include <stdint.h> |
19 | |
20 | #include "nodes.h" |
21 | #include "segments.h" |
22 | |
23 | |
24 | /* Constants */ |
25 | |
26 | |
27 | #if 1 /* set to 0 to use a flat array, 1 for indexed. */ |
28 | |
29 | /*+ The array size increment for results. +*/ |
30 | #define INCREMENT_RESULTS 256 |
31 | |
32 | /*+ The number of bins for results. +*/ |
33 | #define NBINS_RESULTS 1024 |
34 | |
35 | #else |
36 | |
37 | /*+ The array size increment for results. +*/ |
38 | #define INCREMENT_RESULTS 256*1024 |
39 | |
40 | #undef NBINS_RESULTS |
41 | |
42 | #endif |
43 | |
44 | |
45 | /* Data structures */ |
46 | |
47 | /*+ One part of the result for a node. +*/ |
48 | typedef struct _HalfResult |
49 | { |
50 | Node *Prev; /*+ The previous Node following the shortest path. +*/ |
51 | Node *Next; /*+ The next Node following the shortest path. +*/ |
52 | distance_t distance; /*+ The distance travelled to the node following the shortest path. +*/ |
53 | duration_t duration; /*+ The time taken to the node following the shortest path. +*/ |
54 | } |
55 | HalfResult; |
56 | |
57 | /*+ One complete result for a node. +*/ |
58 | typedef struct _Result |
59 | { |
60 | node_t node; /*+ The end node. +*/ |
61 | Node *Node; /*+ The end Node. +*/ |
62 | HalfResult shortest; /*+ The result for the shortest path. +*/ |
63 | HalfResult quickest; /*+ The result for the quickest path. +*/ |
64 | } |
65 | Result; |
66 | |
67 | /*+ A list of results. +*/ |
68 | typedef struct _Results |
69 | { |
70 | uint32_t alloced; /*+ The amount of space allocated for results in the array +*/ |
71 | #ifdef NBINS_RESULTS |
72 | uint32_t number[NBINS_RESULTS]; /*+ The number of occupied results in the array +*/ |
73 | Result **results[NBINS_RESULTS];/*+ An array of pointers to arrays of results +*/ |
74 | #else |
75 | uint32_t number; /*+ The number of occupied results in the array +*/ |
76 | Result **results; /*+ An array of pointers to arrays of results +*/ |
77 | #endif |
78 | } |
79 | Results; |
80 | |
81 | |
82 | /* Functions */ |
83 | |
84 | Results *NewResultsList(void); |
85 | void FreeResultsList(Results *results); |
86 | |
87 | Result *InsertResult(Results *results,node_t node); |
88 | |
89 | Result *FindResult(Results *results,node_t node); |
90 | |
91 | |
92 | #endif /* RESULTS_H */ |
Properties
Name | Value |
---|---|
cvs:description | Results data type. |