-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathroadmap_dbread.h
94 lines (68 loc) · 2.59 KB
/
roadmap_dbread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* roadmap_dbread.h - General API for accessing a RoadMap map file.
*
* LICENSE:
*
* Copyright 2002 Pascal F. Martin
*
* This file is part of RoadMap.
*
* RoadMap is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* RoadMap is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RoadMap; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _ROADMAP_DBREAD__H_
#define _ROADMAP_DBREAD__H_
#include "roadmap_data_format.h"
typedef struct {
roadmap_data_header *header;
roadmap_data_entry *index;
unsigned char *data;
unsigned int byte_alignment_add;
unsigned int byte_alignment_mask;
} roadmap_db_data_file;
typedef void * (*roadmap_db_mapper) (const roadmap_db_data_file *file);
typedef void (*roadmap_db_activator) (void *context);
typedef void (*roadmap_db_unmapper) (void *context);
typedef struct {
char *name;
roadmap_db_mapper map;
roadmap_db_activator activate;
roadmap_db_unmapper unmap;
} roadmap_db_handler;
typedef struct {
int first;
int last;
} roadmap_db_sector;
typedef struct roadmap_db_model_s {
roadmap_db_handler *handler;
roadmap_db_sector sector;
struct roadmap_db_model_s *next;
} roadmap_db_model;
roadmap_db_model *roadmap_db_register
(roadmap_db_model *model, const roadmap_db_sector *sector, roadmap_db_handler *handler);
int roadmap_db_open (int fips, int tile_index, roadmap_db_model *model,
const char* mode);
int roadmap_db_open_mem (int fips, int tile_index, roadmap_db_model *model,
void *data, size_t size);
void roadmap_db_activate (int fips, int tile_index);
int roadmap_db_exists (const roadmap_db_data_file *file, const roadmap_db_sector *sector);
int roadmap_db_get_data (const roadmap_db_data_file *file,
unsigned int data_id,
unsigned int item_size,
void **data,
int *num_items);
int roadmap_db_close (int fips, int tile_index);
void roadmap_db_remove (int fips, int tile_index);
void roadmap_db_end (void);
const char *roadmap_db_map_path (void);
#endif // _ROADMAP_DBREAD__H_