+ remove boost::iostreams dependency
This commit is contained in:
parent
0e0b7a578c
commit
e81761d270
5 changed files with 17 additions and 37 deletions
|
@ -1035,7 +1035,7 @@ if not preconfigured:
|
||||||
['system', 'boost/system/system_error.hpp', env['HAS_BOOST_SYSTEM']],
|
['system', 'boost/system/system_error.hpp', env['HAS_BOOST_SYSTEM']],
|
||||||
['filesystem', 'boost/filesystem/operations.hpp', True],
|
['filesystem', 'boost/filesystem/operations.hpp', True],
|
||||||
['regex', 'boost/regex.hpp', True],
|
['regex', 'boost/regex.hpp', True],
|
||||||
['iostreams','boost/iostreams/device/mapped_file.hpp',True],
|
#['iostreams','boost/iostreams/device/mapped_file.hpp',True],
|
||||||
['program_options', 'boost/program_options.hpp', False]
|
['program_options', 'boost/program_options.hpp', False]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1263,7 +1263,7 @@ if not preconfigured:
|
||||||
env.Append(CXXFLAGS = common_cxx_flags + '-O %s' % ndebug_flags)
|
env.Append(CXXFLAGS = common_cxx_flags + '-O %s' % ndebug_flags)
|
||||||
else:
|
else:
|
||||||
# Common flags for GCC.
|
# Common flags for GCC.
|
||||||
gcc_cxx_flags = '-ansi -Wall %s -ftemplate-depth-200 %s' % (pthread, common_cxx_flags)
|
gcc_cxx_flags = '-ansi -Wall -Wno-parentheses -Wno-unused-function -Wno-char-subscripts %s -ftemplate-depth-200 %s' % (pthread, common_cxx_flags)
|
||||||
|
|
||||||
if env['DEBUG']:
|
if env['DEBUG']:
|
||||||
env.Append(CXXFLAGS = gcc_cxx_flags + '-O0 -fno-inline %s' % debug_flags)
|
env.Append(CXXFLAGS = gcc_cxx_flags + '-O0 -fno-inline %s' % debug_flags)
|
||||||
|
|
|
@ -37,7 +37,7 @@ shape_src = Split(
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
libraries = ['boost_iostreams%s' % env['BOOST_APPEND']]
|
libraries = [] #['boost_iostreams%s' % env['BOOST_APPEND']]
|
||||||
|
|
||||||
if env['PLATFORM'] == 'Darwin':
|
if env['PLATFORM'] == 'Darwin':
|
||||||
libraries.append('mapnik2')
|
libraries.append('mapnik2')
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
// boost
|
// boost
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/spirit/include/qi.hpp>
|
#include <boost/spirit/include/qi.hpp>
|
||||||
//#include <boost/interprocess/file_mapping.hpp>
|
|
||||||
//#include <boost/interprocess/mapped_region.hpp>
|
|
||||||
#include <mapnik/mapped_memory_cache.hpp>
|
#include <mapnik/mapped_memory_cache.hpp>
|
||||||
// stl
|
// stl
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -47,7 +45,7 @@ dbf_file::dbf_file(std::string const& file_name)
|
||||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||||
file_(),
|
file_(),
|
||||||
#else
|
#else
|
||||||
file_(file_name,std::ios::in | std::ios::binary),
|
file_(file_name.c_str() ,std::ios::in | std::ios::binary),
|
||||||
#endif
|
#endif
|
||||||
record_(0)
|
record_(0)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +95,7 @@ void dbf_file::move_to(int index)
|
||||||
{
|
{
|
||||||
if (index>0 && index<=num_records_)
|
if (index>0 && index<=num_records_)
|
||||||
{
|
{
|
||||||
stream_offset pos=(num_fields_<<5)+34+(index-1)*(record_length_+1);
|
std::streampos pos=(num_fields_<<5)+34+(index-1)*(record_length_+1);
|
||||||
file_.seekg(pos,std::ios::beg);
|
file_.seekg(pos,std::ios::beg);
|
||||||
file_.read(record_,record_length_);
|
file_.read(record_,record_length_);
|
||||||
}
|
}
|
||||||
|
@ -136,7 +134,7 @@ void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, Feature cons
|
||||||
case 'M':
|
case 'M':
|
||||||
case 'L':
|
case 'L':
|
||||||
{
|
{
|
||||||
// FIXME - avoid constructing std::string in stack
|
// FIXME - avoid constructing std::string on stack
|
||||||
std::string str(record_+fields_[col].offset_,fields_[col].length_);
|
std::string str(record_+fields_[col].offset_,fields_[col].length_);
|
||||||
boost::trim(str);
|
boost::trim(str);
|
||||||
f[name] = tr.transcode(str.c_str());
|
f[name] = tr.transcode(str.c_str());
|
||||||
|
@ -185,7 +183,7 @@ void dbf_file::read_header()
|
||||||
assert(num_fields_>0);
|
assert(num_fields_>0);
|
||||||
num_fields_=(num_fields_-33)/32;
|
num_fields_=(num_fields_-33)/32;
|
||||||
skip(22);
|
skip(22);
|
||||||
stream_offset offset=0;
|
std::streampos offset=0;
|
||||||
char name[11];
|
char name[11];
|
||||||
memset(&name,0,11);
|
memset(&name,0,11);
|
||||||
fields_.reserve(num_fields_);
|
fields_.reserve(num_fields_);
|
||||||
|
|
|
@ -26,21 +26,16 @@
|
||||||
#include <mapnik/feature.hpp>
|
#include <mapnik/feature.hpp>
|
||||||
// boost
|
// boost
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
#include <boost/iostreams/stream.hpp>
|
|
||||||
#include <boost/iostreams/device/file.hpp>
|
|
||||||
//
|
|
||||||
#include <boost/interprocess/streams/bufferstream.hpp>
|
#include <boost/interprocess/streams/bufferstream.hpp>
|
||||||
//#include <boost/iostreams/device/mapped_file.hpp>
|
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
using mapnik::transcoder;
|
using mapnik::transcoder;
|
||||||
using mapnik::Feature;
|
using mapnik::Feature;
|
||||||
using namespace boost::iostreams;
|
|
||||||
|
|
||||||
struct field_descriptor
|
struct field_descriptor
|
||||||
{
|
{
|
||||||
|
@ -49,7 +44,7 @@ struct field_descriptor
|
||||||
char type_;
|
char type_;
|
||||||
int length_;
|
int length_;
|
||||||
int dec_;
|
int dec_;
|
||||||
stream_offset offset_;
|
std::streampos offset_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,13 +53,12 @@ class dbf_file : private boost::noncopyable
|
||||||
private:
|
private:
|
||||||
int num_records_;
|
int num_records_;
|
||||||
int num_fields_;
|
int num_fields_;
|
||||||
stream_offset record_length_;
|
std::size_t record_length_;
|
||||||
std::vector<field_descriptor> fields_;
|
std::vector<field_descriptor> fields_;
|
||||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||||
//stream<mapped_file_source> file_;
|
|
||||||
boost::interprocess::ibufferstream file_;
|
boost::interprocess::ibufferstream file_;
|
||||||
#else
|
#else
|
||||||
stream<file_source> file_;
|
std::ifstream file_;
|
||||||
#endif
|
#endif
|
||||||
char* record_;
|
char* record_;
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -31,17 +31,10 @@
|
||||||
// boost
|
// boost
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
#include <boost/cstdint.hpp>
|
#include <boost/cstdint.hpp>
|
||||||
|
|
||||||
#include <boost/interprocess/streams/bufferstream.hpp>
|
#include <boost/interprocess/streams/bufferstream.hpp>
|
||||||
|
// stl
|
||||||
//#include <boost/interprocess/file_mapping.hpp>
|
|
||||||
//#include <boost/interprocess/mapped_region.hpp>
|
|
||||||
|
|
||||||
#include <boost/iostreams/stream.hpp>
|
|
||||||
#include <boost/iostreams/device/file.hpp>
|
|
||||||
//#include <boost/iostreams/device/mapped_file.hpp>
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
using mapnik::box2d;
|
using mapnik::box2d;
|
||||||
using mapnik::read_int32_ndr;
|
using mapnik::read_int32_ndr;
|
||||||
|
@ -133,7 +126,6 @@ struct shape_record
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace boost::iostreams;
|
|
||||||
using namespace boost::interprocess;
|
using namespace boost::interprocess;
|
||||||
|
|
||||||
class shape_file : boost::noncopyable
|
class shape_file : boost::noncopyable
|
||||||
|
@ -141,13 +133,10 @@ class shape_file : boost::noncopyable
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||||
//typedef stream<mapped_file_source> file_source_type;
|
|
||||||
typedef ibufferstream file_source_type;
|
typedef ibufferstream file_source_type;
|
||||||
typedef shape_record<MappedRecordTag> record_type;
|
typedef shape_record<MappedRecordTag> record_type;
|
||||||
//typedef boost::shared_ptr<mapped_region> mapped_region_ptr;
|
|
||||||
//mapped_region_ptr region_;
|
|
||||||
#else
|
#else
|
||||||
typedef stream<file_source> file_source_type;
|
typedef std::ifstream file_source_type;
|
||||||
typedef shape_record<RecordTag> record_type;
|
typedef shape_record<RecordTag> record_type;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -159,12 +148,11 @@ public:
|
||||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||||
file_()
|
file_()
|
||||||
#else
|
#else
|
||||||
file_(file_name,std::ios::in | std::ios::binary)
|
file_(file_name.c_str(), std::ios::in | std::ios::binary)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
#ifdef SHAPE_MEMORY_MAPPED_FILE
|
||||||
//file_mapping mapping(file_name.c_str(),read_only);
|
|
||||||
//region_ = mapped_region_ptr(new mapped_region(mapping, read_only));
|
|
||||||
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::find(file_name.c_str(),true);
|
boost::optional<mapnik::mapped_region_ptr> memory = mapnik::mapped_memory_cache::find(file_name.c_str(),true);
|
||||||
if (memory)
|
if (memory)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue