Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Annotation of /trunk/src/results.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 116 - (hide annotations) (download) (as text)
Tue Feb 10 19:49:26 2009 UTC (16 years, 1 month ago) by amb
File MIME type: text/x-chdr
File size: 2858 byte(s)
Added a new 'sortby' entry to the Result.
Changed node_t to index_t.

1 amb 29 /***************************************
2 amb 116 $Header: /home/amb/CVS/routino/src/results.h,v 1.10 2009-02-10 19:49:26 amb Exp $
3 amb 29
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 amb 116 #include "types.h"
21 amb 29
22    
23     /* Data structures */
24    
25 amb 113 /*+ The result for a node. +*/
26 amb 29 typedef struct _Result
27     {
28 amb 116 index_t node; /*+ The node for which this result applies. +*/
29 amb 113
30 amb 116 index_t prev; /*+ The previous node following the best path. +*/
31     index_t next; /*+ The next node following the best path. +*/
32    
33 amb 113 distance_t distance; /*+ The distance travelled to the node following the best path. +*/
34     duration_t duration; /*+ The time taken to the node following the best path. +*/
35 amb 116
36     distance_t sortby; /*+ The value to sort the results by in the queue. +*/
37 amb 29 }
38     Result;
39    
40     /*+ A list of results. +*/
41     typedef struct _Results
42     {
43 amb 71 uint32_t nbins; /*+ The number of bins. +*/
44     uint32_t mask; /*+ A bit mask to select the bottom 'nbins' bits. +*/
45    
46 amb 79 uint32_t alloced; /*+ The amount of space allocated for results
47     (the length of the number and pointers arrays and
48     1/nbins times the amount in the real results). +*/
49 amb 45 uint32_t number; /*+ The total number of occupied results. +*/
50 amb 71
51 amb 79 uint32_t *count; /*+ An array of nbins counters of results in each array. +*/
52     Result ***point; /*+ An array of nbins arrays of pointers to actual results. +*/
53 amb 71
54 amb 79 Result **data; /*+ An array of arrays containing the actual results
55     (don't need to realloc the array of data when adding more,
56     only realloc the array that points to the array of data).
57     Most importantly pointers into the real data don't change
58 amb 113 as more space is allocated (since realloc is not being used). +*/
59 amb 29 }
60     Results;
61    
62    
63     /* Functions */
64    
65 amb 71 Results *NewResultsList(int nbins);
66 amb 29 void FreeResultsList(Results *results);
67    
68 amb 116 Result *InsertResult(Results *results,index_t node);
69 amb 29
70 amb 116 Result *FindResult(Results *results,index_t node);
71 amb 29
72 amb 79 Result *FirstResult(Results *results);
73     Result *NextResult(Results *results,Result *result);
74 amb 29
75 amb 67 /* Queue Functions */
76    
77 amb 79 void insert_in_queue(Result *result);
78     Result *pop_from_queue(void);
79 amb 67
80    
81 amb 29 #endif /* RESULTS_H */

Properties

Name Value
cvs:description Results data type.