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 43 -
(show annotations)
(download)
(as text)
Fri Jan 16 20:04:47 2009 UTC (16 years, 2 months ago) by amb
File MIME type: text/x-chdr
File size: 2524 byte(s)
Fri Jan 16 20:04:47 2009 UTC (16 years, 2 months ago) by amb
File MIME type: text/x-chdr
File size: 2524 byte(s)
Speed optimisation by changing the contents of the Results structure.
1 | /*************************************** |
2 | $Header: /home/amb/CVS/routino/src/results.h,v 1.3 2009-01-16 20:04:47 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_t prev; /*+ The previous node following the shortest path. +*/ |
51 | node_t 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 node for which this result applies. +*/ |
61 | HalfResult shortest; /*+ The result for the shortest path. +*/ |
62 | HalfResult quickest; /*+ The result for the quickest path. +*/ |
63 | } |
64 | Result; |
65 | |
66 | /*+ A list of results. +*/ |
67 | typedef struct _Results |
68 | { |
69 | uint32_t alloced; /*+ The amount of space allocated for results in the array +*/ |
70 | #ifdef NBINS_RESULTS |
71 | uint32_t number[NBINS_RESULTS]; /*+ The number of occupied results in the array +*/ |
72 | Result **results[NBINS_RESULTS];/*+ An array of pointers to arrays of results +*/ |
73 | #else |
74 | uint32_t number; /*+ The number of occupied results in the array +*/ |
75 | Result **results; /*+ An array of pointers to arrays of results +*/ |
76 | #endif |
77 | } |
78 | Results; |
79 | |
80 | |
81 | /* Functions */ |
82 | |
83 | Results *NewResultsList(void); |
84 | void FreeResultsList(Results *results); |
85 | |
86 | Result *InsertResult(Results *results,node_t node); |
87 | |
88 | Result *FindResult(Results *results,node_t node); |
89 | |
90 | |
91 | #endif /* RESULTS_H */ |
Properties
Name | Value |
---|---|
cvs:description | Results data type. |