Routino SVN Repository Browser

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

ViewVC logotype

Contents of /trunk/src/segmentsx.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 449 - (show annotations) (download) (as text)
Mon Jul 12 17:59:42 2010 UTC (14 years, 8 months ago) by amb
File MIME type: text/x-chdr
File size: 3736 byte(s)
Create a files.h header and put some of the most heavily used files.c functions
into it and make them inline.

1 /***************************************
2 $Header: /home/amb/CVS/routino/src/segmentsx.h,v 1.22 2010-07-12 17:59:42 amb Exp $
3
4 A header file for the extended segments.
5
6 Part of the Routino routing software.
7 ******************/ /******************
8 This file Copyright 2008-2010 Andrew M. Bishop
9
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Affero General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Affero General Public License for more details.
19
20 You should have received a copy of the GNU Affero General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ***************************************/
23
24
25 #ifndef SEGMENTSX_H
26 #define SEGMENTSX_H /*+ To stop multiple inclusions. +*/
27
28 #include <stdint.h>
29
30 #include "types.h"
31 #include "segments.h"
32
33 #include "typesx.h"
34
35
36 /* Data structures */
37
38
39 /*+ An extended structure used for processing. +*/
40 struct _SegmentX
41 {
42 node_t node1; /*+ The id of the starting node. +*/
43 node_t node2; /*+ The id of the finishing node. +*/
44
45 way_t way; /*+ The id of the way. +*/
46
47 distance_t distance; /*+ The distance between the nodes. +*/
48 };
49
50
51 /*+ A structure containing a set of segments (memory format). +*/
52 struct _SegmentsX
53 {
54 char *filename; /*+ The name of the temporary file. +*/
55 int fd; /*+ The file descriptor of the temporary file. +*/
56
57 uint32_t xnumber; /*+ The number of unsorted extended nodes. +*/
58
59 SegmentX *xdata; /*+ The extended segment data (unsorted). +*/
60 SegmentX cached[2]; /*+ Two cached segments read from the file in slim mode. +*/
61
62 uint32_t number; /*+ How many entries are still useful? +*/
63
64 node_t *idata; /*+ The extended segment data (sorted by node1 then node2). +*/
65 index_t *firstnode; /*+ The first segment index for each node. +*/
66
67 Segment *sdata; /*+ The segment data (same order as n1data). +*/
68
69 char *sfilename; /*+ The name of the temporary file for segments in slim mode. +*/
70 int sfd; /*+ The file descriptor of the temporary file. +*/
71
72 Segment scached[2]; /*+ Two cached segments read from the file in slim mode. +*/
73 };
74
75
76 /* Functions */
77
78
79 SegmentsX *NewSegmentList(int append);
80 void FreeSegmentList(SegmentsX *segmentsx,int keep);
81
82 void SaveSegmentList(SegmentsX *segmentsx,const char *filename);
83
84 SegmentX *LookupSegmentX(SegmentsX* segmentsx,index_t index,int position);
85
86 Segment *LookupSegmentXSegment(SegmentsX* segmentsx,index_t index,int position);
87 void PutBackSegmentXSegment(SegmentsX* segmentsx,index_t index,int position);
88
89 index_t IndexFirstSegmentX(SegmentsX* segmentsx,node_t node);
90
91 index_t IndexNextSegmentX(SegmentsX* segmentsx,index_t segindex,index_t nodeindex);
92
93 void AppendSegment(SegmentsX* segmentsx,way_t way,node_t node1,node_t node2,distance_t distance);
94
95 void SortSegmentList(SegmentsX* segmentsx);
96
97 void RemoveBadSegments(NodesX *nodesx,SegmentsX *segmentsx);
98
99 void UpdateSegments(SegmentsX *segmentsx,NodesX *nodesx,WaysX *waysx);
100
101 void RotateSegments(SegmentsX* segmentsx);
102
103 void DeduplicateSegments(SegmentsX* segmentsx,NodesX *nodesx,WaysX *waysx);
104
105 void CreateRealSegments(SegmentsX *segmentsx,WaysX *waysx);
106
107 void IndexSegments(SegmentsX* segmentsx,NodesX *nodesx);
108
109
110 #endif /* SEGMENTSX_H */

Properties

Name Value
cvs:description Extended segments header.