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 29 -
(hide annotations)
(download)
(as text)
Sat Jan 10 13:40:09 2009 UTC (16 years, 2 months ago) by amb
File MIME type: text/x-chdr
File size: 2469 byte(s)
Sat Jan 10 13:40:09 2009 UTC (16 years, 2 months ago) by amb
File MIME type: text/x-chdr
File size: 2469 byte(s)
Initial revision
1 | amb | 29 | /*************************************** |
2 | $Header: /home/amb/CVS/routino/src/results.h,v 1.1 2009-01-10 13:40:09 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 | distance_t distance; /*+ The distance travelled to the node following the shortest path. +*/ | ||
52 | duration_t duration; /*+ The time taken to the node following the shortest path. +*/ | ||
53 | } | ||
54 | HalfResult; | ||
55 | |||
56 | /*+ One complete result for a node. +*/ | ||
57 | typedef struct _Result | ||
58 | { | ||
59 | node_t node; /*+ The end node. +*/ | ||
60 | Node *Node; /*+ The end Node. +*/ | ||
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. |