navit  0.5.3-trunk
osm_protobufdb.c File Reference
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <time.h>
#include <zlib.h>
#include "maptool.h"
#include "debug.h"
#include "linguistics.h"
#include "file.h"
#include "fileformat.pb-c.h"
#include "osmformat.pb-c.h"

Data Structures

struct  db_config
 
struct  osm_protobufdb_context
 

Macros

#define insert(struct, member, pos)
 

Functions

static int osm_protobufdb_write_blob (OSMPBF__Blob *blob, FILE *out)
 
static int osm_protobufdb_finish_block (struct osm_protobufdb_context *ctx)
 
static int osm_protobufdb_start_block (struct osm_protobufdb_context *ctx, int blocknum)
 
static int osm_protobufdb_start_group (struct osm_protobufdb_context *ctx, int groupnum)
 
static int osm_protobufdb_insert_node (long long id, OSMPBF__PrimitiveGroup *pg)
 
static void osm_protobufdb_modify_node (OSMPBF__Node *node, OSMPBF__Info *info, int pos, OSMPBF__PrimitiveGroup *pg)
 
static int osm_protobufdb_insert_way (long long id, OSMPBF__PrimitiveGroup *pg)
 
static void osm_protobufdb_modify_way (OSMPBF__Way *way, OSMPBF__Info *info, int pos, OSMPBF__PrimitiveGroup *pg)
 
static int osm_protobufdb_insert_relation (long long id, OSMPBF__PrimitiveGroup *pg)
 
static void osm_protobufdb_modify_relation (OSMPBF__Relation *relation, OSMPBF__Info *info, int pos, OSMPBF__PrimitiveGroup *pg)
 
static int osm_protobufdb_string (struct osm_protobufdb_context *ctx, char *str)
 
static int osm_protobufdb_finish_file (struct osm_protobufdb_context *ctx)
 
static int osm_protobufdb_start_file (struct osm_protobufdb_context *ctx, int type, int num)
 
static void test (void)
 
static void finish (void)
 
static long long osm_protobufdb_timestamp (char *str)
 
static void osm_protobufdb_parse_info (struct osm_protobufdb_context *ctx, char *str)
 
static int osm_protobufdb_parse_node (struct osm_protobufdb_context *ctx, char *str)
 
static int osm_protobufdb_end_node (struct osm_protobufdb_context *ctx)
 
static int osm_protobufdb_parse_way (struct osm_protobufdb_context *ctx, char *str)
 
static int osm_protobufdb_end_way (struct osm_protobufdb_context *ctx)
 
static int osm_protobufdb_parse_relation (struct osm_protobufdb_context *ctx, char *str)
 
static int osm_protobufdb_end_relation (struct osm_protobufdb_context *ctx)
 
static int osm_protobufdb_parse_tag (struct osm_protobufdb_context *ctx, char *str)
 
static int osm_protobufdb_parse_nd (struct osm_protobufdb_context *ctx, char *str)
 
static int osm_protobufdb_parse_member (struct osm_protobufdb_context *ctx, char *str)
 
int osm_protobufdb_load (FILE *in, char *dir)
 

Variables

static double latlon_scale =10000000.0
 
struct db_config db_config
 
struct osm_protobufdb_context context
 

Macro Definition Documentation

◆ insert

#define insert (   struct,
  member,
  pos 
)
Value:
{\
int n=struct->n_##member; \
int s=sizeof(struct->member[0]); \
struct->member=g_realloc(struct->member, (n+1)*s); \
memmove(&struct->member[n+1], &struct->member[n], (pos-n)*s); \
memset(&struct->member[n], 0, s); \
struct->n_##member++;\
}
pos
Definition: startup.py:3

Function Documentation

◆ finish()

◆ osm_protobufdb_end_node()

◆ osm_protobufdb_end_relation()

◆ osm_protobufdb_end_way()

◆ osm_protobufdb_finish_block()

◆ osm_protobufdb_finish_file()

static int osm_protobufdb_finish_file ( struct osm_protobufdb_context ctx)
static

◆ osm_protobufdb_insert_node()

static int osm_protobufdb_insert_node ( long long  id,
OSMPBF__PrimitiveGroup *  pg 
)
static

References insert, nodes, and p.

Referenced by osm_protobufdb_end_node().

◆ osm_protobufdb_insert_relation()

static int osm_protobufdb_insert_relation ( long long  id,
OSMPBF__PrimitiveGroup *  pg 
)
static

References insert, and p.

Referenced by osm_protobufdb_end_relation().

◆ osm_protobufdb_insert_way()

static int osm_protobufdb_insert_way ( long long  id,
OSMPBF__PrimitiveGroup *  pg 
)
static

References insert, and p.

Referenced by osm_protobufdb_end_way().

◆ osm_protobufdb_load()

◆ osm_protobufdb_modify_node()

static void osm_protobufdb_modify_node ( OSMPBF__Node *  node,
OSMPBF__Info *  info,
int  pos,
OSMPBF__PrimitiveGroup *  pg 
)
static

References info, and startup::pos.

Referenced by osm_protobufdb_end_node().

◆ osm_protobufdb_modify_relation()

static void osm_protobufdb_modify_relation ( OSMPBF__Relation *  relation,
OSMPBF__Info *  info,
int  pos,
OSMPBF__PrimitiveGroup *  pg 
)
static

References info, and startup::pos.

Referenced by osm_protobufdb_end_relation().

◆ osm_protobufdb_modify_way()

static void osm_protobufdb_modify_way ( OSMPBF__Way *  way,
OSMPBF__Info *  info,
int  pos,
OSMPBF__PrimitiveGroup *  pg 
)
static

References info, and startup::pos.

Referenced by osm_protobufdb_end_way().

◆ osm_protobufdb_parse_info()

◆ osm_protobufdb_parse_member()

static int osm_protobufdb_parse_member ( struct osm_protobufdb_context ctx,
char *  str 
)
static

◆ osm_protobufdb_parse_nd()

static int osm_protobufdb_parse_nd ( struct osm_protobufdb_context ctx,
char *  str 
)
static

◆ osm_protobufdb_parse_node()

◆ osm_protobufdb_parse_relation()

◆ osm_protobufdb_parse_tag()

◆ osm_protobufdb_parse_way()

◆ osm_protobufdb_start_block()

◆ osm_protobufdb_start_file()

◆ osm_protobufdb_start_group()

static int osm_protobufdb_start_group ( struct osm_protobufdb_context ctx,
int  groupnum 
)
static

◆ osm_protobufdb_string()

static int osm_protobufdb_string ( struct osm_protobufdb_context ctx,
char *  str 
)
static

◆ osm_protobufdb_timestamp()

static long long osm_protobufdb_timestamp ( char *  str)
static

◆ osm_protobufdb_write_blob()

static int osm_protobufdb_write_blob ( OSMPBF__Blob *  blob,
FILE *  out 
)
static

◆ test()

static void test ( void  )
static

Referenced by osm_protobufdb_load().

Variable Documentation

◆ context

◆ db_config

Initial value:
= {
200000, 30000, 500,
40000, 1000, 30,
10000, 500, 20,
}

◆ latlon_scale

double latlon_scale =10000000.0
static