root / trunk / code / projects / traffic_navigation / mapping.h @ 1980
History | View | Annotate | Download (1.08 KB)
1 |
#ifndef __INTERSECTION_MAPPING_H__
|
---|---|
2 |
#define __INTERSECTION_MAPPING_H__
|
3 |
|
4 |
#include "intersectData.h" |
5 |
|
6 |
/* Data is sent in the following order
|
7 |
* INT0_NUM OUTEDGE_0 OUTEDGE_1 ... \n
|
8 |
* INT1_NUM OUTEDGE_0 ... \n
|
9 |
* ...
|
10 |
* ...
|
11 |
*/
|
12 |
|
13 |
/* Representation of an edge (road) */
|
14 |
typedef struct { |
15 |
char to; /* Where does this edge lead to? */ |
16 |
char dist; /* Where does it come from? */ |
17 |
} edge; |
18 |
|
19 |
/* Representation of an intersection on the graph */
|
20 |
typedef struct { |
21 |
char type; /* Note that there are at most 5 intersection types */ |
22 |
char intNum; /* What is the intersection number */ |
23 |
char numOut; /* Note that we can have no more than 4 outgoing edges */ |
24 |
char outSeen; /* The number of the outgoing edges that we have seen for this intersection */ |
25 |
edge outgoingEdges[4];
|
26 |
} node; |
27 |
|
28 |
/* A union that is used in wireless transmissions */
|
29 |
typedef union { |
30 |
node n; |
31 |
char array[12]; |
32 |
}node_union; |
33 |
|
34 |
int createEdge(edge* newEdge);
|
35 |
int createMap(void); |
36 |
int getNumOut(int type); |
37 |
int insertEdge(void); |
38 |
int nextInt(void); |
39 |
int encodeNode(node n);
|
40 |
void sendIntersectionGraph(void); |
41 |
|
42 |
extern node intersections[NUM_FEATURES];
|
43 |
|
44 |
#endif
|