rename SHAPE_MEMORY_MAPPED_FILE to MAPNIK_MEMORY_MAPPED_FILE
This commit is contained in:
parent
4976a7c72a
commit
8813e73cfc
17 changed files with 50 additions and 45 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -6,6 +6,17 @@ Developers: Please commit along with changes.
|
|||
|
||||
For a complete change history, see the git log.
|
||||
|
||||
## 3.0.8
|
||||
|
||||
Released: ...
|
||||
|
||||
(Packaged from )
|
||||
|
||||
#### Summary
|
||||
|
||||
- Renamed `SHAPE_MEMORY_MAPPED_FILE` define to `MAPNIK_MEMORY_MAPPED_FILE`. Pass `./configure MEMORY_MAPPED_FILE=True|False` to request
|
||||
support for memory mapped files across Mapnik plugins.
|
||||
|
||||
## 3.0.7
|
||||
|
||||
Released: October 12, 2015
|
||||
|
|
|
@ -389,7 +389,7 @@ opts.AddVariables(
|
|||
EnumVariable('PLUGIN_LINKING', "Set plugin linking with libmapnik", 'shared', ['shared','static']),
|
||||
|
||||
# Other variables
|
||||
BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'),
|
||||
BoolVariable('MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'),
|
||||
('SYSTEM_FONTS','Provide location for python bindings to register fonts (if provided then the bundled DejaVu fonts are not installed)',''),
|
||||
('LIB_DIR_NAME','Name to use for the subfolder beside libmapnik where fonts and plugins are installed','mapnik'),
|
||||
PathVariable('PYTHON','Full path to Python executable used to build bindings', sys.executable),
|
||||
|
@ -1209,8 +1209,8 @@ if not preconfigured:
|
|||
thread_suffix = ''
|
||||
env.Append(LIBS = 'pthread')
|
||||
|
||||
if env['SHAPE_MEMORY_MAPPED_FILE']:
|
||||
env.Append(CPPDEFINES = '-DSHAPE_MEMORY_MAPPED_FILE')
|
||||
if env['MEMORY_MAPPED_FILE']:
|
||||
env.Append(CPPDEFINES = '-DMAPNIK_MEMORY_MAPPED_FILE')
|
||||
|
||||
# allow for mac osx /usr/lib/libicucore.dylib compatibility
|
||||
# requires custom supplied headers since Apple does not include them
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/util/spatial_index.hpp>
|
||||
#include <mapnik/geom_util.hpp>
|
||||
#ifdef CSV_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
@ -125,7 +125,7 @@ csv_datasource::csv_datasource(parameters const& params)
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined (CSV_MEMORY_MAPPED_FILE)
|
||||
#if defined (MAPNIK_MEMORY_MAPPED_FILE)
|
||||
using file_source_type = boost::interprocess::ibufferstream;
|
||||
file_source_type in;
|
||||
mapnik::mapped_region_ptr mapped_region;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
csv_featureset::csv_featureset(std::string const& filename, detail::geometry_column_locator const& locator, char separator, char quote,
|
||||
std::vector<std::string> const& headers, mapnik::context_ptr const& ctx, array_type && index_array)
|
||||
:
|
||||
#if defined(CSV_MEMORY_MAPPED_FILE)
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
//
|
||||
#elif defined( _WINDOWS)
|
||||
file_(_wfopen(mapnik::utf8_to_utf16(filename).c_str(), L"rb"), std::fclose),
|
||||
|
@ -51,7 +51,7 @@ csv_featureset::csv_featureset(std::string const& filename, detail::geometry_col
|
|||
locator_(locator),
|
||||
tr_("utf8")
|
||||
{
|
||||
#if defined (CSV_MEMORY_MAPPED_FILE)
|
||||
#if defined (MAPNIK_MEMORY_MAPPED_FILE)
|
||||
boost::optional<mapnik::mapped_region_ptr> memory =
|
||||
mapnik::mapped_memory_cache::instance().find(filename, true);
|
||||
if (memory)
|
||||
|
@ -90,7 +90,7 @@ mapnik::feature_ptr csv_featureset::next()
|
|||
csv_datasource::item_type const& item = *index_itr_++;
|
||||
std::size_t file_offset = item.second.first;
|
||||
std::size_t size = item.second.second;
|
||||
#if defined(CSV_MEMORY_MAPPED_FILE)
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
char const* start = (char const*)mapped_region_->get_address() + file_offset;
|
||||
char const* end = start + size;
|
||||
#else
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <deque>
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef CSV_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
mapnik::feature_ptr next();
|
||||
private:
|
||||
mapnik::feature_ptr parse_feature(char const* beg, char const* end);
|
||||
#if defined (CSV_MEMORY_MAPPED_FILE)
|
||||
#if defined (MAPNIK_MEMORY_MAPPED_FILE)
|
||||
using file_source_type = boost::interprocess::ibufferstream;
|
||||
mapnik::mapped_region_ptr mapped_region_;
|
||||
#else
|
||||
|
|
|
@ -48,7 +48,7 @@ csv_index_featureset::csv_index_featureset(std::string const& filename,
|
|||
ctx_(ctx),
|
||||
locator_(locator),
|
||||
tr_("utf8")
|
||||
#if defined(CSV_MEMORY_MAPPED_FILE)
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
//
|
||||
#elif defined( _WINDOWS)
|
||||
,file_(_wfopen(mapnik::utf8_to_utf16(filename).c_str(), L"rb"), std::fclose)
|
||||
|
@ -57,7 +57,7 @@ csv_index_featureset::csv_index_featureset(std::string const& filename,
|
|||
#endif
|
||||
|
||||
{
|
||||
#if defined (CSV_MEMORY_MAPPED_FILE)
|
||||
#if defined (MAPNIK_MEMORY_MAPPED_FILE)
|
||||
boost::optional<mapnik::mapped_region_ptr> memory =
|
||||
mapnik::mapped_memory_cache::instance().find(filename, true);
|
||||
if (memory)
|
||||
|
@ -112,7 +112,7 @@ mapnik::feature_ptr csv_index_featureset::next()
|
|||
while( itr_ != positions_.end())
|
||||
{
|
||||
auto pos = *itr_++;
|
||||
#if defined(CSV_MEMORY_MAPPED_FILE)
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
char const* start = (char const*)mapped_region_->get_address() + pos.first;
|
||||
char const* end = start + pos.second;
|
||||
#else
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "csv_utils.hpp"
|
||||
#include "csv_datasource.hpp"
|
||||
|
||||
#ifdef CSV_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
@ -63,7 +63,7 @@ private:
|
|||
mapnik::value_integer feature_id_ = 0;
|
||||
detail::geometry_column_locator const& locator_;
|
||||
mapnik::transcoder tr_;
|
||||
#if defined (CSV_MEMORY_MAPPED_FILE)
|
||||
#if defined (MAPNIK_MEMORY_MAPPED_FILE)
|
||||
using file_source_type = boost::interprocess::ibufferstream;
|
||||
mapnik::mapped_region_ptr mapped_region_;
|
||||
#else
|
||||
|
|
|
@ -44,10 +44,6 @@
|
|||
#include <cstdio>
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef _WINDOWS
|
||||
#define CSV_MEMORY_MAPPED_FILE
|
||||
#endif
|
||||
|
||||
namespace csv_utils
|
||||
{
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
#include <mapnik/util/spatial_index.hpp>
|
||||
#include <mapnik/geom_util.hpp>
|
||||
|
||||
#if defined(SHAPE_MEMORY_MAPPED_FILE)
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
@ -156,7 +156,7 @@ geojson_datasource::geojson_datasource(parameters const& params)
|
|||
else
|
||||
{
|
||||
cache_features_ = *params.get<mapnik::boolean_type>("cache_features", true);
|
||||
#if !defined(SHAPE_MEMORY_MAPPED_FILE)
|
||||
#if !defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
mapnik::util::file file(filename_);
|
||||
if (!file.open())
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
geojson_index_featureset::geojson_index_featureset(std::string const& filename, mapnik::filter_in_box const& filter)
|
||||
:
|
||||
#if defined(GEOJSON_MEMORY_MAPPED_FILE)
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
//
|
||||
#elif defined _WINDOWS
|
||||
file_(_wfopen(mapnik::utf8_to_utf16(filename).c_str(), L"rb"), std::fclose),
|
||||
|
@ -45,7 +45,7 @@ geojson_index_featureset::geojson_index_featureset(std::string const& filename,
|
|||
ctx_(std::make_shared<mapnik::context_type>())
|
||||
{
|
||||
|
||||
#if defined (GEOJSON_MEMORY_MAPPED_FILE)
|
||||
#if defined (MAPNIK_MEMORY_MAPPED_FILE)
|
||||
boost::optional<mapnik::mapped_region_ptr> memory =
|
||||
mapnik::mapped_memory_cache::instance().find(filename, true);
|
||||
if (memory)
|
||||
|
@ -78,7 +78,7 @@ mapnik::feature_ptr geojson_index_featureset::next()
|
|||
while( itr_ != positions_.end())
|
||||
{
|
||||
auto pos = *itr_++;
|
||||
#if defined(GEOJSON_MEMORY_MAPPED_FILE)
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
char const* start = (char const*)mapped_region_->get_address() + pos.first;
|
||||
char const* end = start + pos.second;
|
||||
#else
|
||||
|
|
|
@ -23,13 +23,11 @@
|
|||
#ifndef GEOJSON_INDEX_FEATURESET_HPP
|
||||
#define GEOJSON_INDEX_FEATURESET_HPP
|
||||
|
||||
#define GEOJSON_MEMORY_MAPPED_FILE
|
||||
|
||||
#include "geojson_datasource.hpp"
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/geom_util.hpp>
|
||||
|
||||
#ifdef GEOJSON_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
@ -51,7 +49,7 @@ public:
|
|||
mapnik::feature_ptr next();
|
||||
|
||||
private:
|
||||
#if defined (GEOJSON_MEMORY_MAPPED_FILE)
|
||||
#if defined (MAPNIK_MEMORY_MAPPED_FILE)
|
||||
using file_source_type = boost::interprocess::ibufferstream;
|
||||
mapnik::mapped_region_ptr mapped_region_;
|
||||
#else
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <mapnik/geometry_correct.hpp>
|
||||
|
||||
// boost
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#include <mapnik/mapped_memory_cache.hpp>
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
|
@ -72,7 +72,7 @@ ogr_index_featureset<filterT>::ogr_index_featureset(mapnik::context_ptr const &
|
|||
feature_envelope_()
|
||||
{
|
||||
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::instance().find(index_file, true);
|
||||
if (memory)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <mapnik/mapped_memory_cache.hpp>
|
||||
#endif
|
||||
|
@ -58,7 +58,7 @@ dbf_file::dbf_file(std::string const& file_name)
|
|||
:num_records_(0),
|
||||
num_fields_(0),
|
||||
record_length_(0),
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
file_(),
|
||||
#elif defined(_WINDOWS)
|
||||
file_(mapnik::utf8_to_utf16(file_name), std::ios::in | std::ios::binary),
|
||||
|
@ -68,7 +68,7 @@ dbf_file::dbf_file(std::string const& file_name)
|
|||
record_(0)
|
||||
{
|
||||
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::instance().find(file_name,true);
|
||||
if (memory)
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ dbf_file::~dbf_file()
|
|||
|
||||
bool dbf_file::is_open()
|
||||
{
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
return (file_.buffer().second > 0);
|
||||
#else
|
||||
return file_.is_open();
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/util/noncopyable.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#include <mapnik/mapped_memory_cache.hpp>
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
|
@ -59,7 +59,7 @@ private:
|
|||
int num_fields_;
|
||||
std::size_t record_length_;
|
||||
std::vector<field_descriptor> fields_;
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
boost::interprocess::ibufferstream file_;
|
||||
mapnik::mapped_region_ptr mapped_region_;
|
||||
#else
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#pragma GCC diagnostic ignored "-Wunused-local-typedef"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#include <boost/interprocess/streams/bufferstream.hpp>
|
||||
#endif
|
||||
#pragma GCC diagnostic pop
|
||||
|
@ -63,7 +63,7 @@ shape_index_featureset<filterT>::shape_index_featureset(filterT const& filter,
|
|||
auto index = shape_ptr_->index();
|
||||
if (index)
|
||||
{
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
mapnik::util::spatial_index<int, filterT,boost::interprocess::ibufferstream>::query(filter, index->file(), offsets_);
|
||||
#else
|
||||
mapnik::util::spatial_index<int, filterT, std::ifstream>::query(filter, index->file(), offsets_);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/util/utf_conv_win.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
@ -141,7 +141,7 @@ class shape_file : mapnik::util::noncopyable
|
|||
{
|
||||
public:
|
||||
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
using file_source_type = boost::interprocess::ibufferstream;
|
||||
using record_type = shape_record<MappedRecordTag>;
|
||||
mapnik::mapped_region_ptr mapped_region_;
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
shape_file() {}
|
||||
|
||||
shape_file(std::string const& file_name) :
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
file_()
|
||||
#elif defined (_WINDOWS)
|
||||
file_(mapnik::utf8_to_utf16(file_name), std::ios::in | std::ios::binary)
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
file_(file_name.c_str(), std::ios::in | std::ios::binary)
|
||||
#endif
|
||||
{
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
boost::optional<mapnik::mapped_region_ptr> memory =
|
||||
mapnik::mapped_memory_cache::instance().find(file_name,true);
|
||||
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
|
||||
inline bool is_open() const
|
||||
{
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
return (file_.buffer().second > 0);
|
||||
#else
|
||||
return file_.is_open();
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
|
||||
inline void read_record(record_type& rec)
|
||||
{
|
||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
rec.set_data(file_.buffer().first + file_.tellg());
|
||||
file_.seekg(rec.size, std::ios::cur);
|
||||
#else
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(SHAPE_MEMORY_MAPPED_FILE)
|
||||
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
|
|
Loading…
Reference in a new issue