readosm.h
Go to the documentation of this file.
/*
/ readosm.h
/
/ public declarations
/
/ version 1.0, 2012 April 10
/
/ Author: Sandro Furieri a.furieri@lqt.it
/
/ ------------------------------------------------------------------------------
/
/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
/
/ The contents of this file are subject to the Mozilla Public License Version
/ 1.1 (the "License"); you may not use this file except in compliance with
/ the License. You may obtain a copy of the License at
/ http://www.mozilla.org/MPL/
/
/ Software distributed under the License is distributed on an "AS IS" basis,
/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
/ for the specific language governing rights and limitations under the
/ License.
/
/ The Original Code is the ReadOSM library
/
/ The Initial Developer of the Original Code is Alessandro Furieri
/
/ Portions created by the Initial Developer are Copyright (C) 2012
/ the Initial Developer. All Rights Reserved.
/
/ Contributor(s):
/
/ Alternatively, the contents of this file may be used under the terms of
/ either the GNU General Public License Version 2 or later (the "GPL"), or
/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
/ in which case the provisions of the GPL or the LGPL are applicable instead
/ of those above. If you wish to allow use of your version of this file only
/ under the terms of either the GPL or the LGPL, and not to allow others to
/ use your version of this file under the terms of the MPL, indicate your
/ decision by deleting the provisions above and replace them with the notice
/ and other provisions required by the GPL or the LGPL. If you do not delete
/ the provisions above, a recipient may use your version of this file under
/ the terms of any one of the MPL, the GPL or the LGPL.
/
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#ifdef _WIN32
#ifdef DLL_EXPORT
#define READOSM_DECLARE __declspec(dllexport)
#define READOSM_PRIVATE
#else
#define READOSM_DECLARE extern
#define READOSM_PRIVATE
#endif
#else
#define READOSM_DECLARE __attribute__ ((visibility("default")))
#define READOSM_PRIVATE __attribute__ ((visibility("hidden")))
#endif
#endif
#ifndef _READOSM_H
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define _READOSM_H
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* constants */
#define READOSM_UNDEFINED -1234567890
#define READOSM_MEMBER_NODE 7361
#define READOSM_MEMBER_WAY 6731
#define READOSM_MEMBER_RELATION 3671
/* Error codes */
#define READOSM_OK 0
#define READOSM_INVALID_SUFFIX -1
#define READOSM_FILE_NOT_FOUND -2
#define READOSM_NULL_HANDLE -3
#define READOSM_INVALID_HANDLE -4
#define READOSM_INSUFFICIENT_MEMORY -5
#define READOSM_CREATE_XML_PARSER_ERROR -6
#define READOSM_READ_ERROR -7
#define READOSM_XML_ERROR -8
#define READOSM_INVALID_PBF_HEADER -9
#define READOSM_UNZIP_ERROR -10
#define READOSM_ABORT -11
struct readosm_tag_struct
{
const char *key;
const char *value;
};
typedef struct readosm_tag_struct readosm_tag;
struct readosm_node_struct
{
const long long id;
const double latitude;
const double longitude;
const int version;
const long long changeset;
const char *user;
const int uid;
const char *timestamp;
const int tag_count;
const readosm_tag *tags;
};
typedef struct readosm_node_struct readosm_node;
struct readosm_way_struct
{
const long long id;
const int version;
const long long changeset;
const char *user;
const int uid;
const char *timestamp;
const int node_ref_count;
const long long *node_refs;
const int tag_count;
const readosm_tag *tags;
};
typedef struct readosm_way_struct readosm_way;
struct readosm_member_struct
{
const int member_type;
const long long id;
const char *role;
};
typedef struct readosm_member_struct readosm_member;
struct readosm_relation_struct
{
const long long id;
const int version;
const long long changeset;
const char *user;
const int uid;
const char *timestamp;
const int member_count;
const readosm_member *members;
const int tag_count;
const readosm_tag *tags;
};
typedef struct readosm_relation_struct readosm_relation;
typedef int (*readosm_node_callback) (const void *user_data,
const readosm_node * node);
typedef int (*readosm_way_callback) (const void *user_data,
const readosm_way * way);
typedef int (*readosm_relation_callback) (const void *user_data,
const readosm_relation *
relation);
READOSM_DECLARE int readosm_open (const char *path,
const void **osm_handle);
READOSM_DECLARE int readosm_close (const void *osm_handle);
READOSM_DECLARE int readosm_parse (const void *osm_handle,
const void *user_data,
readosm_node_callback node_fnct,
readosm_way_callback way_fnct,
readosm_relation_callback relation_fnct);
#ifdef __cplusplus
}
#endif
#endif /* _READOSM_H */
readosm_relation_struct::user
const char * user
name of the User defining this RELATION
Definition: readosm.h:226
readosm_parse
READOSM_DECLARE int readosm_parse(const void *osm_handle, const void *user_data, readosm_node_callback node_fnct, readosm_way_callback way_fnct, readosm_relation_callback relation_fnct)
Close the .osm or .pbf file and release any allocated resource.
readosm_relation_struct::members
const readosm_member * members
array of MEMBER objects (may be NULL)
Definition: readosm.h:230
readosm_relation_struct::uid
const int uid
corresponding numeric UserID
Definition: readosm.h:227
readosm_way_struct::node_ref_count
const int node_ref_count
number of referenced NODE-IDs (may be zero)
Definition: readosm.h:175
readosm_relation_struct::tag_count
const int tag_count
number of associated TAGs (may be zero)
Definition: readosm.h:231
readosm_relation_struct::version
const int version
object version
Definition: readosm.h:224
readosm_node_struct::timestamp
const char * timestamp
when this NODE was defined
Definition: readosm.h:143
readosm_tag_struct
a struct representing a key:value pair, and wrapping an XML fragment like the following: ...
Definition: readosm.h:111
readosm_relation_callback
int(* readosm_relation_callback)(const void *user_data, const readosm_relation *relation)
callback function handling RELATION objects
Definition: readosm.h:251
readosm_node_struct::uid
const int uid
corresponding numeric UserID
Definition: readosm.h:142
readosm_way_struct::changeset
const long long changeset
ChangeSet ID.
Definition: readosm.h:171
readosm_node_struct::user
const char * user
name of the User defining this NODE
Definition: readosm.h:141
readosm_member_struct::role
const char * role
intended role for this reference
Definition: readosm.h:199
readosm_way_struct::id
const long long id
WAY-ID (expected to be a unique value)
Definition: readosm.h:169
readosm_relation_struct::member_count
const int member_count
number of associated MEMBERs (may be zero)
Definition: readosm.h:229
readosm_node_callback
int(* readosm_node_callback)(const void *user_data, const readosm_node *node)
callback function handling NODE objects
Definition: readosm.h:243
readosm_node_struct::tag_count
const int tag_count
number of associated TAGs (may be zero)
Definition: readosm.h:144
readosm_way_struct::tags
const readosm_tag * tags
array of TAG objects (may be NULL)
Definition: readosm.h:178
readosm_relation_struct::tags
const readosm_tag * tags
array of TAG objects (may be NULL)
Definition: readosm.h:232
readosm_node_struct::id
const long long id
NODE-ID (expected to be a unique value)
Definition: readosm.h:136
readosm_way_struct::user
const char * user
name of the User defining this WAY
Definition: readosm.h:172
readosm_way_struct::timestamp
const char * timestamp
when this WAY was defined
Definition: readosm.h:174
readosm_node_struct::latitude
const double latitude
geographic latitude
Definition: readosm.h:137
readosm_node_struct::version
const int version
object version
Definition: readosm.h:139
readosm_relation_struct::timestamp
const char * timestamp
when this RELATION was defined
Definition: readosm.h:228
readosm_member_struct::id
const long long id
ID-value identifying the referenced object.
Definition: readosm.h:198
readosm_node_struct
a struct representing a NODE object, and wrapping a complex XML fragment like the following: ...
Definition: readosm.h:134
readosm_way_struct::tag_count
const int tag_count
number of associated TAGs (may be zero)
Definition: readosm.h:177
readosm_node_struct::longitude
const double longitude
geographic longitude
Definition: readosm.h:138
readosm_open
READOSM_DECLARE int readosm_open(const char *path, const void **osm_handle)
Open the .osm or .pbf file, preparing for future functions.
readosm_close
READOSM_DECLARE int readosm_close(const void *osm_handle)
Close the .osm or .pbf file and release any allocated resource.
readosm_relation_struct::id
const long long id
RELATION-ID (expected to be a unique value)
Definition: readosm.h:223
readosm_way_struct
a struct representing a WAY object, and wrapping a complex XML fragment like the following: ...
Definition: readosm.h:167
readosm_node_struct::changeset
const long long changeset
ChangeSet ID.
Definition: readosm.h:140
readosm_member_struct::member_type
const int member_type
can be one of: READOSM_MEMBER_NODE, READOSM_MEMBER_WAY or READOSM_MEMBER_RELATION ...
Definition: readosm.h:197
readosm_way_struct::uid
const int uid
corresponding numeric UserID
Definition: readosm.h:173
readosm_way_callback
int(* readosm_way_callback)(const void *user_data, const readosm_way *way)
callback function handling WAY objects
Definition: readosm.h:247
readosm_way_struct::node_refs
const long long * node_refs
array of NODE-IDs (may be NULL)
Definition: readosm.h:176
readosm_way_struct::version
const int version
object version
Definition: readosm.h:170
readosm_relation_struct::changeset
const long long changeset
ChangeSet ID.
Definition: readosm.h:225
readosm_relation_struct
a struct representing a RELATION object, and wrapping a complex XML fragment like the following: ...
Definition: readosm.h:221
readosm_member_struct
a struct representing a RELATION-MEMBER, and wrapping an XML fragment like the following: ...
Definition: readosm.h:194
readosm_node_struct::tags
const readosm_tag * tags
array of TAG objects (may be NULL)
Definition: readosm.h:145