Merge commit 'bb78bc8fe305eef39ca0a5d5e9dedc466f803dfb' into develop
This commit is contained in:
+47
-47
@@ -44,60 +44,60 @@
|
||||
|
||||
static void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
|
||||
{
|
||||
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC))
|
||||
return MAP_FAILED;
|
||||
if (fd == -1) {
|
||||
if (!(flags & MAP_ANON) || offset)
|
||||
return MAP_FAILED;
|
||||
} else if (flags & MAP_ANON)
|
||||
return MAP_FAILED;
|
||||
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC))
|
||||
return MAP_FAILED;
|
||||
if (fd == -1) {
|
||||
if (!(flags & MAP_ANON) || offset)
|
||||
return MAP_FAILED;
|
||||
} else if (flags & MAP_ANON)
|
||||
return MAP_FAILED;
|
||||
|
||||
DWORD flProtect;
|
||||
if (prot & PROT_WRITE) {
|
||||
if (prot & PROT_EXEC)
|
||||
flProtect = PAGE_EXECUTE_READWRITE;
|
||||
else
|
||||
flProtect = PAGE_READWRITE;
|
||||
} else if (prot & PROT_EXEC) {
|
||||
if (prot & PROT_READ)
|
||||
flProtect = PAGE_EXECUTE_READ;
|
||||
else if (prot & PROT_EXEC)
|
||||
flProtect = PAGE_EXECUTE;
|
||||
} else
|
||||
flProtect = PAGE_READONLY;
|
||||
DWORD flProtect;
|
||||
if (prot & PROT_WRITE) {
|
||||
if (prot & PROT_EXEC)
|
||||
flProtect = PAGE_EXECUTE_READWRITE;
|
||||
else
|
||||
flProtect = PAGE_READWRITE;
|
||||
} else if (prot & PROT_EXEC) {
|
||||
if (prot & PROT_READ)
|
||||
flProtect = PAGE_EXECUTE_READ;
|
||||
else if (prot & PROT_EXEC)
|
||||
flProtect = PAGE_EXECUTE;
|
||||
} else
|
||||
flProtect = PAGE_READONLY;
|
||||
|
||||
off_t end = length + offset;
|
||||
HANDLE mmap_fd, h;
|
||||
if (fd == -1)
|
||||
mmap_fd = INVALID_HANDLE_VALUE;
|
||||
else
|
||||
mmap_fd = (HANDLE)_get_osfhandle(fd);
|
||||
h = CreateFileMapping(mmap_fd, NULL, flProtect, DWORD_HI(end), DWORD_LO(end), NULL);
|
||||
if (h == NULL)
|
||||
return MAP_FAILED;
|
||||
off_t end = length + offset;
|
||||
HANDLE mmap_fd, h;
|
||||
if (fd == -1)
|
||||
mmap_fd = INVALID_HANDLE_VALUE;
|
||||
else
|
||||
mmap_fd = (HANDLE)_get_osfhandle(fd);
|
||||
h = CreateFileMapping(mmap_fd, NULL, flProtect, DWORD_HI(end), DWORD_LO(end), NULL);
|
||||
if (h == NULL)
|
||||
return MAP_FAILED;
|
||||
|
||||
DWORD dwDesiredAccess;
|
||||
if (prot & PROT_WRITE)
|
||||
dwDesiredAccess = FILE_MAP_WRITE;
|
||||
else
|
||||
dwDesiredAccess = FILE_MAP_READ;
|
||||
if (prot & PROT_EXEC)
|
||||
dwDesiredAccess |= FILE_MAP_EXECUTE;
|
||||
if (flags & MAP_PRIVATE)
|
||||
dwDesiredAccess |= FILE_MAP_COPY;
|
||||
void *ret = MapViewOfFile(h, dwDesiredAccess, DWORD_HI(offset), DWORD_LO(offset), length);
|
||||
if (ret == NULL) {
|
||||
CloseHandle(h);
|
||||
ret = MAP_FAILED;
|
||||
}
|
||||
return ret;
|
||||
DWORD dwDesiredAccess;
|
||||
if (prot & PROT_WRITE)
|
||||
dwDesiredAccess = FILE_MAP_WRITE;
|
||||
else
|
||||
dwDesiredAccess = FILE_MAP_READ;
|
||||
if (prot & PROT_EXEC)
|
||||
dwDesiredAccess |= FILE_MAP_EXECUTE;
|
||||
if (flags & MAP_PRIVATE)
|
||||
dwDesiredAccess |= FILE_MAP_COPY;
|
||||
void *ret = MapViewOfFile(h, dwDesiredAccess, DWORD_HI(offset), DWORD_LO(offset), length);
|
||||
if (ret == NULL) {
|
||||
CloseHandle(h);
|
||||
ret = MAP_FAILED;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int munmap(void *addr, size_t length)
|
||||
{
|
||||
UnmapViewOfFile(addr);
|
||||
return 0;
|
||||
/* ruh-ro, we leaked handle from CreateFileMapping() ... */
|
||||
UnmapViewOfFile(addr);
|
||||
return 0;
|
||||
/* ruh-ro, we leaked handle from CreateFileMapping() ... */
|
||||
}
|
||||
|
||||
#undef DWORD_HI
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,18 +33,38 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#ifdef __clang__
|
||||
# pragma GCC diagnostic ignored "-Wdocumentation-unknown-command"
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* This file contains code for reporting problems through OGR when
|
||||
* assembling multipolygons.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with `libgdal`.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4458)
|
||||
#else
|
||||
# pragma GCC diagnostic push
|
||||
# ifdef __clang__
|
||||
# pragma GCC diagnostic ignored "-Wdocumentation-unknown-command"
|
||||
# endif
|
||||
# pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
# pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
# pragma GCC diagnostic ignored "-Wpadded"
|
||||
# pragma GCC diagnostic ignored "-Wredundant-decls"
|
||||
# pragma GCC diagnostic ignored "-Wshadow"
|
||||
#endif
|
||||
|
||||
#include <ogr_api.h>
|
||||
#include <ogrsf_frmts.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#else
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#pragma GCC diagnostic ignored "-Wpadded"
|
||||
#pragma GCC diagnostic ignored "-Wredundant-decls"
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
# include <ogr_api.h>
|
||||
# include <ogrsf_frmts.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -37,7 +37,9 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#include <osmium/memory/buffer.hpp>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -36,6 +36,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <cstring>
|
||||
#include <initializer_list>
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <osmium/builder/builder.hpp>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -41,7 +41,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
namespace osmium {
|
||||
|
||||
/**
|
||||
* @short Experimental code that is not "officially" supported.
|
||||
* @brief Experimental code that is not "officially" supported.
|
||||
*/
|
||||
namespace experimental {
|
||||
|
||||
@@ -51,9 +51,7 @@ namespace osmium {
|
||||
bool m_with_areas;
|
||||
osmium::osm_entity_bits::type m_entities;
|
||||
|
||||
typename TLocationHandler::index_pos_type m_index_pos;
|
||||
typename TLocationHandler::index_neg_type m_index_neg;
|
||||
TLocationHandler m_location_handler;
|
||||
TLocationHandler& m_location_handler;
|
||||
|
||||
osmium::io::Reader m_reader;
|
||||
osmium::area::Assembler::config_type m_assembler_config;
|
||||
@@ -61,12 +59,10 @@ namespace osmium {
|
||||
|
||||
public:
|
||||
|
||||
explicit FlexReader(const osmium::io::File& file, osmium::osm_entity_bits::type entities = osmium::osm_entity_bits::nwr) :
|
||||
m_with_areas(entities & osmium::osm_entity_bits::area),
|
||||
explicit FlexReader(const osmium::io::File& file, TLocationHandler& location_handler, osmium::osm_entity_bits::type entities = osmium::osm_entity_bits::nwr) :
|
||||
m_with_areas((entities & osmium::osm_entity_bits::area) != 0),
|
||||
m_entities((entities & ~osmium::osm_entity_bits::area) | (m_with_areas ? osmium::osm_entity_bits::node | osmium::osm_entity_bits::way : osmium::osm_entity_bits::nothing)),
|
||||
m_index_pos(),
|
||||
m_index_neg(),
|
||||
m_location_handler(m_index_pos, m_index_neg),
|
||||
m_location_handler(location_handler),
|
||||
m_reader(file, m_entities),
|
||||
m_assembler_config(),
|
||||
m_collector(m_assembler_config)
|
||||
@@ -79,21 +75,20 @@ namespace osmium {
|
||||
}
|
||||
}
|
||||
|
||||
explicit FlexReader(const std::string& filename, osmium::osm_entity_bits::type entities = osmium::osm_entity_bits::nwr) :
|
||||
FlexReader(osmium::io::File(filename), entities) {
|
||||
explicit FlexReader(const std::string& filename, TLocationHandler& location_handler, osmium::osm_entity_bits::type entities = osmium::osm_entity_bits::nwr) :
|
||||
FlexReader(osmium::io::File(filename), location_handler, entities) {
|
||||
}
|
||||
|
||||
explicit FlexReader(const char* filename, osmium::osm_entity_bits::type entities = osmium::osm_entity_bits::nwr) :
|
||||
FlexReader(osmium::io::File(filename), entities) {
|
||||
explicit FlexReader(const char* filename, TLocationHandler& location_handler, osmium::osm_entity_bits::type entities = osmium::osm_entity_bits::nwr) :
|
||||
FlexReader(osmium::io::File(filename), location_handler, entities) {
|
||||
}
|
||||
|
||||
osmium::memory::Buffer read() {
|
||||
std::vector<osmium::memory::Buffer> area_buffers;
|
||||
|
||||
osmium::memory::Buffer buffer = m_reader.read();
|
||||
|
||||
if (buffer) {
|
||||
if (m_with_areas) {
|
||||
std::vector<osmium::memory::Buffer> area_buffers;
|
||||
osmium::apply(buffer, m_location_handler, m_collector.handler([&area_buffers](osmium::memory::Buffer&& area_buffer) {
|
||||
area_buffers.push_back(std::move(area_buffer));
|
||||
}));
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+10
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,15 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* This file contains code for conversion of OSM geometries into GDAL
|
||||
* geometries.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with `libgeos`.
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <geos/geom/Coordinate.h>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+38
-8
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,19 +33,49 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* This file contains code for conversion of OSM geometries into OGR
|
||||
* geometries.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with `libgdal`.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#ifdef __clang__
|
||||
# pragma GCC diagnostic ignored "-Wdocumentation-unknown-command"
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4458)
|
||||
# pragma warning(disable : 4251)
|
||||
#else
|
||||
# pragma GCC diagnostic push
|
||||
# ifdef __clang__
|
||||
# pragma GCC diagnostic ignored "-Wdocumentation-unknown-command"
|
||||
# endif
|
||||
# pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
# pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
# pragma GCC diagnostic ignored "-Wpadded"
|
||||
# pragma GCC diagnostic ignored "-Wredundant-decls"
|
||||
# pragma GCC diagnostic ignored "-Wshadow"
|
||||
#endif
|
||||
|
||||
/* Strictly speaking the following include would be enough here,
|
||||
but everybody using this file will very likely need the other includes,
|
||||
so we are adding them here, so that not everybody will need all those
|
||||
pragmas to disable warnings. */
|
||||
//#include <ogr_geometry.h>
|
||||
#include <ogr_api.h>
|
||||
#include <ogrsf_frmts.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#else
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
#pragma GCC diagnostic ignored "-Wpadded"
|
||||
# include <ogr_geometry.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include <osmium/geom/coordinates.hpp>
|
||||
#include <osmium/geom/factory.hpp>
|
||||
|
||||
+12
-3
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,15 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* This file contains code for projecting OSM locations to arbitrary
|
||||
* coordinate reference systems. It is based on the Proj.4 library.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with `libproj`.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -77,11 +86,11 @@ namespace osmium {
|
||||
}
|
||||
|
||||
bool is_latlong() const {
|
||||
return pj_is_latlong(m_crs.get());
|
||||
return pj_is_latlong(m_crs.get()) != 0;
|
||||
}
|
||||
|
||||
bool is_geocent() const {
|
||||
return pj_is_geocent(m_crs.get());
|
||||
return pj_is_geocent(m_crs.get()) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -44,6 +44,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <osmium/osm/types.hpp>
|
||||
#include <osmium/osm/way.hpp>
|
||||
|
||||
#include <osmium/index/node_locations_map.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace handler {
|
||||
@@ -102,6 +104,9 @@ namespace osmium {
|
||||
NodeLocationsForWays(const NodeLocationsForWays&) = delete;
|
||||
NodeLocationsForWays& operator=(const NodeLocationsForWays&) = delete;
|
||||
|
||||
NodeLocationsForWays(NodeLocationsForWays&&) = default;
|
||||
NodeLocationsForWays& operator=(NodeLocationsForWays&&) = default;
|
||||
|
||||
~NodeLocationsForWays() noexcept = default;
|
||||
|
||||
void ignore_errors() {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef OSMIUM_INDEX_DETAIL_CREATE_MAP_WITH_FD_HPP
|
||||
#define OSMIUM_INDEX_DETAIL_CREATE_MAP_WITH_FD_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include <fcntl.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <vector>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace index {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <class T>
|
||||
inline T* create_map_with_fd(const std::vector<std::string>& config) {
|
||||
if (config.size() == 1) {
|
||||
return new T();
|
||||
} else {
|
||||
assert(config.size() > 1);
|
||||
const std::string& filename = config[1];
|
||||
int fd = ::open(filename.c_str(), O_CREAT | O_RDWR, 0644);
|
||||
if (fd == -1) {
|
||||
throw std::runtime_error(std::string("can't open file '") + filename + "': " + strerror(errno));
|
||||
}
|
||||
return new T(fd);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace index
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_DETAIL_CREATE_MAP_WITH_FD_HPP
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_DETAIL_MMAP_VECTOR_ANON_HPP
|
||||
#define OSMIUM_DETAIL_MMAP_VECTOR_ANON_HPP
|
||||
#ifndef OSMIUM_INDEX_DETAIL_MMAP_VECTOR_ANON_HPP
|
||||
#define OSMIUM_INDEX_DETAIL_MMAP_VECTOR_ANON_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace osmium {
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* This class looks and behaves like STL vector, but uses mmap internally.
|
||||
*/
|
||||
* This class looks and behaves like STL vector, but uses mmap internally.
|
||||
*/
|
||||
template <typename T>
|
||||
class mmap_vector_anon : public mmap_vector_base<T, mmap_vector_anon> {
|
||||
|
||||
@@ -75,4 +75,4 @@ namespace osmium {
|
||||
|
||||
#endif // __linux__
|
||||
|
||||
#endif // OSMIUM_DETAIL_MMAP_VECTOR_ANON_HPP
|
||||
#endif // OSMIUM_INDEX_DETAIL_MMAP_VECTOR_ANON_HPP
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_DETAIL_MMAP_VECTOR_BASE_HPP
|
||||
#define OSMIUM_DETAIL_MMAP_VECTOR_BASE_HPP
|
||||
#ifndef OSMIUM_INDEX_DETAIL_MMAP_VECTOR_BASE_HPP
|
||||
#define OSMIUM_INDEX_DETAIL_MMAP_VECTOR_BASE_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -38,6 +38,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <stdexcept>
|
||||
|
||||
#include <osmium/index/detail/typed_mmap.hpp>
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -180,4 +181,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_DETAIL_MMAP_VECTOR_BASE_HPP
|
||||
#endif // OSMIUM_INDEX_DETAIL_MMAP_VECTOR_BASE_HPP
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_DETAIL_MMAP_VECTOR_FILE_HPP
|
||||
#define OSMIUM_DETAIL_MMAP_VECTOR_FILE_HPP
|
||||
#ifndef OSMIUM_INDEX_DETAIL_MMAP_VECTOR_FILE_HPP
|
||||
#define OSMIUM_INDEX_DETAIL_MMAP_VECTOR_FILE_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -82,4 +82,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_DETAIL_MMAP_VECTOR_FILE_HPP
|
||||
#endif // OSMIUM_INDEX_DETAIL_MMAP_VECTOR_FILE_HPP
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_DETAIL_TMPFILE_HPP
|
||||
#define OSMIUM_DETAIL_TMPFILE_HPP
|
||||
#ifndef OSMIUM_INDEX_DETAIL_TMPFILE_HPP
|
||||
#define OSMIUM_INDEX_DETAIL_TMPFILE_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -59,4 +59,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_DETAIL_TMPFILE
|
||||
#endif // OSMIUM_INDEX_DETAIL_TMPFILE_HPP
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_DETAIL_TYPED_MMAP_HPP
|
||||
#define OSMIUM_DETAIL_TYPED_MMAP_HPP
|
||||
#ifndef OSMIUM_INDEX_DETAIL_TYPED_MMAP_HPP
|
||||
#define OSMIUM_INDEX_DETAIL_TYPED_MMAP_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -226,4 +226,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_DETAIL_TYPED_MMAP_HPP
|
||||
#endif // OSMIUM_INDEX_DETAIL_TYPED_MMAP_HPP
|
||||
|
||||
+6
-5
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_VECTOR_HPP
|
||||
#define OSMIUM_INDEX_MAP_VECTOR_HPP
|
||||
#ifndef OSMIUM_INDEX_DETAIL_VECTOR_MAP_HPP
|
||||
#define OSMIUM_INDEX_DETAIL_VECTOR_MAP_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -38,6 +38,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
#include <osmium/index/index.hpp>
|
||||
#include <osmium/index/map.hpp>
|
||||
#include <osmium/io/detail/read_write.hpp>
|
||||
|
||||
@@ -198,7 +199,7 @@ namespace osmium {
|
||||
std::sort(m_vector.begin(), m_vector.end());
|
||||
}
|
||||
|
||||
void dump_as_list(int fd) const override final {
|
||||
void dump_as_list(const int fd) override final {
|
||||
osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(m_vector.data()), byte_size());
|
||||
}
|
||||
|
||||
@@ -234,4 +235,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_VECTOR_HPP
|
||||
#endif // OSMIUM_INDEX_DETAIL_VECTOR_MAP_HPP
|
||||
+6
-5
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_VECTOR_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_VECTOR_HPP
|
||||
#ifndef OSMIUM_INDEX_DETAIL_VECTOR_MULTIMAP_HPP
|
||||
#define OSMIUM_INDEX_DETAIL_VECTOR_MULTIMAP_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -37,6 +37,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
#include <osmium/index/index.hpp>
|
||||
#include <osmium/index/multimap.hpp>
|
||||
#include <osmium/io/detail/read_write.hpp>
|
||||
|
||||
@@ -136,7 +137,7 @@ namespace osmium {
|
||||
);
|
||||
}
|
||||
|
||||
void dump_as_list(int fd) const override final {
|
||||
void dump_as_list(const int fd) override final {
|
||||
osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(m_vector.data()), byte_size());
|
||||
}
|
||||
|
||||
@@ -148,4 +149,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_VECTOR_HPP
|
||||
#endif // OSMIUM_INDEX_DETAIL_VECTOR_MULTIMAP_HPP
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+103
-3
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,10 +33,18 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include <osmium/index/index.hpp> // IWYU pragma: export
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
#include <osmium/util/string.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -140,7 +148,7 @@ namespace osmium {
|
||||
// default implementation is empty
|
||||
}
|
||||
|
||||
virtual void dump_as_list(int /*fd*/) const {
|
||||
virtual void dump_as_list(const int /*fd*/) {
|
||||
std::runtime_error("can't dump as list");
|
||||
}
|
||||
|
||||
@@ -148,6 +156,98 @@ namespace osmium {
|
||||
|
||||
} // namespace map
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
class MapFactory {
|
||||
|
||||
public:
|
||||
|
||||
typedef TId id_type;
|
||||
typedef TValue value_type;
|
||||
typedef osmium::index::map::Map<id_type, value_type> map_type;
|
||||
typedef std::function<map_type*(const std::vector<std::string>&)> create_map_func;
|
||||
|
||||
private:
|
||||
|
||||
std::map<const std::string, create_map_func> m_callbacks;
|
||||
|
||||
MapFactory() = default;
|
||||
|
||||
MapFactory(const MapFactory&) = delete;
|
||||
MapFactory& operator=(const MapFactory&) = delete;
|
||||
|
||||
MapFactory(MapFactory&&) = delete;
|
||||
MapFactory& operator=(MapFactory&&) = delete;
|
||||
|
||||
OSMIUM_NORETURN static void error(const std::string& map_type_name) {
|
||||
std::string error_message {"Support for map type '"};
|
||||
error_message += map_type_name;
|
||||
error_message += "' not compiled into this binary.";
|
||||
throw std::runtime_error(error_message);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
static MapFactory<id_type, value_type>& instance() {
|
||||
static MapFactory<id_type, value_type> factory;
|
||||
return factory;
|
||||
}
|
||||
|
||||
bool register_map(const std::string& map_type_name, create_map_func func) {
|
||||
return m_callbacks.emplace(map_type_name, func).second;
|
||||
}
|
||||
|
||||
std::vector<std::string> map_types() const {
|
||||
std::vector<std::string> result;
|
||||
|
||||
for (const auto& cb : m_callbacks) {
|
||||
result.push_back(cb.first);
|
||||
}
|
||||
|
||||
std::sort(result.begin(), result.end());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<map_type> create_map(const std::string& config_string) const {
|
||||
std::vector<std::string> config = osmium::split_string(config_string, ',');
|
||||
|
||||
if (config.empty()) {
|
||||
throw std::runtime_error("Need non-empty map type name.");
|
||||
}
|
||||
|
||||
auto it = m_callbacks.find(config[0]);
|
||||
if (it != m_callbacks.end()) {
|
||||
return std::unique_ptr<map_type>((it->second)(config));
|
||||
}
|
||||
|
||||
error(config[0]);
|
||||
}
|
||||
|
||||
}; // class MapFactory
|
||||
|
||||
namespace map {
|
||||
|
||||
template <typename TId, typename TValue, template<typename, typename> class TMap>
|
||||
struct create_map {
|
||||
TMap<TId, TValue>* operator()(const std::vector<std::string>&) {
|
||||
return new TMap<TId, TValue>();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
|
||||
template <typename TId, typename TValue, template<typename, typename> class TMap>
|
||||
inline bool register_map(const std::string& name) {
|
||||
return osmium::index::MapFactory<TId, TValue>::instance().register_map(name, [](const std::vector<std::string>& config) {
|
||||
return map::create_map<TId, TValue, TMap>()(config);
|
||||
});
|
||||
}
|
||||
|
||||
#define REGISTER_MAP(id, value, klass, name) \
|
||||
namespace { \
|
||||
const bool registered_index_map_##name = osmium::index::register_map<id, value, klass>(#name); \
|
||||
}
|
||||
|
||||
} // namespace index
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_ALL_HPP
|
||||
#define OSMIUM_INDEX_MAP_ALL_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <osmium/index/map/dense_file_array.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/map/dense_mem_array.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/map/dense_mmap_array.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/map/dummy.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/map/sparse_file_array.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/map/sparse_mem_array.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/map/sparse_mem_map.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/map/sparse_mem_table.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/map/sparse_mmap_array.hpp> // IWYU pragma: keep
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_ALL_HPP
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_DENSE_FILE_ARRAY_HPP
|
||||
#define OSMIUM_INDEX_MAP_DENSE_FILE_ARRAY_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <osmium/index/detail/mmap_vector_file.hpp>
|
||||
#include <osmium/index/detail/vector_map.hpp>
|
||||
#include <osmium/index/detail/create_map_with_fd.hpp>
|
||||
|
||||
#define OSMIUM_HAS_INDEX_MAP_DENSE_FILE_ARRAY
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace index {
|
||||
|
||||
namespace map {
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using DenseFileArray = VectorBasedDenseMap<osmium::detail::mmap_vector_file<TValue>, TId, TValue>;
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
struct create_map<TId, TValue, DenseFileArray> {
|
||||
DenseFileArray<TId, TValue>* operator()(const std::vector<std::string>& config) {
|
||||
return osmium::index::detail::create_map_with_fd<DenseFileArray<TId, TValue>>(config);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
|
||||
} // namespace index
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_DENSE_FILE_ARRAY_HPP
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_DENSE_MEM_ARRAY_HPP
|
||||
#define OSMIUM_INDEX_MAP_DENSE_MEM_ARRAY_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <osmium/index/detail/vector_map.hpp>
|
||||
|
||||
#define OSMIUM_HAS_INDEX_MAP_DENSE_MEM_ARRAY
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace index {
|
||||
|
||||
namespace map {
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using DenseMemArray = VectorBasedDenseMap<std::vector<TValue>, TId, TValue>;
|
||||
|
||||
} // namespace map
|
||||
|
||||
} // namespace index
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_DENSE_MEM_ARRAY_HPP
|
||||
+8
-9
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_MMAP_VECTOR_ANON_HPP
|
||||
#define OSMIUM_INDEX_MAP_MMAP_VECTOR_ANON_HPP
|
||||
#ifndef OSMIUM_INDEX_MAP_DENSE_MMAP_ARRAY_HPP
|
||||
#define OSMIUM_INDEX_MAP_DENSE_MMAP_ARRAY_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -35,8 +35,10 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#include <osmium/index/map/vector.hpp>
|
||||
#include <osmium/index/detail/mmap_vector_anon.hpp>
|
||||
#include <osmium/index/detail/vector_map.hpp>
|
||||
|
||||
#define OSMIUM_HAS_INDEX_MAP_DENSE_MMAP_ARRAY
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -45,10 +47,7 @@ namespace osmium {
|
||||
namespace map {
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using DenseMapMmap = VectorBasedDenseMap<osmium::detail::mmap_vector_anon<TValue>, TId, TValue>;
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using SparseMapMmap = VectorBasedSparseMap<TId, TValue, osmium::detail::mmap_vector_anon>;
|
||||
using DenseMmapArray = VectorBasedDenseMap<osmium::detail::mmap_vector_anon<TValue>, TId, TValue>;
|
||||
|
||||
} // namespace map
|
||||
|
||||
@@ -58,4 +57,4 @@ namespace osmium {
|
||||
|
||||
#endif // __linux__
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_MMAP_VECTOR_ANON_HPP
|
||||
#endif // OSMIUM_INDEX_MAP_DENSE_MMAP_ARRAY_HPP
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -35,6 +35,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <osmium/index/index.hpp>
|
||||
#include <osmium/index/map.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_SPARSE_FILE_ARRAY_HPP
|
||||
#define OSMIUM_INDEX_MAP_SPARSE_FILE_ARRAY_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <osmium/index/detail/mmap_vector_file.hpp>
|
||||
#include <osmium/index/detail/vector_map.hpp>
|
||||
#include <osmium/index/detail/create_map_with_fd.hpp>
|
||||
|
||||
#define OSMIUM_HAS_INDEX_MAP_SPARSE_FILE_ARRAY
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace index {
|
||||
|
||||
namespace map {
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using SparseFileArray = VectorBasedSparseMap<TId, TValue, osmium::detail::mmap_vector_file>;
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
struct create_map<TId, TValue, SparseFileArray> {
|
||||
SparseFileArray<TId, TValue>* operator()(const std::vector<std::string>& config) {
|
||||
return osmium::index::detail::create_map_with_fd<SparseFileArray<TId, TValue>>(config);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
|
||||
} // namespace index
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_SPARSE_FILE_ARRAY_HPP
|
||||
+8
-9
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_STL_VECTOR_HPP
|
||||
#define OSMIUM_INDEX_MAP_STL_VECTOR_HPP
|
||||
#ifndef OSMIUM_INDEX_MAP_SPARSE_MEM_ARRAY_HPP
|
||||
#define OSMIUM_INDEX_MAP_SPARSE_MEM_ARRAY_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -35,7 +35,9 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <osmium/index/map/vector.hpp>
|
||||
#include <osmium/index/detail/vector_map.hpp>
|
||||
|
||||
#define OSMIUM_HAS_INDEX_MAP_SPARSE_MEM_ARRAY
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -43,14 +45,11 @@ namespace osmium {
|
||||
|
||||
namespace map {
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using DenseMapMem = VectorBasedDenseMap<std::vector<TValue>, TId, TValue>;
|
||||
|
||||
template <typename T>
|
||||
using StdVectorWrap = std::vector<T>;
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using SparseMapMem = VectorBasedSparseMap<TId, TValue, StdVectorWrap>;
|
||||
using SparseMemArray = VectorBasedSparseMap<TId, TValue, StdVectorWrap>;
|
||||
|
||||
} // namespace map
|
||||
|
||||
@@ -58,4 +57,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_STL_VECTOR_HPP
|
||||
#endif // OSMIUM_INDEX_MAP_SPARSE_MEM_ARRAY_HPP
|
||||
+12
-9
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_STL_MAP_HPP
|
||||
#define OSMIUM_INDEX_MAP_STL_MAP_HPP
|
||||
#ifndef OSMIUM_INDEX_MAP_SPARSE_MEM_MAP_HPP
|
||||
#define OSMIUM_INDEX_MAP_SPARSE_MEM_MAP_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -41,8 +41,11 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <vector>
|
||||
|
||||
#include <osmium/index/map.hpp>
|
||||
#include <osmium/index/index.hpp>
|
||||
#include <osmium/io/detail/read_write.hpp>
|
||||
|
||||
#define OSMIUM_HAS_INDEX_MAP_SPARSE_MEM_MAP
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace index {
|
||||
@@ -54,7 +57,7 @@ namespace osmium {
|
||||
* lot of memory, but might make sense for small maps.
|
||||
*/
|
||||
template <typename TId, typename TValue>
|
||||
class StlMap : public osmium::index::map::Map<TId, TValue> {
|
||||
class SparseMemMap : public osmium::index::map::Map<TId, TValue> {
|
||||
|
||||
// This is a rough estimate for the memory needed for each
|
||||
// element in the map (id + value + pointers to left, right,
|
||||
@@ -66,9 +69,9 @@ namespace osmium {
|
||||
|
||||
public:
|
||||
|
||||
StlMap() = default;
|
||||
SparseMemMap() = default;
|
||||
|
||||
~StlMap() override final = default;
|
||||
~SparseMemMap() override final = default;
|
||||
|
||||
void set(const TId id, const TValue value) override final {
|
||||
m_elements[id] = value;
|
||||
@@ -94,14 +97,14 @@ namespace osmium {
|
||||
m_elements.clear();
|
||||
}
|
||||
|
||||
void dump_as_list(const int fd) const override final {
|
||||
void dump_as_list(const int fd) override final {
|
||||
typedef typename std::map<TId, TValue>::value_type t;
|
||||
std::vector<t> v;
|
||||
std::copy(m_elements.begin(), m_elements.end(), std::back_inserter(v));
|
||||
osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(v.data()), sizeof(t) * v.size());
|
||||
}
|
||||
|
||||
}; // class StlMap
|
||||
}; // class SparseMemMap
|
||||
|
||||
} // namespace map
|
||||
|
||||
@@ -109,4 +112,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_STL_MAP_HPP
|
||||
#endif // OSMIUM_INDEX_MAP_SPARSE_MEM_MAP_HPP
|
||||
+14
-12
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_SPARSE_TABLE_HPP
|
||||
#define OSMIUM_INDEX_MAP_SPARSE_TABLE_HPP
|
||||
#ifndef OSMIUM_INDEX_MAP_SPARSE_MEM_TABLE_HPP
|
||||
#define OSMIUM_INDEX_MAP_SPARSE_MEM_TABLE_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -34,15 +34,17 @@ DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <google/sparsetable>
|
||||
|
||||
#include <osmium/index/index.hpp>
|
||||
#include <osmium/index/map.hpp>
|
||||
#include <osmium/io/detail/read_write.hpp>
|
||||
|
||||
#define OSMIUM_HAS_INDEX_MAP_SPARSE_MEM_TABLE
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace index {
|
||||
@@ -50,9 +52,9 @@ namespace osmium {
|
||||
namespace map {
|
||||
|
||||
/**
|
||||
* The SparseTable index stores elements in a Google sparsetable,
|
||||
* The SparseMemTable index stores elements in a Google sparsetable,
|
||||
* a data structure that can hold sparsly filled tables in a
|
||||
* very space efficient way. It will resize automatically.
|
||||
* space efficient way. It will resize automatically.
|
||||
*
|
||||
* Use this index if the ID space is only sparsly
|
||||
* populated, such as when working with smaller OSM files (like
|
||||
@@ -61,7 +63,7 @@ namespace osmium {
|
||||
* This will only work on 64 bit machines.
|
||||
*/
|
||||
template <typename TId, typename TValue>
|
||||
class SparseTable : public osmium::index::map::Map<TId, TValue> {
|
||||
class SparseMemTable : public osmium::index::map::Map<TId, TValue> {
|
||||
|
||||
TId m_grow_size;
|
||||
|
||||
@@ -79,12 +81,12 @@ namespace osmium {
|
||||
* The storage will grow by at least this size
|
||||
* every time it runs out of space.
|
||||
*/
|
||||
explicit SparseTable(const TId grow_size=10000) :
|
||||
explicit SparseMemTable(const TId grow_size=10000) :
|
||||
m_grow_size(grow_size),
|
||||
m_elements(grow_size) {
|
||||
}
|
||||
|
||||
~SparseTable() override final = default;
|
||||
~SparseMemTable() override final = default;
|
||||
|
||||
void set(const TId id, const TValue value) override final {
|
||||
if (id >= m_elements.size()) {
|
||||
@@ -117,7 +119,7 @@ namespace osmium {
|
||||
m_elements.clear();
|
||||
}
|
||||
|
||||
void dump_as_list(const int fd) const override final {
|
||||
void dump_as_list(const int fd) override final {
|
||||
std::vector<std::pair<TId, TValue>> v;
|
||||
int n=0;
|
||||
for (const TValue value : m_elements) {
|
||||
@@ -129,7 +131,7 @@ namespace osmium {
|
||||
osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(v.data()), sizeof(std::pair<TId, TValue>) * v.size());
|
||||
}
|
||||
|
||||
}; // class SparseTable
|
||||
}; // class SparseMemTable
|
||||
|
||||
} // namespace map
|
||||
|
||||
@@ -137,4 +139,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_BYID_SPARSE_TABLE_HPP
|
||||
#endif // OSMIUM_INDEX_BYID_SPARSE_MEM_TABLE_HPP
|
||||
+13
-10
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MAP_MMAP_VECTOR_FILE_HPP
|
||||
#define OSMIUM_INDEX_MAP_MMAP_VECTOR_FILE_HPP
|
||||
#ifndef OSMIUM_INDEX_MAP_SPARSE_MMAP_ARRAY_HPP
|
||||
#define OSMIUM_INDEX_MAP_SPARSE_MMAP_ARRAY_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,8 +33,12 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <osmium/index/map/vector.hpp>
|
||||
#include <osmium/index/detail/mmap_vector_file.hpp>
|
||||
#ifdef __linux__
|
||||
|
||||
#include <osmium/index/detail/mmap_vector_anon.hpp>
|
||||
#include <osmium/index/detail/vector_map.hpp>
|
||||
|
||||
#define OSMIUM_HAS_INDEX_MAP_SPARSE_MMAP_ARRAY
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -43,10 +47,7 @@ namespace osmium {
|
||||
namespace map {
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using DenseMapFile = VectorBasedDenseMap<osmium::detail::mmap_vector_file<TValue>, TId, TValue>;
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using SparseMapFile = VectorBasedSparseMap<TId, TValue, osmium::detail::mmap_vector_file>;
|
||||
using SparseMmapArray = VectorBasedSparseMap<TId, TValue, osmium::detail::mmap_vector_anon>;
|
||||
|
||||
} // namespace map
|
||||
|
||||
@@ -54,4 +55,6 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_MMAP_VECTOR_FILE_HPP
|
||||
#endif // __linux__
|
||||
|
||||
#endif // OSMIUM_INDEX_MAP_SPARSE_MMAP_ARRAY_HPP
|
||||
+3
-4
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -34,11 +34,10 @@ DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include <osmium/index/index.hpp> // IWYU pragma: export
|
||||
|
||||
namespace osmium {
|
||||
|
||||
namespace index {
|
||||
@@ -114,7 +113,7 @@ namespace osmium {
|
||||
// default implementation is empty
|
||||
}
|
||||
|
||||
virtual void dump_as_list(int /*fd*/) const {
|
||||
virtual void dump_as_list(const int /*fd*/) {
|
||||
std::runtime_error("can't dump as list");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_ALL_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_ALL_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <osmium/index/multimap/sparse_file_array.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/multimap/sparse_mem_array.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/multimap/sparse_mem_multimap.hpp> // IWYU pragma: keep
|
||||
#include <osmium/index/multimap/sparse_mmap_array.hpp> // IWYU pragma: keep
|
||||
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_ALL_HPP
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -36,9 +36,10 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
#include <osmium/index/index.hpp>
|
||||
#include <osmium/index/multimap.hpp>
|
||||
#include <osmium/index/multimap/stl_vector.hpp>
|
||||
#include <osmium/index/multimap/stl_multimap.hpp>
|
||||
#include <osmium/index/multimap/sparse_mem_array.hpp>
|
||||
#include <osmium/index/multimap/sparse_mem_multimap.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -49,8 +50,8 @@ namespace osmium {
|
||||
template <typename TId, typename TValue>
|
||||
class HybridIterator {
|
||||
|
||||
typedef SparseMultimapMem<TId, TValue> main_map_type;
|
||||
typedef StlMultimap<TId, TValue> extra_map_type;
|
||||
typedef SparseMemArray<TId, TValue> main_map_type;
|
||||
typedef SparseMemMultimap<TId, TValue> extra_map_type;
|
||||
|
||||
typedef typename std::pair<TId, TValue> element_type;
|
||||
|
||||
@@ -117,8 +118,8 @@ namespace osmium {
|
||||
template <typename TId, typename TValue>
|
||||
class Hybrid : public Multimap<TId, TValue> {
|
||||
|
||||
typedef SparseMultimapMem<TId, TValue> main_map_type;
|
||||
typedef StlMultimap<TId, TValue> extra_map_type;
|
||||
typedef SparseMemArray<TId, TValue> main_map_type;
|
||||
typedef SparseMemMultimap<TId, TValue> extra_map_type;
|
||||
|
||||
main_map_type m_main;
|
||||
extra_map_type m_extra;
|
||||
@@ -174,7 +175,7 @@ namespace osmium {
|
||||
m_main.sort();
|
||||
}
|
||||
|
||||
void dump_as_list(int fd) override final {
|
||||
void dump_as_list(const int fd) override final {
|
||||
consolidate();
|
||||
m_main.dump_as_list(fd);
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_MMAP_VECTOR_FILE_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_MMAP_VECTOR_FILE_HPP
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_SPARSE_FILE_ARRAY_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_SPARSE_FILE_ARRAY_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,8 +33,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <osmium/index/multimap/vector.hpp>
|
||||
#include <osmium/index/detail/mmap_vector_file.hpp>
|
||||
#include <osmium/index/detail/vector_multimap.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace osmium {
|
||||
namespace multimap {
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using SparseMultimapFile = VectorBasedSparseMultimap<TId, TValue, osmium::detail::mmap_vector_file>;
|
||||
using SparseFileArray = VectorBasedSparseMultimap<TId, TValue, osmium::detail::mmap_vector_file>;
|
||||
|
||||
} // namespace multimap
|
||||
|
||||
@@ -51,4 +51,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_MMAP_VECTOR_FILE_HPP
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_SPARSE_FILE_ARRAY_HPP
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_STL_VECTOR_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_STL_VECTOR_HPP
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_SPARSE_MEM_ARRAY_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_SPARSE_MEM_ARRAY_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -35,7 +35,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <osmium/index/multimap/vector.hpp>
|
||||
#include <osmium/index/detail/vector_multimap.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace osmium {
|
||||
using StdVectorWrap = std::vector<T>;
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using SparseMultimapMem = VectorBasedSparseMultimap<TId, TValue, StdVectorWrap>;
|
||||
using SparseMemArray = VectorBasedSparseMultimap<TId, TValue, StdVectorWrap>;
|
||||
|
||||
} // namespace multimap
|
||||
|
||||
@@ -55,4 +55,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_STL_VECTOR_HPP
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_SPARSE_MEM_ARRAY_HPP
|
||||
+9
-9
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_STL_MULTIMAP_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_STL_MULTIMAP_HPP
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_SPARSE_MEM_MULTIMAP_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_SPARSE_MEM_MULTIMAP_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace osmium {
|
||||
* lot of memory, but might make sense for small maps.
|
||||
*/
|
||||
template <typename TId, typename TValue>
|
||||
class StlMultimap : public osmium::index::multimap::Multimap<TId, TValue> {
|
||||
class SparseMemMultimap : public osmium::index::multimap::Multimap<TId, TValue> {
|
||||
|
||||
// This is a rough estimate for the memory needed for each
|
||||
// element in the map (id + value + pointers to left, right,
|
||||
@@ -76,9 +76,9 @@ namespace osmium {
|
||||
|
||||
public:
|
||||
|
||||
StlMultimap() = default;
|
||||
SparseMemMultimap() = default;
|
||||
|
||||
~StlMultimap() noexcept override final = default;
|
||||
~SparseMemMultimap() noexcept override final = default;
|
||||
|
||||
void unsorted_set(const TId id, const TValue value) {
|
||||
m_elements.emplace(id, value);
|
||||
@@ -130,7 +130,7 @@ namespace osmium {
|
||||
// intentionally left blank
|
||||
}
|
||||
|
||||
void dump_as_list(const int fd) const override final {
|
||||
void dump_as_list(const int fd) override final {
|
||||
std::vector<element_type> v;
|
||||
for (const auto& element : m_elements) {
|
||||
v.emplace_back(element.first, element.second);
|
||||
@@ -140,7 +140,7 @@ namespace osmium {
|
||||
osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(v.data()), sizeof(element_type) * v.size());
|
||||
}
|
||||
|
||||
}; // class StlMultimap
|
||||
}; // class SparseMemMultimap
|
||||
|
||||
} // namespace multimap
|
||||
|
||||
@@ -148,4 +148,4 @@ namespace osmium {
|
||||
|
||||
} // namespace osmium
|
||||
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_STL_MULTIMAP_HPP
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_SPARSE_MEM_MULTIMAP_HPP
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_MMAP_VECTOR_ANON_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_MMAP_VECTOR_ANON_HPP
|
||||
#ifndef OSMIUM_INDEX_MULTIMAP_SPARSE_MMAP_ARRAY_HPP
|
||||
#define OSMIUM_INDEX_MULTIMAP_SPARSE_MMAP_ARRAY_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -35,8 +35,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#include <osmium/index/multimap/vector.hpp>
|
||||
#include <osmium/index/detail/mmap_vector_anon.hpp>
|
||||
#include <osmium/index/detail/vector_multimap.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace osmium {
|
||||
namespace multimap {
|
||||
|
||||
template <typename TId, typename TValue>
|
||||
using SparseMultimapMmap = VectorBasedSparseMultimap<TId, TValue, osmium::detail::mmap_vector_anon>;
|
||||
using SparseMmapArray = VectorBasedSparseMultimap<TId, TValue, osmium::detail::mmap_vector_anon>;
|
||||
|
||||
} // namespace multimap
|
||||
|
||||
@@ -55,4 +55,4 @@ namespace osmium {
|
||||
|
||||
#endif // __linux__
|
||||
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_MMAP_VECTOR_ANON_HPP
|
||||
#endif // OSMIUM_INDEX_MULTIMAP_SPARSE_MMAP_ARRAY_HPP
|
||||
@@ -0,0 +1,70 @@
|
||||
#ifndef OSMIUM_INDEX_NODE_LOCATIONS_MAP_HPP
|
||||
#define OSMIUM_INDEX_NODE_LOCATIONS_MAP_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include <osmium/index/map.hpp> // IWYU pragma: keep
|
||||
|
||||
#ifdef OSMIUM_HAS_INDEX_MAP_DENSE_FILE_ARRAY
|
||||
REGISTER_MAP(osmium::unsigned_object_id_type, osmium::Location, osmium::index::map::DenseFileArray, dense_file_array)
|
||||
#endif
|
||||
|
||||
#ifdef OSMIUM_HAS_INDEX_MAP_DENSE_MEM_ARRAY
|
||||
REGISTER_MAP(osmium::unsigned_object_id_type, osmium::Location, osmium::index::map::DenseMemArray, dense_mem_array)
|
||||
#endif
|
||||
|
||||
#ifdef OSMIUM_HAS_INDEX_MAP_DENSE_MMAP_ARRAY
|
||||
REGISTER_MAP(osmium::unsigned_object_id_type, osmium::Location, osmium::index::map::DenseMmapArray, dense_mmap_array)
|
||||
#endif
|
||||
|
||||
#ifdef OSMIUM_HAS_INDEX_MAP_SPARSE_FILE_ARRAY
|
||||
REGISTER_MAP(osmium::unsigned_object_id_type, osmium::Location, osmium::index::map::SparseFileArray, sparse_file_array)
|
||||
#endif
|
||||
|
||||
#ifdef OSMIUM_HAS_INDEX_MAP_SPARSE_MEM_ARRAY
|
||||
REGISTER_MAP(osmium::unsigned_object_id_type, osmium::Location, osmium::index::map::SparseMemArray, sparse_mem_array)
|
||||
#endif
|
||||
|
||||
#ifdef OSMIUM_HAS_INDEX_MAP_SPARSE_MEM_MAP
|
||||
REGISTER_MAP(osmium::unsigned_object_id_type, osmium::Location, osmium::index::map::SparseMemMap, sparse_mem_map)
|
||||
#endif
|
||||
|
||||
#ifdef OSMIUM_HAS_INDEX_MAP_SPARSE_MEM_TABLE
|
||||
REGISTER_MAP(osmium::unsigned_object_id_type, osmium::Location, osmium::index::map::SparseMemTable, sparse_mem_table)
|
||||
#endif
|
||||
|
||||
#ifdef OSMIUM_HAS_INDEX_MAP_SPARSE_MMAP_ARRAY
|
||||
REGISTER_MAP(osmium::unsigned_object_id_type, osmium::Location, osmium::index::map::SparseMmapArray, sparse_mmap_array)
|
||||
#endif
|
||||
|
||||
#endif // OSMIUM_INDEX_NODE_LOCATIONS_MAP_HPP
|
||||
+10
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,15 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Include this file if you want to read or write compressed OSM XML files.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with `libz`
|
||||
* and `libbz2`.
|
||||
*/
|
||||
|
||||
#include <osmium/io/bzip2_compression.hpp> // IWYU pragma: export
|
||||
#include <osmium/io/gzip_compression.hpp> // IWYU pragma: export
|
||||
|
||||
|
||||
+11
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,16 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Include this file if you want to read all kinds of OSM files.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with
|
||||
* `libprotobuf-lite`, `libosmpbf`, `ws2_32` (Windows only),
|
||||
* `libexpat`, `libz`, `libbz2`, and enable multithreading.
|
||||
*/
|
||||
|
||||
#include <osmium/io/any_compression.hpp> // IWYU pragma: export
|
||||
|
||||
#include <osmium/io/pbf_input.hpp> // IWYU pragma: export
|
||||
|
||||
+11
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,16 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Include this file if you want to write all kinds of OSM files.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with
|
||||
* `libprotobuf-lite`, `libosmpbf`, `ws2_32` (Windows only),
|
||||
* `libz`, `libbz2`, and enable multithreading.
|
||||
*/
|
||||
|
||||
#include <osmium/io/any_compression.hpp> // IWYU pragma: export
|
||||
|
||||
#include <osmium/io/opl_output.hpp> // IWYU pragma: export
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,17 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Include this file if you want to read or write bzip2-compressed OSM XML
|
||||
* files.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with `libbz2`.
|
||||
*/
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -97,9 +97,9 @@ namespace osmium {
|
||||
|
||||
static constexpr size_t tmp_buffer_size = 100;
|
||||
|
||||
osmium::memory::Buffer m_input_buffer;
|
||||
std::shared_ptr<osmium::memory::Buffer> m_input_buffer;
|
||||
|
||||
std::string m_out;
|
||||
std::shared_ptr<std::string> m_out;
|
||||
|
||||
char m_tmp_buffer[tmp_buffer_size+1];
|
||||
|
||||
@@ -114,13 +114,13 @@ namespace osmium {
|
||||
_snprintf(m_tmp_buffer, tmp_buffer_size, format, std::forward<TArgs>(args)...);
|
||||
#endif
|
||||
assert(len > 0 && static_cast<size_t>(len) < tmp_buffer_size);
|
||||
m_out += m_tmp_buffer;
|
||||
*m_out += m_tmp_buffer;
|
||||
}
|
||||
|
||||
void append_encoded_string(const std::string& data) {
|
||||
boost::u8_to_u32_iterator<std::string::const_iterator> it(data.cbegin(), data.cbegin(), data.cend());
|
||||
boost::u8_to_u32_iterator<std::string::const_iterator> end(data.cend(), data.cend(), data.cend());
|
||||
boost::utf8_output_iterator<std::back_insert_iterator<std::string>> oit(std::back_inserter(m_out));
|
||||
boost::utf8_output_iterator<std::back_insert_iterator<std::string>> oit(std::back_inserter(*m_out));
|
||||
|
||||
for (; it != end; ++it) {
|
||||
uint32_t c = *it;
|
||||
@@ -140,7 +140,7 @@ namespace osmium {
|
||||
(0x00ae <= c && c <= 0x05ff)) {
|
||||
*oit = c;
|
||||
} else {
|
||||
m_out += '%';
|
||||
*m_out += '%';
|
||||
output_formatted("%04x", c);
|
||||
}
|
||||
}
|
||||
@@ -148,21 +148,21 @@ namespace osmium {
|
||||
|
||||
void write_meta(const osmium::OSMObject& object) {
|
||||
output_formatted("%" PRId64 " v%d d", object.id(), object.version());
|
||||
m_out += (object.visible() ? 'V' : 'D');
|
||||
*m_out += (object.visible() ? 'V' : 'D');
|
||||
output_formatted(" c%d t", object.changeset());
|
||||
m_out += object.timestamp().to_iso();
|
||||
*m_out += object.timestamp().to_iso();
|
||||
output_formatted(" i%d u", object.uid());
|
||||
append_encoded_string(object.user());
|
||||
m_out += " T";
|
||||
*m_out += " T";
|
||||
bool first = true;
|
||||
for (const auto& tag : object.tags()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
m_out += ',';
|
||||
*m_out += ',';
|
||||
}
|
||||
append_encoded_string(tag.key());
|
||||
m_out += '=';
|
||||
*m_out += '=';
|
||||
append_encoded_string(tag.value());
|
||||
}
|
||||
}
|
||||
@@ -171,109 +171,103 @@ namespace osmium {
|
||||
if (location) {
|
||||
output_formatted(" %c%.7f %c%.7f", x, location.lon_without_check(), y, location.lat_without_check());
|
||||
} else {
|
||||
m_out += ' ';
|
||||
m_out += x;
|
||||
m_out += ' ';
|
||||
m_out += y;
|
||||
*m_out += ' ';
|
||||
*m_out += x;
|
||||
*m_out += ' ';
|
||||
*m_out += y;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit OPLOutputBlock(osmium::memory::Buffer&& buffer) :
|
||||
m_input_buffer(std::move(buffer)),
|
||||
m_out(),
|
||||
m_input_buffer(std::make_shared<osmium::memory::Buffer>(std::move(buffer))),
|
||||
m_out(std::make_shared<std::string>()),
|
||||
m_tmp_buffer() {
|
||||
}
|
||||
|
||||
OPLOutputBlock(const OPLOutputBlock&) = delete;
|
||||
OPLOutputBlock& operator=(const OPLOutputBlock&) = delete;
|
||||
OPLOutputBlock(const OPLOutputBlock&) = default;
|
||||
OPLOutputBlock& operator=(const OPLOutputBlock&) = default;
|
||||
|
||||
OPLOutputBlock(OPLOutputBlock&& other) :
|
||||
m_input_buffer(std::move(other.m_input_buffer)),
|
||||
m_out(),
|
||||
m_tmp_buffer() {
|
||||
}
|
||||
OPLOutputBlock(OPLOutputBlock&&) = default;
|
||||
OPLOutputBlock& operator=(OPLOutputBlock&&) = default;
|
||||
|
||||
OPLOutputBlock& operator=(OPLOutputBlock&& other) {
|
||||
m_input_buffer = std::move(other.m_input_buffer);
|
||||
return *this;
|
||||
}
|
||||
~OPLOutputBlock() = default;
|
||||
|
||||
std::string operator()() {
|
||||
osmium::apply(m_input_buffer.cbegin(), m_input_buffer.cend(), *this);
|
||||
osmium::apply(m_input_buffer->cbegin(), m_input_buffer->cend(), *this);
|
||||
|
||||
std::string out;
|
||||
std::swap(out, m_out);
|
||||
std::swap(out, *m_out);
|
||||
return out;
|
||||
}
|
||||
|
||||
void node(const osmium::Node& node) {
|
||||
m_out += 'n';
|
||||
*m_out += 'n';
|
||||
write_meta(node);
|
||||
write_location(node.location(), 'x', 'y');
|
||||
m_out += '\n';
|
||||
*m_out += '\n';
|
||||
}
|
||||
|
||||
void way(const osmium::Way& way) {
|
||||
m_out += 'w';
|
||||
*m_out += 'w';
|
||||
write_meta(way);
|
||||
|
||||
m_out += " N";
|
||||
*m_out += " N";
|
||||
bool first = true;
|
||||
for (const auto& node_ref : way.nodes()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
m_out += ',';
|
||||
*m_out += ',';
|
||||
}
|
||||
output_formatted("n%" PRId64, node_ref.ref());
|
||||
}
|
||||
m_out += '\n';
|
||||
*m_out += '\n';
|
||||
}
|
||||
|
||||
void relation(const osmium::Relation& relation) {
|
||||
m_out += 'r';
|
||||
*m_out += 'r';
|
||||
write_meta(relation);
|
||||
|
||||
m_out += " M";
|
||||
*m_out += " M";
|
||||
bool first = true;
|
||||
for (const auto& member : relation.members()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
m_out += ',';
|
||||
*m_out += ',';
|
||||
}
|
||||
m_out += item_type_to_char(member.type());
|
||||
*m_out += item_type_to_char(member.type());
|
||||
output_formatted("%" PRId64 "@", member.ref());
|
||||
m_out += member.role();
|
||||
*m_out += member.role();
|
||||
}
|
||||
m_out += '\n';
|
||||
*m_out += '\n';
|
||||
}
|
||||
|
||||
void changeset(const osmium::Changeset& changeset) {
|
||||
output_formatted("c%d k%d s", changeset.id(), changeset.num_changes());
|
||||
m_out += changeset.created_at().to_iso();
|
||||
m_out += " e";
|
||||
m_out += changeset.closed_at().to_iso();
|
||||
*m_out += changeset.created_at().to_iso();
|
||||
*m_out += " e";
|
||||
*m_out += changeset.closed_at().to_iso();
|
||||
output_formatted(" i%d u", changeset.uid());
|
||||
append_encoded_string(changeset.user());
|
||||
write_location(changeset.bounds().bottom_left(), 'x', 'y');
|
||||
write_location(changeset.bounds().top_right(), 'X', 'Y');
|
||||
m_out += " T";
|
||||
*m_out += " T";
|
||||
bool first = true;
|
||||
for (const auto& tag : changeset.tags()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
m_out += ',';
|
||||
*m_out += ',';
|
||||
}
|
||||
append_encoded_string(tag.key());
|
||||
m_out += '=';
|
||||
*m_out += '=';
|
||||
append_encoded_string(tag.value());
|
||||
}
|
||||
|
||||
m_out += '\n';
|
||||
*m_out += '\n';
|
||||
}
|
||||
|
||||
}; // OPLOutputBlock
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -412,28 +412,34 @@ namespace osmium {
|
||||
|
||||
class DataBlobParser {
|
||||
|
||||
std::string m_input_buffer;
|
||||
std::shared_ptr<std::string> m_input_buffer;
|
||||
osmium::osm_entity_bits::type m_read_types;
|
||||
|
||||
public:
|
||||
|
||||
DataBlobParser(std::string&& input_buffer, osmium::osm_entity_bits::type read_types) :
|
||||
m_input_buffer(std::move(input_buffer)),
|
||||
m_input_buffer(std::make_shared<std::string>(std::move(input_buffer))),
|
||||
m_read_types(read_types) {
|
||||
if (input_buffer.size() > OSMPBF::max_uncompressed_blob_size) {
|
||||
throw osmium::pbf_error(std::string("invalid blob size: " + std::to_string(input_buffer.size())));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DataBlobParser(const DataBlobParser& other) :
|
||||
m_input_buffer(std::move(other.m_input_buffer)),
|
||||
m_read_types(other.m_read_types) {
|
||||
}
|
||||
}*/
|
||||
|
||||
DataBlobParser& operator=(const DataBlobParser&) = delete;
|
||||
DataBlobParser(const DataBlobParser&) = default;
|
||||
DataBlobParser& operator=(const DataBlobParser&) = default;
|
||||
|
||||
DataBlobParser(DataBlobParser&&) = default;
|
||||
DataBlobParser& operator=(DataBlobParser&&) = default;
|
||||
|
||||
~DataBlobParser() = default;
|
||||
|
||||
osmium::memory::Buffer operator()() {
|
||||
const std::unique_ptr<const std::string> data = unpack_blob(m_input_buffer);
|
||||
const std::unique_ptr<const std::string> data = unpack_blob(*m_input_buffer);
|
||||
PBFPrimitiveBlockParser parser(*data, m_read_types);
|
||||
return parser();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -699,7 +699,7 @@ namespace osmium {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void close() {
|
||||
void close() override {
|
||||
m_done = true;
|
||||
osmium::thread::wait_until_done(m_parser_future);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -120,9 +120,9 @@ namespace osmium {
|
||||
op_delete = 3
|
||||
}; // enum class operation
|
||||
|
||||
osmium::memory::Buffer m_input_buffer;
|
||||
std::shared_ptr<osmium::memory::Buffer> m_input_buffer;
|
||||
|
||||
std::string m_out;
|
||||
std::shared_ptr<std::string> m_out;
|
||||
|
||||
operation m_last_op {operation::op_none};
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace osmium {
|
||||
|
||||
void write_spaces(int num) {
|
||||
for (; num!=0; --num) {
|
||||
m_out += ' ';
|
||||
*m_out += ' ';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,33 +144,33 @@ namespace osmium {
|
||||
}
|
||||
|
||||
void write_meta(const osmium::OSMObject& object) {
|
||||
oprintf(m_out, " id=\"%" PRId64 "\"", object.id());
|
||||
oprintf(*m_out, " id=\"%" PRId64 "\"", object.id());
|
||||
|
||||
if (object.version()) {
|
||||
oprintf(m_out, " version=\"%d\"", object.version());
|
||||
oprintf(*m_out, " version=\"%d\"", object.version());
|
||||
}
|
||||
|
||||
if (object.timestamp()) {
|
||||
m_out += " timestamp=\"";
|
||||
m_out += object.timestamp().to_iso();
|
||||
m_out += "\"";
|
||||
*m_out += " timestamp=\"";
|
||||
*m_out += object.timestamp().to_iso();
|
||||
*m_out += "\"";
|
||||
}
|
||||
|
||||
if (!object.user_is_anonymous()) {
|
||||
oprintf(m_out, " uid=\"%d\" user=\"", object.uid());
|
||||
xml_string(m_out, object.user());
|
||||
m_out += "\"";
|
||||
oprintf(*m_out, " uid=\"%d\" user=\"", object.uid());
|
||||
xml_string(*m_out, object.user());
|
||||
*m_out += "\"";
|
||||
}
|
||||
|
||||
if (object.changeset()) {
|
||||
oprintf(m_out, " changeset=\"%d\"", object.changeset());
|
||||
oprintf(*m_out, " changeset=\"%d\"", object.changeset());
|
||||
}
|
||||
|
||||
if (m_write_visible_flag) {
|
||||
if (object.visible()) {
|
||||
m_out += " visible=\"true\"";
|
||||
*m_out += " visible=\"true\"";
|
||||
} else {
|
||||
m_out += " visible=\"false\"";
|
||||
*m_out += " visible=\"false\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,11 +178,11 @@ namespace osmium {
|
||||
void write_tags(const osmium::TagList& tags) {
|
||||
for (const auto& tag : tags) {
|
||||
write_prefix();
|
||||
m_out += " <tag k=\"";
|
||||
xml_string(m_out, tag.key());
|
||||
m_out += "\" v=\"";
|
||||
xml_string(m_out, tag.value());
|
||||
m_out += "\"/>\n";
|
||||
*m_out += " <tag k=\"";
|
||||
xml_string(*m_out, tag.key());
|
||||
*m_out += "\" v=\"";
|
||||
xml_string(*m_out, tag.value());
|
||||
*m_out += "\"/>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,13 +195,13 @@ namespace osmium {
|
||||
case operation::op_none:
|
||||
break;
|
||||
case operation::op_create:
|
||||
m_out += " </create>\n";
|
||||
*m_out += " </create>\n";
|
||||
break;
|
||||
case operation::op_modify:
|
||||
m_out += " </modify>\n";
|
||||
*m_out += " </modify>\n";
|
||||
break;
|
||||
case operation::op_delete:
|
||||
m_out += " </delete>\n";
|
||||
*m_out += " </delete>\n";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -209,13 +209,13 @@ namespace osmium {
|
||||
case operation::op_none:
|
||||
break;
|
||||
case operation::op_create:
|
||||
m_out += " <create>\n";
|
||||
*m_out += " <create>\n";
|
||||
break;
|
||||
case operation::op_modify:
|
||||
m_out += " <modify>\n";
|
||||
*m_out += " <modify>\n";
|
||||
break;
|
||||
case operation::op_delete:
|
||||
m_out += " <delete>\n";
|
||||
*m_out += " <delete>\n";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -225,26 +225,29 @@ namespace osmium {
|
||||
public:
|
||||
|
||||
explicit XMLOutputBlock(osmium::memory::Buffer&& buffer, bool write_visible_flag, bool write_change_ops) :
|
||||
m_input_buffer(std::move(buffer)),
|
||||
m_input_buffer(std::make_shared<osmium::memory::Buffer>(std::move(buffer))),
|
||||
m_out(std::make_shared<std::string>()),
|
||||
m_write_visible_flag(write_visible_flag && !write_change_ops),
|
||||
m_write_change_ops(write_change_ops) {
|
||||
}
|
||||
|
||||
XMLOutputBlock(const XMLOutputBlock&) = delete;
|
||||
XMLOutputBlock& operator=(const XMLOutputBlock&) = delete;
|
||||
XMLOutputBlock(const XMLOutputBlock&) = default;
|
||||
XMLOutputBlock& operator=(const XMLOutputBlock&) = default;
|
||||
|
||||
XMLOutputBlock(XMLOutputBlock&&) = default;
|
||||
XMLOutputBlock& operator=(XMLOutputBlock&&) = default;
|
||||
|
||||
~XMLOutputBlock() = default;
|
||||
|
||||
std::string operator()() {
|
||||
osmium::apply(m_input_buffer.cbegin(), m_input_buffer.cend(), *this);
|
||||
osmium::apply(m_input_buffer->cbegin(), m_input_buffer->cend(), *this);
|
||||
|
||||
if (m_write_change_ops) {
|
||||
open_close_op_tag();
|
||||
}
|
||||
|
||||
std::string out;
|
||||
std::swap(out, m_out);
|
||||
std::swap(out, *m_out);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -254,29 +257,29 @@ namespace osmium {
|
||||
}
|
||||
|
||||
write_prefix();
|
||||
m_out += "<node";
|
||||
*m_out += "<node";
|
||||
|
||||
write_meta(node);
|
||||
|
||||
if (node.location()) {
|
||||
m_out += " lat=\"";
|
||||
osmium::util::double2string(std::back_inserter(m_out), node.location().lat_without_check(), 7);
|
||||
m_out += "\" lon=\"";
|
||||
osmium::util::double2string(std::back_inserter(m_out), node.location().lon_without_check(), 7);
|
||||
m_out += "\"";
|
||||
*m_out += " lat=\"";
|
||||
osmium::util::double2string(std::back_inserter(*m_out), node.location().lat_without_check(), 7);
|
||||
*m_out += "\" lon=\"";
|
||||
osmium::util::double2string(std::back_inserter(*m_out), node.location().lon_without_check(), 7);
|
||||
*m_out += "\"";
|
||||
}
|
||||
|
||||
if (node.tags().empty()) {
|
||||
m_out += "/>\n";
|
||||
*m_out += "/>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
m_out += ">\n";
|
||||
*m_out += ">\n";
|
||||
|
||||
write_tags(node.tags());
|
||||
|
||||
write_prefix();
|
||||
m_out += "</node>\n";
|
||||
*m_out += "</node>\n";
|
||||
}
|
||||
|
||||
void way(const osmium::Way& way) {
|
||||
@@ -285,25 +288,25 @@ namespace osmium {
|
||||
}
|
||||
|
||||
write_prefix();
|
||||
m_out += "<way";
|
||||
*m_out += "<way";
|
||||
write_meta(way);
|
||||
|
||||
if (way.tags().empty() && way.nodes().empty()) {
|
||||
m_out += "/>\n";
|
||||
*m_out += "/>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
m_out += ">\n";
|
||||
*m_out += ">\n";
|
||||
|
||||
for (const auto& node_ref : way.nodes()) {
|
||||
write_prefix();
|
||||
oprintf(m_out, " <nd ref=\"%" PRId64 "\"/>\n", node_ref.ref());
|
||||
oprintf(*m_out, " <nd ref=\"%" PRId64 "\"/>\n", node_ref.ref());
|
||||
}
|
||||
|
||||
write_tags(way.tags());
|
||||
|
||||
write_prefix();
|
||||
m_out += "</way>\n";
|
||||
*m_out += "</way>\n";
|
||||
}
|
||||
|
||||
void relation(const osmium::Relation& relation) {
|
||||
@@ -312,77 +315,77 @@ namespace osmium {
|
||||
}
|
||||
|
||||
write_prefix();
|
||||
m_out += "<relation";
|
||||
*m_out += "<relation";
|
||||
write_meta(relation);
|
||||
|
||||
if (relation.tags().empty() && relation.members().empty()) {
|
||||
m_out += "/>\n";
|
||||
*m_out += "/>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
m_out += ">\n";
|
||||
*m_out += ">\n";
|
||||
|
||||
for (const auto& member : relation.members()) {
|
||||
write_prefix();
|
||||
m_out += " <member type=\"";
|
||||
m_out += item_type_to_name(member.type());
|
||||
oprintf(m_out, "\" ref=\"%" PRId64 "\" role=\"", member.ref());
|
||||
xml_string(m_out, member.role());
|
||||
m_out += "\"/>\n";
|
||||
*m_out += " <member type=\"";
|
||||
*m_out += item_type_to_name(member.type());
|
||||
oprintf(*m_out, "\" ref=\"%" PRId64 "\" role=\"", member.ref());
|
||||
xml_string(*m_out, member.role());
|
||||
*m_out += "\"/>\n";
|
||||
}
|
||||
|
||||
write_tags(relation.tags());
|
||||
|
||||
write_prefix();
|
||||
m_out += "</relation>\n";
|
||||
*m_out += "</relation>\n";
|
||||
}
|
||||
|
||||
void changeset(const osmium::Changeset& changeset) {
|
||||
write_prefix();
|
||||
m_out += "<changeset";
|
||||
*m_out += "<changeset";
|
||||
|
||||
oprintf(m_out, " id=\"%" PRId32 "\"", changeset.id());
|
||||
oprintf(*m_out, " id=\"%" PRId32 "\"", changeset.id());
|
||||
|
||||
if (changeset.created_at()) {
|
||||
m_out += " created_at=\"";
|
||||
m_out += changeset.created_at().to_iso();
|
||||
m_out += "\"";
|
||||
*m_out += " created_at=\"";
|
||||
*m_out += changeset.created_at().to_iso();
|
||||
*m_out += "\"";
|
||||
}
|
||||
|
||||
oprintf(m_out, " num_changes=\"%" PRId32 "\"", changeset.num_changes());
|
||||
oprintf(*m_out, " num_changes=\"%" PRId32 "\"", changeset.num_changes());
|
||||
|
||||
if (changeset.closed_at()) {
|
||||
m_out += " closed_at=\"";
|
||||
m_out += changeset.closed_at().to_iso();
|
||||
m_out += "\" open=\"false\"";
|
||||
*m_out += " closed_at=\"";
|
||||
*m_out += changeset.closed_at().to_iso();
|
||||
*m_out += "\" open=\"false\"";
|
||||
} else {
|
||||
m_out += " open=\"true\"";
|
||||
*m_out += " open=\"true\"";
|
||||
}
|
||||
|
||||
if (changeset.bounds()) {
|
||||
oprintf(m_out, " min_lon=\"%.7f\"", changeset.bounds().bottom_left().lon_without_check());
|
||||
oprintf(m_out, " min_lat=\"%.7f\"", changeset.bounds().bottom_left().lat_without_check());
|
||||
oprintf(m_out, " max_lon=\"%.7f\"", changeset.bounds().top_right().lon_without_check());
|
||||
oprintf(m_out, " max_lat=\"%.7f\"", changeset.bounds().top_right().lat_without_check());
|
||||
oprintf(*m_out, " min_lon=\"%.7f\"", changeset.bounds().bottom_left().lon_without_check());
|
||||
oprintf(*m_out, " min_lat=\"%.7f\"", changeset.bounds().bottom_left().lat_without_check());
|
||||
oprintf(*m_out, " max_lon=\"%.7f\"", changeset.bounds().top_right().lon_without_check());
|
||||
oprintf(*m_out, " max_lat=\"%.7f\"", changeset.bounds().top_right().lat_without_check());
|
||||
}
|
||||
|
||||
if (!changeset.user_is_anonymous()) {
|
||||
m_out += " user=\"";
|
||||
xml_string(m_out, changeset.user());
|
||||
oprintf(m_out, "\" uid=\"%d\"", changeset.uid());
|
||||
*m_out += " user=\"";
|
||||
xml_string(*m_out, changeset.user());
|
||||
oprintf(*m_out, "\" uid=\"%d\"", changeset.uid());
|
||||
}
|
||||
|
||||
if (changeset.tags().empty()) {
|
||||
m_out += "/>\n";
|
||||
*m_out += "/>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
m_out += ">\n";
|
||||
*m_out += ">\n";
|
||||
|
||||
write_tags(changeset.tags());
|
||||
|
||||
write_prefix();
|
||||
m_out += "</changeset>\n";
|
||||
*m_out += "</changeset>\n";
|
||||
}
|
||||
|
||||
}; // class XMLOutputBlock
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+2
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -34,6 +34,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
|
||||
+2
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -42,6 +42,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
#include <osmium/io/file_format.hpp>
|
||||
#include <osmium/io/file_compression.hpp>
|
||||
#include <osmium/util/options.hpp>
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,15 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Include this file if you want to read or write gzip-compressed OSM XML
|
||||
* files.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with `libz`.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -41,6 +41,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include <osmium/memory/buffer.hpp>
|
||||
#include <osmium/memory/item.hpp>
|
||||
#include <osmium/util/compatibility.hpp>
|
||||
|
||||
namespace osmium {
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -75,6 +75,14 @@ namespace osmium {
|
||||
m_buffer_wrapper(std::make_shared<buffer_wrapper>(buffer_size)) {
|
||||
}
|
||||
|
||||
OutputIterator(const OutputIterator&) = default;
|
||||
OutputIterator(OutputIterator&&) = default;
|
||||
|
||||
OutputIterator& operator=(const OutputIterator&) = default;
|
||||
OutputIterator& operator=(OutputIterator&&) = default;
|
||||
|
||||
~OutputIterator() = default;
|
||||
|
||||
void flush() {
|
||||
osmium::memory::Buffer buffer(m_buffer_wrapper->buffer.capacity(), osmium::memory::Buffer::auto_grow::no);
|
||||
std::swap(m_buffer_wrapper->buffer, buffer);
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+11
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,16 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Include this file if you want to read OSM PBF files.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with
|
||||
* `libprotobuf-lite`, `libosmpbf`, `ws2_32` (Windows only),
|
||||
* `libz`, and enable multithreading.
|
||||
*/
|
||||
|
||||
#include <osmium/io/reader.hpp> // IWYU pragma: export
|
||||
#include <osmium/io/detail/pbf_input_format.hpp> // IWYU pragma: export
|
||||
|
||||
|
||||
+11
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,16 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Include this file if you want to write OSM PBF files.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with
|
||||
* `libprotobuf-lite`, `libosmpbf`, `ws2_32` (Windows only),
|
||||
* `libz`, and enable multithreading.
|
||||
*/
|
||||
|
||||
#include <osmium/io/writer.hpp> // IWYU pragma: export
|
||||
#include <osmium/io/detail/pbf_output_format.hpp> // IWYU pragma: export
|
||||
|
||||
|
||||
+14
-5
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -258,11 +258,20 @@ namespace osmium {
|
||||
return osmium::memory::Buffer();
|
||||
}
|
||||
|
||||
osmium::memory::Buffer buffer = m_input->read();
|
||||
if (!buffer) {
|
||||
m_input_done = true;
|
||||
// m_input->read() can return an invalid buffer to signal EOF,
|
||||
// or a valid buffer with or without data. A valid buffer
|
||||
// without data is not an error, it just means we have to get
|
||||
// keep getting the next buffer until there is one with data.
|
||||
while (true) {
|
||||
osmium::memory::Buffer buffer = m_input->read();
|
||||
if (!buffer) {
|
||||
m_input_done = true;
|
||||
return buffer;
|
||||
}
|
||||
if (buffer.committed() > 0) {
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace osmium {
|
||||
* defaults will be used. See the default constructor
|
||||
* of osmium::io::Header for details.
|
||||
* @param allow_overwrite Allow overwriting of existing file? Can be
|
||||
* osmium::io::overwrite::allow or osmium::io::overwrite::no+
|
||||
* osmium::io::overwrite::allow or osmium::io::overwrite::no
|
||||
* (default).
|
||||
*
|
||||
* @throws std::runtime_error If the file could not be opened.
|
||||
|
||||
+10
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,15 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Include this file if you want to read OSM XML files.
|
||||
*
|
||||
* @attention If you include this file, you'll need to link with
|
||||
* `libexpat`, and enable multithreading.
|
||||
*/
|
||||
|
||||
#include <osmium/io/reader.hpp> // IWYU pragma: export
|
||||
#include <osmium/io/detail/xml_input_format.hpp> // IWYU pragma: export
|
||||
|
||||
|
||||
+9
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
This file is part of Osmium (http://osmcode.org/libosmium).
|
||||
|
||||
Copyright 2013,2014 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
@@ -33,6 +33,14 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Include this file if you want to write OSM XML files.
|
||||
*
|
||||
* @attention If you include this file, you'll need to enable multithreading.
|
||||
*/
|
||||
|
||||
#include <osmium/io/writer.hpp> // IWYU pragma: export
|
||||
#include <osmium/io/detail/xml_output_format.hpp> // IWYU pragma: export
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user