From 11e6ba0c099ef4c1dc56be1eca9a58e1198fcc59 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 7 Sep 2012 14:41:07 +0100 Subject: [PATCH 1/2] + make client methods non-static in classes derived from mapnik::singleton<> (TODO: apply to all) + ensure client methods are accessed through instance() method --- bindings/python/mapnik_markers_symbolizer.cpp | 4 +-- include/mapnik/datasource_cache.hpp | 17 +++++---- include/mapnik/mapped_memory_cache.hpp | 11 +++--- include/mapnik/marker_cache.hpp | 16 ++++----- include/mapnik/utils.hpp | 1 + plugins/input/ogr/ogr_index_featureset.cpp | 2 +- plugins/input/shape/dbfile.cpp | 4 ++- plugins/input/shape/shapefile.hpp | 2 +- src/datasource_cache.cpp | 35 ++++++++----------- src/load_map.cpp | 16 ++++----- src/mapped_memory_cache.cpp | 2 -- src/marker_cache.cpp | 5 +-- 12 files changed, 53 insertions(+), 62 deletions(-) diff --git a/bindings/python/mapnik_markers_symbolizer.cpp b/bindings/python/mapnik_markers_symbolizer.cpp index 08519976f..eed763203 100644 --- a/bindings/python/mapnik_markers_symbolizer.cpp +++ b/bindings/python/mapnik_markers_symbolizer.cpp @@ -54,11 +54,11 @@ void set_marker_type(mapnik::markers_symbolizer & symbolizer, std::string const& std::string filename; if (marker_type == "ellipse") { - filename = mapnik::marker_cache::known_svg_prefix_ + "ellipse"; + filename = mapnik::marker_cache::instance()->known_svg_prefix_ + "ellipse"; } else if (marker_type == "arrow") { - filename = mapnik::marker_cache::known_svg_prefix_ + "arrow"; + filename = mapnik::marker_cache::instance()->known_svg_prefix_ + "arrow"; } else { diff --git a/include/mapnik/datasource_cache.hpp b/include/mapnik/datasource_cache.hpp index ebadb41f1..51cdfd415 100644 --- a/include/mapnik/datasource_cache.hpp +++ b/include/mapnik/datasource_cache.hpp @@ -36,28 +36,27 @@ // stl #include -namespace mapnik { namespace detail { -class MAPNIK_DECL datasource_cache_impl +namespace mapnik { + +class MAPNIK_DECL datasource_cache + : public singleton, + private boost::noncopyable { + friend class CreateStatic; public: - datasource_cache_impl(); - ~datasource_cache_impl(); std::vector plugin_names(); std::string plugin_directories(); void register_datasources(std::string const& path); bool register_datasource(std::string const& path); boost::shared_ptr create(parameters const& params, bool bind=true); private: + datasource_cache(); + ~datasource_cache(); std::map > plugins_; bool registered_; bool insert(std::string const& name,const lt_dlhandle module); std::vector plugin_directories_; - }; } -typedef singleton datasource_cache; - -} - #endif // MAPNIK_DATASOURCE_CACHE_HPP diff --git a/include/mapnik/mapped_memory_cache.hpp b/include/mapnik/mapped_memory_cache.hpp index b26ce81a6..a8144a7c0 100644 --- a/include/mapnik/mapped_memory_cache.hpp +++ b/include/mapnik/mapped_memory_cache.hpp @@ -42,17 +42,16 @@ using namespace boost::interprocess; typedef boost::shared_ptr mapped_region_ptr; struct MAPNIK_DECL mapped_memory_cache : - public singleton , + public singleton, private boost::noncopyable { friend class CreateStatic; - static boost::unordered_map cache_; - static bool insert(std::string const& key, mapped_region_ptr); - static boost::optional find(std::string const& key, bool update_cache = false); - static void clear(); + boost::unordered_map cache_; + bool insert(std::string const& key, mapped_region_ptr); + boost::optional find(std::string const& key, bool update_cache = false); + void clear(); }; } #endif // MAPNIK_MAPPED_MEMORY_CACHE_HPP - diff --git a/include/mapnik/marker_cache.hpp b/include/mapnik/marker_cache.hpp index b696a00b9..e97d09ca8 100644 --- a/include/mapnik/marker_cache.hpp +++ b/include/mapnik/marker_cache.hpp @@ -49,15 +49,15 @@ class MAPNIK_DECL marker_cache : private: marker_cache(); ~marker_cache(); - static bool insert_marker(std::string const& key, marker_ptr path); - static boost::unordered_map marker_cache_; - static bool insert_svg(std::string const& name, std::string const& svg_string); - static boost::unordered_map svg_cache_; + bool insert_marker(std::string const& key, marker_ptr path); + boost::unordered_map marker_cache_; + bool insert_svg(std::string const& name, std::string const& svg_string); + boost::unordered_map svg_cache_; public: - static std::string known_svg_prefix_; - static bool is_uri(std::string const& path); - static boost::optional find(std::string const& key, bool update_cache = false); - static void clear(); + std::string known_svg_prefix_; + bool is_uri(std::string const& path); + boost::optional find(std::string const& key, bool update_cache = false); + void clear(); }; } diff --git a/include/mapnik/utils.hpp b/include/mapnik/utils.hpp index 284a2c190..d5ec0dbe1 100644 --- a/include/mapnik/utils.hpp +++ b/include/mapnik/utils.hpp @@ -140,6 +140,7 @@ public: { if (destroyed_) { + destroyed_ = false; onDeadReference(); } else diff --git a/plugins/input/ogr/ogr_index_featureset.cpp b/plugins/input/ogr/ogr_index_featureset.cpp index 3f28395aa..a86e9e73c 100644 --- a/plugins/input/ogr/ogr_index_featureset.cpp +++ b/plugins/input/ogr/ogr_index_featureset.cpp @@ -64,7 +64,7 @@ ogr_index_featureset::ogr_index_featureset(mapnik::context_ptr const & fidcolumn_(layer_.GetFIDColumn()) { - boost::optional memory = mapnik::mapped_memory_cache::find(index_file.c_str(),true); + boost::optional memory = mapnik::mapped_memory_cache::instance()->find(index_file.c_str(),true); if (memory) { boost::interprocess::ibufferstream file(static_cast((*memory)->get_address()),(*memory)->get_size()); diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index 2161482f0..342b397d2 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -34,6 +34,8 @@ #include +using mapnik::mapped_memory_cache; + dbf_file::dbf_file() : num_records_(0), num_fields_(0), @@ -53,7 +55,7 @@ dbf_file::dbf_file(std::string const& file_name) { #ifdef SHAPE_MEMORY_MAPPED_FILE - boost::optional memory = mapnik::mapped_memory_cache::find(file_name.c_str(),true); + boost::optional memory = mapped_memory_cache::instance()->find(file_name.c_str(),true); if (memory) { file_.buffer(static_cast((*memory)->get_address()),(*memory)->get_size()); diff --git a/plugins/input/shape/shapefile.hpp b/plugins/input/shape/shapefile.hpp index f80d08360..2a2692dfe 100644 --- a/plugins/input/shape/shapefile.hpp +++ b/plugins/input/shape/shapefile.hpp @@ -155,7 +155,7 @@ public: { #ifdef SHAPE_MEMORY_MAPPED_FILE boost::optional memory = - mapnik::mapped_memory_cache::find(file_name.c_str(),true); + mapnik::mapped_memory_cache::instance()->find(file_name.c_str(),true); if (memory) { diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 7a8300aab..b0780986d 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -38,7 +38,7 @@ #include #include -namespace mapnik { namespace detail { +namespace mapnik { bool is_input_plugin (std::string const& filename) { @@ -46,21 +46,17 @@ bool is_input_plugin (std::string const& filename) } -datasource_cache_impl::datasource_cache_impl() +datasource_cache::datasource_cache() { if (lt_dlinit()) throw std::runtime_error("lt_dlinit() failed"); } -datasource_cache_impl::~datasource_cache_impl() +datasource_cache::~datasource_cache() { lt_dlexit(); } -//std::map > datasource_cache::plugins_; -//bool datasource_cache::registered_=false; -//std::vector datasource_cache::plugin_directories_; - -datasource_ptr datasource_cache_impl::create(const parameters& params, bool bind) +datasource_ptr datasource_cache::create(const parameters& params, bool bind) { boost::optional type = params.get("type"); if ( ! type) @@ -70,7 +66,7 @@ datasource_ptr datasource_cache_impl::create(const parameters& params, bool bind } #ifdef MAPNIK_THREADSAFE - //mutex::scoped_lock lock(mutex_); + mutex::scoped_lock lock(mutex_); #endif datasource_ptr ds; @@ -101,34 +97,34 @@ datasource_ptr datasource_cache_impl::create(const parameters& params, bool bind } #ifdef MAPNIK_LOG - MAPNIK_LOG_DEBUG(datasource_cache_impl) << "datasource_cache: Size=" << params.size(); + MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: Size=" << params.size(); parameters::const_iterator i = params.begin(); for (; i != params.end(); ++i) { - MAPNIK_LOG_DEBUG(datasource_cache_impl) << "datasource_cache: -- " << i->first << "=" << i->second; + MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: -- " << i->first << "=" << i->second; } #endif ds = datasource_ptr(create_datasource(params, bind), datasource_deleter()); - MAPNIK_LOG_DEBUG(datasource_cache_impl) << "datasource_cache: Datasource=" << ds << " type=" << type; + MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: Datasource=" << ds << " type=" << type; return ds; } -bool datasource_cache_impl::insert(std::string const& type,const lt_dlhandle module) +bool datasource_cache::insert(std::string const& type,const lt_dlhandle module) { return plugins_.insert(make_pair(type,boost::make_shared (type,module))).second; } -std::string datasource_cache_impl::plugin_directories() +std::string datasource_cache::plugin_directories() { return boost::algorithm::join(plugin_directories_,", "); } -std::vector datasource_cache_impl::plugin_names() +std::vector datasource_cache::plugin_names() { std::vector names; std::map >::const_iterator itr; @@ -139,11 +135,10 @@ std::vector datasource_cache_impl::plugin_names() return names; } -void datasource_cache_impl::register_datasources(std::string const& str) +void datasource_cache::register_datasources(std::string const& str) { #ifdef MAPNIK_THREADSAFE - //mutex::scoped_lock lock(mapnik::singleton::mutex_); + mutex::scoped_lock lock(mutex_); #endif boost::filesystem::path path(str); // TODO - only push unique paths @@ -174,7 +169,7 @@ void datasource_cache_impl::register_datasources(std::string const& str) } } -bool datasource_cache_impl::register_datasource(std::string const& str) +bool datasource_cache::register_datasource(std::string const& str) { bool success = false; try @@ -215,4 +210,4 @@ bool datasource_cache_impl::register_datasource(std::string const& str) return success; } -}} +} diff --git a/src/load_map.cpp b/src/load_map.cpp index f7efc5488..032e39d8b 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -955,11 +955,11 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& sym) { if (*marker_type == "ellipse") { - filename = marker_cache::known_svg_prefix_ + "ellipse"; + filename = marker_cache::instance()->known_svg_prefix_ + "ellipse"; } else if (*marker_type == "arrow") { - filename = marker_cache::known_svg_prefix_ + "arrow"; + filename = marker_cache::instance()->known_svg_prefix_ + "arrow"; } } } @@ -992,16 +992,16 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& sym) optional c = sym.get_opt_attr("fill"); if (c) symbol.set_fill(*c); - + optional spacing = sym.get_opt_attr("spacing"); if (spacing) symbol.set_spacing(*spacing); - + optional max_error = sym.get_opt_attr("max-error"); if (max_error) symbol.set_max_error(*max_error); - + optional allow_overlap = sym.get_opt_attr("allow-overlap"); if (allow_overlap) symbol.set_allow_overlap(*allow_overlap); - + optional ignore_placement = sym.get_opt_attr("ignore-placement"); if (ignore_placement) symbol.set_ignore_placement(*ignore_placement); @@ -1586,7 +1586,7 @@ void map_parser::ensure_font_face(std::string const& face_name) std::string map_parser::ensure_relative_to_xml(boost::optional opt_path) { - if (marker_cache::is_uri(*opt_path)) + if (marker_cache::instance()->is_uri(*opt_path)) return *opt_path; if (relative_to_xml_) @@ -1614,7 +1614,7 @@ std::string map_parser::ensure_relative_to_xml(boost::optional opt_ void map_parser::ensure_exists(std::string const& file_path) { - if (marker_cache::is_uri(file_path)) + if (marker_cache::instance()->is_uri(file_path)) return; // validate that the filename exists if it is not a dynamic PathExpression if (!boost::algorithm::find_first(file_path,"[") && !boost::algorithm::find_first(file_path,"]")) diff --git a/src/mapped_memory_cache.cpp b/src/mapped_memory_cache.cpp index de917b02c..a9f385e52 100644 --- a/src/mapped_memory_cache.cpp +++ b/src/mapped_memory_cache.cpp @@ -33,8 +33,6 @@ namespace mapnik { -boost::unordered_map mapped_memory_cache::cache_; - void mapped_memory_cache::clear() { #ifdef MAPNIK_THREADSAFE diff --git a/src/marker_cache.cpp b/src/marker_cache.cpp index 9dcaea7f4..11d085970 100644 --- a/src/marker_cache.cpp +++ b/src/marker_cache.cpp @@ -45,11 +45,8 @@ namespace mapnik { -boost::unordered_map marker_cache::marker_cache_; -boost::unordered_map marker_cache::svg_cache_; -std::string marker_cache::known_svg_prefix_ = "shape://"; - marker_cache::marker_cache() + : known_svg_prefix_("shape://") { insert_svg("ellipse", "" From 967d6110bfa92d4574eb338bf8d1f7c95cf2f538 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 7 Sep 2012 16:23:03 +0100 Subject: [PATCH 2/2] + singleton: return ref from instance() method --- bindings/python/mapnik_datasource.cpp | 2 +- bindings/python/mapnik_datasource_cache.cpp | 8 +++---- bindings/python/mapnik_layer.cpp | 2 +- bindings/python/mapnik_markers_symbolizer.cpp | 4 ++-- bindings/python/mapnik_python.cpp | 4 ++-- demo/c++/rundemo.cpp | 16 +++++++------- demo/viewer/main.cpp | 2 +- include/mapnik/utils.hpp | 5 ++--- plugins/input/ogr/ogr_index_featureset.cpp | 2 +- plugins/input/osm/demo/MapSource.cpp | 6 ++--- plugins/input/osm/demo/easymapnik.cpp | 2 +- plugins/input/osm/render.cpp | 4 ++-- plugins/input/postgis/postgis_datasource.cpp | 22 ++++++------------- plugins/input/shape/dbfile.cpp | 2 +- plugins/input/shape/shapefile.hpp | 2 +- src/agg/agg_renderer.cpp | 2 +- src/agg/process_line_pattern_symbolizer.cpp | 2 +- src/agg/process_markers_symbolizer.cpp | 2 +- src/agg/process_point_symbolizer.cpp | 2 +- .../process_polygon_pattern_symbolizer.cpp | 2 +- src/cairo_renderer.cpp | 8 +++---- src/deepcopy.cpp | 2 +- src/formatting/base.cpp | 2 +- src/grid/process_markers_symbolizer.cpp | 2 +- src/grid/process_point_symbolizer.cpp | 2 +- src/image_reader.cpp | 6 ++--- src/load_map.cpp | 14 ++++++------ src/symbolizer_helpers.cpp | 2 +- tests/cpp_tests/exceptions_test.cpp | 14 ++++++------ .../svg_renderer_tests/path_element_test.cpp | 12 +++++----- utils/geometry_to_wkb/main.cpp | 6 ++--- utils/svg2png/svg2png.cpp | 2 +- 32 files changed, 77 insertions(+), 88 deletions(-) diff --git a/bindings/python/mapnik_datasource.cpp b/bindings/python/mapnik_datasource.cpp index 09e70e1fe..f3a97e6c4 100644 --- a/bindings/python/mapnik_datasource.cpp +++ b/bindings/python/mapnik_datasource.cpp @@ -81,7 +81,7 @@ boost::shared_ptr create_datasource(const dict& d) } } - return mapnik::datasource_cache::instance()->create(params, bind); + return mapnik::datasource_cache::instance().create(params, bind); } boost::python::dict describe(boost::shared_ptr const& ds) diff --git a/bindings/python/mapnik_datasource_cache.cpp b/bindings/python/mapnik_datasource_cache.cpp index 5592418e1..50074f3af 100644 --- a/bindings/python/mapnik_datasource_cache.cpp +++ b/bindings/python/mapnik_datasource_cache.cpp @@ -61,22 +61,22 @@ boost::shared_ptr create_datasource(const dict& d) } } - return mapnik::datasource_cache::instance()->create(params, bind); + return mapnik::datasource_cache::instance().create(params, bind); } void register_datasources(std::string const& path) { - mapnik::datasource_cache::instance()->register_datasources(path); + mapnik::datasource_cache::instance().register_datasources(path); } std::vector plugin_names() { - return mapnik::datasource_cache::instance()->plugin_names(); + return mapnik::datasource_cache::instance().plugin_names(); } std::string plugin_directories() { - return mapnik::datasource_cache::instance()->plugin_directories(); + return mapnik::datasource_cache::instance().plugin_directories(); } } diff --git a/bindings/python/mapnik_layer.cpp b/bindings/python/mapnik_layer.cpp index 37cc17e91..04f442508 100644 --- a/bindings/python/mapnik_layer.cpp +++ b/bindings/python/mapnik_layer.cpp @@ -77,7 +77,7 @@ struct layer_pickle_suite : boost::python::pickle_suite l.set_queryable(extract(state[3])); mapnik::parameters params = extract(state[4]); - l.set_datasource(datasource_cache::instance()->create(params)); + l.set_datasource(datasource_cache::instance().create(params)); boost::python::list s = extract(state[5]); for (int i=0;iknown_svg_prefix_ + "ellipse"; + filename = mapnik::marker_cache::instance().known_svg_prefix_ + "ellipse"; } else if (marker_type == "arrow") { - filename = mapnik::marker_cache::instance()->known_svg_prefix_ + "arrow"; + filename = mapnik::marker_cache::instance().known_svg_prefix_ + "arrow"; } else { diff --git a/bindings/python/mapnik_python.cpp b/bindings/python/mapnik_python.cpp index 8c58a09f4..ebe2579b8 100644 --- a/bindings/python/mapnik_python.cpp +++ b/bindings/python/mapnik_python.cpp @@ -96,8 +96,8 @@ void export_logger(); void clear_cache() { - mapnik::marker_cache::instance()->clear(); - mapnik::mapped_memory_cache::instance()->clear(); + mapnik::marker_cache::instance().clear(); + mapnik::mapped_memory_cache::instance().clear(); } #if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO) diff --git a/demo/c++/rundemo.cpp b/demo/c++/rundemo.cpp index 1c918ea61..a209dc433 100644 --- a/demo/c++/rundemo.cpp +++ b/demo/c++/rundemo.cpp @@ -56,7 +56,7 @@ int main ( int argc , char** argv) std::cout << " running demo ... \n"; std::string mapnik_dir(argv[1]); std::cout << " looking for 'shape.input' plugin in... " << mapnik_dir << "/input/" << "\n"; - datasource_cache::instance()->register_datasources(mapnik_dir + "/input/"); + datasource_cache::instance().register_datasources(mapnik_dir + "/input/"); std::cout << " looking for DejaVuSans font in... " << mapnik_dir << "/fonts/DejaVuSans.ttf" << "\n"; freetype_engine::register_font(mapnik_dir + "/fonts/DejaVuSans.ttf"); @@ -182,7 +182,7 @@ int main ( int argc , char** argv) p["encoding"]="latin1"; layer lyr("Provinces"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("provinces"); m.addLayer(lyr); } @@ -193,7 +193,7 @@ int main ( int argc , char** argv) p["type"]="shape"; p["file"]="../data/qcdrainage"; layer lyr("Quebec Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("drainage"); m.addLayer(lyr); } @@ -204,7 +204,7 @@ int main ( int argc , char** argv) p["file"]="../data/ontdrainage"; layer lyr("Ontario Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("drainage"); m.addLayer(lyr); } @@ -215,7 +215,7 @@ int main ( int argc , char** argv) p["type"]="shape"; p["file"]="../data/boundaries_l"; layer lyr("Provincial borders"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("provlines"); m.addLayer(lyr); } @@ -226,7 +226,7 @@ int main ( int argc , char** argv) p["type"]="shape"; p["file"]="../data/roads"; layer lyr("Roads"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("smallroads"); lyr.add_style("road-border"); lyr.add_style("road-fill"); @@ -242,7 +242,7 @@ int main ( int argc , char** argv) p["file"]="../data/popplaces"; p["encoding"] = "latin1"; layer lyr("Populated Places"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("popplaces"); m.addLayer(lyr); } @@ -258,7 +258,7 @@ int main ( int argc , char** argv) save_to_file(buf,"demo.png","png"); save_to_file(buf,"demo256.png","png256"); save_to_file(buf,"demo.tif","tiff"); - + std::cout << "Three maps have been rendered using AGG in the current directory:\n" "- demo.jpg\n" "- demo.png\n" diff --git a/demo/viewer/main.cpp b/demo/viewer/main.cpp index 4b314a500..73af0c95c 100644 --- a/demo/viewer/main.cpp +++ b/demo/viewer/main.cpp @@ -45,7 +45,7 @@ int main( int argc, char **argv ) // register input plug-ins QString plugins_dir = settings.value("mapnik/plugins_dir", QVariant("/usr/local/lib/mapnik/input/")).toString(); - datasource_cache::instance()->register_datasources(plugins_dir.toStdString()); + datasource_cache::instance().register_datasources(plugins_dir.toStdString()); // register fonts int count = settings.beginReadArray("mapnik/fonts"); for (int index=0; index < count; ++index) diff --git a/include/mapnik/utils.hpp b/include/mapnik/utils.hpp index d5ec0dbe1..93c379c75 100644 --- a/include/mapnik/utils.hpp +++ b/include/mapnik/utils.hpp @@ -129,7 +129,7 @@ protected: #endif singleton() {} public: - static T* instance() + static T& instance() { if (! pInstance_) { @@ -140,7 +140,6 @@ public: { if (destroyed_) { - destroyed_ = false; onDeadReference(); } else @@ -152,7 +151,7 @@ public: } } } - return pInstance_; + return *pInstance_; } }; #ifdef MAPNIK_THREADSAFE diff --git a/plugins/input/ogr/ogr_index_featureset.cpp b/plugins/input/ogr/ogr_index_featureset.cpp index a86e9e73c..5441593f2 100644 --- a/plugins/input/ogr/ogr_index_featureset.cpp +++ b/plugins/input/ogr/ogr_index_featureset.cpp @@ -64,7 +64,7 @@ ogr_index_featureset::ogr_index_featureset(mapnik::context_ptr const & fidcolumn_(layer_.GetFIDColumn()) { - boost::optional memory = mapnik::mapped_memory_cache::instance()->find(index_file.c_str(),true); + boost::optional memory = mapnik::mapped_memory_cache::instance().find(index_file.c_str(),true); if (memory) { boost::interprocess::ibufferstream file(static_cast((*memory)->get_address()),(*memory)->get_size()); diff --git a/plugins/input/osm/demo/MapSource.cpp b/plugins/input/osm/demo/MapSource.cpp index 2e1d74b06..de9ecc7e7 100644 --- a/plugins/input/osm/demo/MapSource.cpp +++ b/plugins/input/osm/demo/MapSource.cpp @@ -320,7 +320,7 @@ void MapSource::setOSMLayers(Map& m, const parameters &p) if(boost::get(q["type"])=="osm") { m.getLayer(count).set_datasource - (datasource_cache::instance()->create(p)); + (datasource_cache::instance().create(p)); } } } @@ -353,7 +353,7 @@ void MapSource::addSRTMLayers(Map& m,double w,double s,double e,double n) <<(lon>=0 ? lon:-lon)<<"c10"; p["file"] = str.str(); cerr<<"ADDING SRTM LAYER: " << p["file"] << endl; - m.getLayer(i).set_datasource(datasource_cache::instance()->create(p)); + m.getLayer(i).set_datasource(datasource_cache::instance().create(p)); // do we have more than one srtm layer? if(floor(w) != floor(e) || floor(s) != floor(n)) @@ -385,7 +385,7 @@ void MapSource::addSRTMLayers(Map& m,double w,double s,double e,double n) lyr.add_style("contours"); lyr.add_style("contours-text"); lyr.set_datasource - (datasource_cache::instance()->create(p)); + (datasource_cache::instance().create(p)); m.addLayer(lyr); } } diff --git a/plugins/input/osm/demo/easymapnik.cpp b/plugins/input/osm/demo/easymapnik.cpp index 40d9721b1..48fd6ba3a 100644 --- a/plugins/input/osm/demo/easymapnik.cpp +++ b/plugins/input/osm/demo/easymapnik.cpp @@ -32,7 +32,7 @@ int main(int argc,char *argv[]) exit(1); } - datasource_cache::instance()->register_datasources + datasource_cache::instance().register_datasources ("/usr/local/lib/mapnik/input"); freetype_engine::register_font ("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf"); diff --git a/plugins/input/osm/render.cpp b/plugins/input/osm/render.cpp index 507157583..e301b1c06 100644 --- a/plugins/input/osm/render.cpp +++ b/plugins/input/osm/render.cpp @@ -43,7 +43,7 @@ int main(int argc,char *argv[]) exit(0); } - mapnik::datasource_cache::instance()->register_datasources("/usr/local/lib/mapnik/input"); + mapnik::datasource_cache::instance().register_datasources("/usr/local/lib/mapnik/input"); mapnik::freetype_engine::register_font("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf"); mapnik::Map m(800, 800); @@ -57,7 +57,7 @@ int main(int argc,char *argv[]) for (int count = 0; count < m.layer_count(); count++) { mapnik::parameters q = m.getLayer(count).datasource()->params(); - m.getLayer(count).set_datasource(mapnik::datasource_cache::instance()->create(p)); + m.getLayer(count).set_datasource(mapnik::datasource_cache::instance().create(p)); } } diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index 80b06b26a..ad5e09386 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -120,10 +120,8 @@ void postgis_datasource::bind() const boost::optional simplify_opt = params_.get("simplify_geometries", false); simplify_geometries_ = simplify_opt && *simplify_opt; - ConnectionManager* mgr = ConnectionManager::instance(); - mgr->registerPool(creator_, *initial_size, *max_size); - - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + ConnectionManager::instance().registerPool(creator_, *initial_size, *max_size); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); @@ -430,8 +428,7 @@ postgis_datasource::~postgis_datasource() { if (is_bound_ && ! persist_connection_) { - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); @@ -613,8 +610,7 @@ featureset_ptr postgis_datasource::features(const query& q) const box2d const& box = q.get_bbox(); double scale_denom = q.scale_denominator(); - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); @@ -723,9 +719,7 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt) const #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "postgis_datasource::features_at_point"); #endif - - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); @@ -814,8 +808,7 @@ box2d postgis_datasource::envelope() const bind(); } - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); @@ -915,8 +908,7 @@ boost::optional postgis_datasource::get_geometry boost::optional result; - ConnectionManager* mgr = ConnectionManager::instance(); - shared_ptr< Pool > pool = mgr->getPool(creator_.id()); + shared_ptr< Pool > pool = ConnectionManager::instance().getPool(creator_.id()); if (pool) { shared_ptr conn = pool->borrowObject(); diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index 342b397d2..2c2623cf1 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -55,7 +55,7 @@ dbf_file::dbf_file(std::string const& file_name) { #ifdef SHAPE_MEMORY_MAPPED_FILE - boost::optional memory = mapped_memory_cache::instance()->find(file_name.c_str(),true); + boost::optional memory = mapped_memory_cache::instance().find(file_name.c_str(),true); if (memory) { file_.buffer(static_cast((*memory)->get_address()),(*memory)->get_size()); diff --git a/plugins/input/shape/shapefile.hpp b/plugins/input/shape/shapefile.hpp index 2a2692dfe..095f2c69b 100644 --- a/plugins/input/shape/shapefile.hpp +++ b/plugins/input/shape/shapefile.hpp @@ -155,7 +155,7 @@ public: { #ifdef SHAPE_MEMORY_MAPPED_FILE boost::optional memory = - mapnik::mapped_memory_cache::instance()->find(file_name.c_str(),true); + mapnik::mapped_memory_cache::instance().find(file_name.c_str(),true); if (memory) { diff --git a/src/agg/agg_renderer.cpp b/src/agg/agg_renderer.cpp index d9a75a906..cac9710a6 100644 --- a/src/agg/agg_renderer.cpp +++ b/src/agg/agg_renderer.cpp @@ -137,7 +137,7 @@ void agg_renderer::setup(Map const &m) boost::optional const& image_filename = m.background_image(); if (image_filename) { - boost::optional bg_marker = mapnik::marker_cache::instance()->find(*image_filename,true); + boost::optional bg_marker = mapnik::marker_cache::instance().find(*image_filename,true); if (bg_marker && (*bg_marker)->is_bitmap()) { mapnik::image_ptr bg_image = *(*bg_marker)->get_bitmap_data(); diff --git a/src/agg/process_line_pattern_symbolizer.cpp b/src/agg/process_line_pattern_symbolizer.cpp index 66dc01ca2..e10b408b6 100644 --- a/src/agg/process_line_pattern_symbolizer.cpp +++ b/src/agg/process_line_pattern_symbolizer.cpp @@ -67,7 +67,7 @@ void agg_renderer::process(line_pattern_symbolizer const& sym, std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature); - boost::optional mark = marker_cache::instance()->find(filename,true); + boost::optional mark = marker_cache::instance().find(filename,true); if (!mark) return; if (!(*mark)->is_bitmap()) diff --git a/src/agg/process_markers_symbolizer.cpp b/src/agg/process_markers_symbolizer.cpp index 5624b6b9b..cef6f1694 100644 --- a/src/agg/process_markers_symbolizer.cpp +++ b/src/agg/process_markers_symbolizer.cpp @@ -75,7 +75,7 @@ void agg_renderer::process(markers_symbolizer const& sym, if (!filename.empty()) { - boost::optional mark = mapnik::marker_cache::instance()->find(filename, true); + boost::optional mark = mapnik::marker_cache::instance().find(filename, true); if (mark && *mark) { ras_ptr->reset(); diff --git a/src/agg/process_point_symbolizer.cpp b/src/agg/process_point_symbolizer.cpp index 3fbf21067..68549034b 100644 --- a/src/agg/process_point_symbolizer.cpp +++ b/src/agg/process_point_symbolizer.cpp @@ -52,7 +52,7 @@ void agg_renderer::process(point_symbolizer const& sym, boost::optional marker; if ( !filename.empty() ) { - marker = marker_cache::instance()->find(filename, true); + marker = marker_cache::instance().find(filename, true); } else { diff --git a/src/agg/process_polygon_pattern_symbolizer.cpp b/src/agg/process_polygon_pattern_symbolizer.cpp index 94dae6424..5a3a64a8f 100644 --- a/src/agg/process_polygon_pattern_symbolizer.cpp +++ b/src/agg/process_polygon_pattern_symbolizer.cpp @@ -63,7 +63,7 @@ void agg_renderer::process(polygon_pattern_symbolizer const& sym, boost::optional marker; if ( !filename.empty() ) { - marker = marker_cache::instance()->find(filename, true); + marker = marker_cache::instance().find(filename, true); } else { diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp index d6c7261d6..190e8fd3d 100644 --- a/src/cairo_renderer.cpp +++ b/src/cairo_renderer.cpp @@ -1185,7 +1185,7 @@ void cairo_renderer_base::process(point_symbolizer const& sym, boost::optional marker; if ( !filename.empty() ) { - marker = marker_cache::instance()->find(filename, true); + marker = marker_cache::instance().find(filename, true); } else { @@ -1278,7 +1278,7 @@ void cairo_renderer_base::process(line_pattern_symbolizer const& sym, typedef coord_transform path_type; std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature); - boost::optional marker = mapnik::marker_cache::instance()->find(filename,true); + boost::optional marker = mapnik::marker_cache::instance().find(filename,true); if (!marker && !(*marker)->is_bitmap()) return; unsigned width((*marker)->width()); @@ -1355,7 +1355,7 @@ void cairo_renderer_base::process(polygon_pattern_symbolizer const& sym, context.set_operator(sym.comp_op()); std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature); - boost::optional marker = mapnik::marker_cache::instance()->find(filename,true); + boost::optional marker = mapnik::marker_cache::instance().find(filename,true); if (!marker && !(*marker)->is_bitmap()) return; cairo_pattern pattern(**((*marker)->get_bitmap_data())); @@ -1652,7 +1652,7 @@ void cairo_renderer_base::process(markers_symbolizer const& sym, if (!filename.empty()) { - boost::optional mark = mapnik::marker_cache::instance()->find(filename, true); + boost::optional mark = mapnik::marker_cache::instance().find(filename, true); if (mark && *mark) { agg::trans_affine geom_tr; diff --git a/src/deepcopy.cpp b/src/deepcopy.cpp index 6c587956a..3613b90e3 100644 --- a/src/deepcopy.cpp +++ b/src/deepcopy.cpp @@ -101,7 +101,7 @@ namespace mapnik { namespace util { parameters p(ds_in->params()); // TODO : re-use datasource extent if already set. - datasource_ptr ds_out = datasource_cache::instance()->create(p); + datasource_ptr ds_out = datasource_cache::instance().create(p); if (ds_out) { lyr_out.set_datasource(ds_out); diff --git a/src/formatting/base.cpp b/src/formatting/base.cpp index 3b78229fe..bc3be41f8 100644 --- a/src/formatting/base.cpp +++ b/src/formatting/base.cpp @@ -50,7 +50,7 @@ node_ptr node::from_xml(xml_node const& xml) { continue; } - node_ptr n = registry::instance()->from_xml(*itr); + node_ptr n = registry::instance().from_xml(*itr); if (n) list->push_back(n); } if (list->get_children().size() == 1) { diff --git a/src/grid/process_markers_symbolizer.cpp b/src/grid/process_markers_symbolizer.cpp index 6b4b24052..5d2b2fc6c 100644 --- a/src/grid/process_markers_symbolizer.cpp +++ b/src/grid/process_markers_symbolizer.cpp @@ -94,7 +94,7 @@ void grid_renderer::process(markers_symbolizer const& sym, if (!filename.empty()) { - boost::optional mark = mapnik::marker_cache::instance()->find(filename, true); + boost::optional mark = mapnik::marker_cache::instance().find(filename, true); if (mark && *mark) { ras_ptr->reset(); diff --git a/src/grid/process_point_symbolizer.cpp b/src/grid/process_point_symbolizer.cpp index 843bfd802..056645a0a 100644 --- a/src/grid/process_point_symbolizer.cpp +++ b/src/grid/process_point_symbolizer.cpp @@ -54,7 +54,7 @@ void grid_renderer::process(point_symbolizer const& sym, boost::optional marker; if ( !filename.empty() ) { - marker = marker_cache::instance()->find(filename, true); + marker = marker_cache::instance().find(filename, true); } else { diff --git a/src/image_reader.cpp b/src/image_reader.cpp index 18fb28ece..22e476e27 100644 --- a/src/image_reader.cpp +++ b/src/image_reader.cpp @@ -33,12 +33,12 @@ typedef factoryregister_product(type,fun); + return ImageReaderFactory::instance().register_product(type,fun); } image_reader* get_image_reader(std::string const& filename,std::string const& type) { - return ImageReaderFactory::instance()->create_object(type,filename); + return ImageReaderFactory::instance().create_object(type,filename); } image_reader* get_image_reader(std::string const& filename) @@ -46,7 +46,7 @@ image_reader* get_image_reader(std::string const& filename) boost::optional type = type_from_filename(filename); if (type) { - return ImageReaderFactory::instance()->create_object(*type,filename); + return ImageReaderFactory::instance().create_object(*type,filename); } return 0; } diff --git a/src/load_map.cpp b/src/load_map.cpp index 032e39d8b..e1e6ddc05 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -699,7 +699,7 @@ void map_parser::parse_layer(Map & map, xml_node const& node) try { boost::shared_ptr ds = - datasource_cache::instance()->create(params); + datasource_cache::instance().create(params); lyr.set_datasource(ds); } catch (std::exception const& ex) @@ -955,11 +955,11 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& sym) { if (*marker_type == "ellipse") { - filename = marker_cache::instance()->known_svg_prefix_ + "ellipse"; + filename = marker_cache::instance().known_svg_prefix_ + "ellipse"; } else if (*marker_type == "arrow") { - filename = marker_cache::instance()->known_svg_prefix_ + "arrow"; + filename = marker_cache::instance().known_svg_prefix_ + "arrow"; } } } @@ -1124,7 +1124,7 @@ void map_parser::parse_text_symbolizer(rule & rule, xml_node const& sym) text_placements_ptr placement_finder; optional placement_type = sym.get_opt_attr("placement-type"); if (placement_type) { - placement_finder = placements::registry::instance()->from_xml(*placement_type, sym, fontsets_); + placement_finder = placements::registry::instance().from_xml(*placement_type, sym, fontsets_); } else { placement_finder = boost::make_shared(); placement_finder->defaults.from_xml(sym, fontsets_); @@ -1153,7 +1153,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& sym) text_placements_ptr placement_finder; optional placement_type = sym.get_opt_attr("placement-type"); if (placement_type) { - placement_finder = placements::registry::instance()->from_xml(*placement_type, sym, fontsets_); + placement_finder = placements::registry::instance().from_xml(*placement_type, sym, fontsets_); } else { placement_finder = boost::make_shared(); } @@ -1586,7 +1586,7 @@ void map_parser::ensure_font_face(std::string const& face_name) std::string map_parser::ensure_relative_to_xml(boost::optional opt_path) { - if (marker_cache::instance()->is_uri(*opt_path)) + if (marker_cache::instance().is_uri(*opt_path)) return *opt_path; if (relative_to_xml_) @@ -1614,7 +1614,7 @@ std::string map_parser::ensure_relative_to_xml(boost::optional opt_ void map_parser::ensure_exists(std::string const& file_path) { - if (marker_cache::instance()->is_uri(file_path)) + if (marker_cache::instance().is_uri(file_path)) return; // validate that the filename exists if it is not a dynamic PathExpression if (!boost::algorithm::find_first(file_path,"[") && !boost::algorithm::find_first(file_path,"]")) diff --git a/src/symbolizer_helpers.cpp b/src/symbolizer_helpers.cpp index 4e6cfab9f..d06515051 100644 --- a/src/symbolizer_helpers.cpp +++ b/src/symbolizer_helpers.cpp @@ -401,7 +401,7 @@ void shield_symbolizer_helper::init_marker() marker_.reset(); if (!filename.empty()) { - marker_ = marker_cache::instance()->find(filename, true); + marker_ = marker_cache::instance().find(filename, true); } if (!marker_) { marker_w_ = 0; diff --git a/tests/cpp_tests/exceptions_test.cpp b/tests/cpp_tests/exceptions_test.cpp index e3d0e6eb2..a3d412f39 100644 --- a/tests/cpp_tests/exceptions_test.cpp +++ b/tests/cpp_tests/exceptions_test.cpp @@ -44,11 +44,11 @@ int main( int, char*[] ) std::string csv_plugin("./plugins/input/csv.input"); if (boost::filesystem::exists(csv_plugin)) { try { - mapnik::datasource_cache::instance()->register_datasource(csv_plugin); + mapnik::datasource_cache::instance().register_datasource(csv_plugin); mapnik::parameters p; p["type"]="csv"; p["inline"]="x,y\n0,0"; - mapnik::datasource_ptr ds = mapnik::datasource_cache::instance()->create(p); + mapnik::datasource_ptr ds = mapnik::datasource_cache::instance().create(p); //mapnik::datasource_ptr ds = boost::make_shared(); //mapnik::context_ptr ctx = boost::make_shared(); //mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx, 1)); @@ -75,29 +75,29 @@ int main( int, char*[] ) std::string shape_plugin("./plugins/input/shape.input"); if (boost::filesystem::exists(shape_plugin)) { try { - mapnik::datasource_cache::instance()->register_datasource(shape_plugin); + mapnik::datasource_cache::instance().register_datasource(shape_plugin); mapnik::parameters p2; p2["type"]="shape"; p2["file"]="foo"; - mapnik::datasource_cache::instance()->create(p2); + mapnik::datasource_cache::instance().create(p2); BOOST_TEST(false); } catch (...) { BOOST_TEST(true); } } - + /* // not working, oddly segfaults valgrind try { sqlite3_initialize(); // http://stackoverflow.com/questions/11107703/sqlite3-sigsegvs-with-valgrind sqlite3_config(SQLITE_CONFIG_HEAP, malloc (1024*1024), 1024*1024, 64); - mapnik::datasource_cache::instance()->register_datasource("./plugins/input/sqlite.input"); + mapnik::datasource_cache::instance().register_datasource("./plugins/input/sqlite.input"); mapnik::parameters p; p["type"]="sqlite"; p["file"]="tests/data/sqlite/world.sqlite"; p["table"]="world_merc"; - mapnik::datasource_cache::instance()->create(p); + mapnik::datasource_cache::instance().create(p); sqlite3_shutdown(); BOOST_TEST(true); } catch (...) { diff --git a/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp b/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp index 854b22930..b4f45dd1d 100644 --- a/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp +++ b/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp @@ -28,7 +28,7 @@ void prepare_map(Map& m) { const std::string mapnik_dir("/usr/local/lib/mapnik/"); std::cout << " looking for 'shape.input' plugin in... " << mapnik_dir << "input/" << "\n"; - datasource_cache::instance()->register_datasources(mapnik_dir + "input/"); + datasource_cache::instance().register_datasources(mapnik_dir + "input/"); // create styles @@ -135,7 +135,7 @@ void prepare_map(Map& m) p["file"]="../../../demo/data/boundaries"; layer lyr("Provinces"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("provinces"); m.addLayer(lyr); } @@ -146,7 +146,7 @@ void prepare_map(Map& m) p["type"]="shape"; p["file"]="../../../demo/data/qcdrainage"; layer lyr("Quebec Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("drainage"); m.addLayer(lyr); } @@ -157,7 +157,7 @@ void prepare_map(Map& m) p["file"]="../../../demo/data/ontdrainage"; layer lyr("Ontario Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("drainage"); m.addLayer(lyr); } @@ -168,7 +168,7 @@ void prepare_map(Map& m) p["type"]="shape"; p["file"]="../../../demo/data/boundaries_l"; layer lyr("Provincial borders"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("provlines"); m.addLayer(lyr); } @@ -179,7 +179,7 @@ void prepare_map(Map& m) p["type"]="shape"; p["file"]="../../../demo/data/roads"; layer lyr("Roads"); - lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.set_datasource(datasource_cache::instance().create(p)); lyr.add_style("smallroads"); lyr.add_style("road-border"); lyr.add_style("road-fill"); diff --git a/utils/geometry_to_wkb/main.cpp b/utils/geometry_to_wkb/main.cpp index 735cc7f69..5dd23aa32 100644 --- a/utils/geometry_to_wkb/main.cpp +++ b/utils/geometry_to_wkb/main.cpp @@ -43,7 +43,7 @@ int main (int argc, char ** argv ) std::cerr << "Geometry to WKB converter\n"; - mapnik::datasource_cache::instance()->register_datasources("/opt/mapnik/lib/mapnik/input/"); + mapnik::datasource_cache::instance().register_datasources("/opt/mapnik/lib/mapnik/input/"); std::string filename(argv[1]); std::cerr << filename << std::endl; @@ -56,7 +56,7 @@ int main (int argc, char ** argv ) try { - ds = mapnik::datasource_cache::instance()->create(p); + ds = mapnik::datasource_cache::instance().create(p); } catch ( ... ) { @@ -104,5 +104,3 @@ int main (int argc, char ** argv ) return EXIT_SUCCESS; } - - diff --git a/utils/svg2png/svg2png.cpp b/utils/svg2png/svg2png.cpp index 790e9d475..96cc1d3bf 100644 --- a/utils/svg2png/svg2png.cpp +++ b/utils/svg2png/svg2png.cpp @@ -127,7 +127,7 @@ int main (int argc,char** argv) } boost::optional marker_ptr = - mapnik::marker_cache::instance()->find(svg_name, false); + mapnik::marker_cache::instance().find(svg_name, false); if (!marker_ptr) { std::clog << "svg2png error: could not open: '" << svg_name << "'\n";