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/ways.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 96 - (hide annotations) (download) (as text)
Sat Jan 31 15:32:42 2009 UTC (16 years, 2 months ago) by amb
File MIME type: text/x-chdr
File size: 2420 byte(s)
Intermediate version during code cleanup.

1 amb 21 /***************************************
2 amb 96 $Header: /home/amb/CVS/routino/src/ways.h,v 1.20 2009-01-31 15:32:42 amb Exp $
3 amb 21
4     A header file for the ways.
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 WAYS_H
16     #define WAYS_H /*+ To stop multiple inclusions. +*/
17    
18     #include <stdint.h>
19    
20 amb 96 #include "ways.h"
21 amb 21
22    
23     /* Data structures */
24    
25    
26 amb 87 /*+ An extended structure containing a single way. +*/
27     typedef struct _WayEx
28     {
29 amb 96 index_t index; /*+ The index of the way. +*/
30 amb 87 char *name; /*+ The name of the way. +*/
31    
32     Way way; /*+ The real Way data. +*/
33     }
34     WayEx;
35    
36 amb 21 /*+ A structure containing a set of ways (mmap format). +*/
37     typedef struct _Ways
38     {
39 amb 87 uint32_t number; /*+ How many entries are used? +*/
40    
41     Way *ways; /*+ An array of ways. */
42     char *names; /*+ An array of characters containing the names. +*/
43    
44     void *data; /*+ The memory mapped data. +*/
45 amb 21 }
46     Ways;
47    
48     /*+ A structure containing a set of ways (memory format). +*/
49     typedef struct _WaysMem
50     {
51 amb 87 uint32_t sorted; /*+ Is the data sorted? +*/
52 amb 21 uint32_t alloced; /*+ How many entries are allocated? +*/
53     uint32_t number; /*+ How many entries are used? +*/
54 amb 87 uint32_t length; /*+ How long is the string of name entries? +*/
55 amb 21
56 amb 87 WayEx *xdata; /*+ The extended data for the Ways. +*/
57     char *names; /*+ The array containing all the names. +*/
58 amb 21 }
59     WaysMem;
60    
61    
62     /* Functions */
63    
64    
65     WaysMem *NewWayList(void);
66    
67     Ways *LoadWayList(const char *filename);
68 amb 89 void SaveWayList(WaysMem *waysmem,const char *filename);
69 amb 21
70 amb 89 WayEx *AppendWay(WaysMem *waysmem,const char *name);
71 amb 21
72 amb 87 void SortWayList(WaysMem *waysmem);
73 amb 21
74 amb 74 Highway HighwayType(const char *highway);
75     Transport TransportType(const char *transport);
76 amb 21
77 amb 82 const char *HighwayName(Highway highway);
78     const char *TransportName(Transport transport);
79    
80 amb 75 const char *HighwayList(void);
81     const char *TransportList(void);
82    
83 amb 89 #define LookupWayEx(xxx,yyy) (&(xxx)->xdata[yyy])
84 amb 32
85 amb 89 #define IndexWayEx(xxx,yyy) ((yyy)-&(xxx)->xdata[0])
86    
87 amb 32
88 amb 21 #endif /* WAYS_H */

Properties

Name Value
cvs:description Header file for ways.