Statistics
| Revision:

root / trunk / code / projects / traffic_navigation / mapping.h @ 1984

History | View | Annotate | Download (1.17 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
char driveToNextInt(void);
35
char createEdge(edge* newEdge, int type, int direction);
36
void initGraph(char* seen, char* seenout);
37
int createMap(void);
38
int getNumOut(int type);
39
int insertEdge(void);
40
int nextInt(void);
41
int encodeNode(node n);
42
void sendIntersectionGraph(void);
43

    
44
extern node intersections[NUM_FEATURES];
45

    
46
#endif