From ac8a0f01eb87f903344a4184129bf022cb3c9310 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 16 Sep 2013 10:39:52 +0100 Subject: [PATCH] c++ style : std::map --- plugins/input/postgis/postgis_datasource.cpp | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index f5bb87395..8d22b7adf 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -629,18 +629,27 @@ boost::shared_ptr postgis_datasource::get_resultset(boost::shared_pt processor_context_ptr postgis_datasource::get_context(feature_style_context_map & ctx) const { std::string ds_name(name()); - - if (! asynchronous_request_) + if (!asynchronous_request_) return processor_context_ptr(); - if (!ctx.count(ds_name)) + auto itr = ctx.find(ds_name); + if (itr != ctx.end()) { - processor_context_ptr pgis_ctx = boost::make_shared(); - ctx[ds_name] = pgis_ctx; - return ctx[ds_name]; + return itr->second; } else - return ctx[ds_name]; + { + return ctx.insert(std::make_pair(ds_name,boost::make_shared())).first->second; + } + + //if (!ctx.count(ds_name)) + // { + // processor_context_ptr pgis_ctx = boost::make_shared(); + // ctx[ds_name] = pgis_ctx; + // return ctx[ds_name]; + // } + //else + // return ctx[ds_name]; } featureset_ptr postgis_datasource::features(const query& q) const