Switched to shared_ptr at the cost of a segfault
This commit is contained in:
parent
f836a43bca
commit
9c1af869b6
7 changed files with 13 additions and 13 deletions
|
@ -358,7 +358,7 @@ layer_descriptor postgis_datasource::get_descriptor() const
|
|||
}
|
||||
|
||||
|
||||
std::map<std::string, mapnik::parameters> postgis_datasource::get_statistics() const
|
||||
mapnik::statistics_ptr postgis_datasource::get_statistics() const
|
||||
{
|
||||
if (! is_bound_) bind();
|
||||
return stats_;
|
||||
|
|
|
@ -85,13 +85,13 @@ public:
|
|||
mapnik::box2d<double> envelope() const;
|
||||
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
|
||||
layer_descriptor get_descriptor() const;
|
||||
std::map<std::string, mapnik::parameters> get_statistics() const;
|
||||
mapnik::statistics_ptr get_statistics() const;
|
||||
postgis_datasource(const parameters ¶ms, bool bind=true);
|
||||
~postgis_datasource();
|
||||
void bind() const;
|
||||
private:
|
||||
std::string sql_bbox(box2d<double> const& env) const;
|
||||
mutable std::map<std::string, mapnik::parameters> stats_;
|
||||
mapnik::statistics_ptr stats_;
|
||||
std::string populate_tokens(const std::string& sql, double scale_denom, box2d<double> const& env) const;
|
||||
std::string populate_tokens(const std::string& sql) const;
|
||||
static std::string unquote(const std::string& sql);
|
||||
|
|
|
@ -240,7 +240,7 @@ layer_descriptor shape_datasource::get_descriptor() const
|
|||
return desc_;
|
||||
}
|
||||
|
||||
std::map<std::string, mapnik::parameters> shape_datasource::get_statistics() const
|
||||
mapnik::statistics_ptr shape_datasource::get_statistics() const
|
||||
{
|
||||
if (! is_bound_) bind();
|
||||
return stats_;
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
box2d<double> envelope() const;
|
||||
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
|
||||
layer_descriptor get_descriptor() const;
|
||||
std::map<std::string, mapnik::parameters> get_statistics() const;
|
||||
mapnik::statistics_ptr get_statistics() const;
|
||||
void bind() const;
|
||||
private:
|
||||
shape_datasource(const shape_datasource&);
|
||||
|
@ -63,7 +63,7 @@ private:
|
|||
std::string shape_name_;
|
||||
mutable boost::shared_ptr<shape_io> shape_;
|
||||
mutable shape_io::shapeType shape_type_;
|
||||
mutable std::map<std::string, mapnik::parameters> stats_;
|
||||
mutable mapnik::statistics_ptr stats_;
|
||||
mutable long file_length_;
|
||||
mutable box2d<double> extent_;
|
||||
mutable bool indexed_;
|
||||
|
|
|
@ -483,11 +483,11 @@ box2d<double> sqlite_datasource::envelope() const
|
|||
return extent_;
|
||||
}
|
||||
|
||||
std::map<std::string, mapnik::parameters> sqlite_datasource::get_statistics() const
|
||||
mapnik::statistics_ptr sqlite_datasource::get_statistics() const
|
||||
{
|
||||
if (! is_bound_) bind();
|
||||
|
||||
std::map<std::string, mapnik::parameters> _stats;
|
||||
mapnik::statistics_ptr _stats;
|
||||
std::ostringstream s;
|
||||
|
||||
std::vector<attribute_descriptor>::const_iterator itr = desc_.get_descriptors().begin();
|
||||
|
@ -534,7 +534,7 @@ std::map<std::string, mapnik::parameters> sqlite_datasource::get_statistics() c
|
|||
col++;
|
||||
p["mean"] = rs->column_double(col);
|
||||
col++;
|
||||
stats_[itr->get_name()] = p;
|
||||
stats_->insert(std::pair<std::string, mapnik::parameters>(itr->get_name(), p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
mapnik::box2d<double> envelope() const;
|
||||
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
|
||||
mapnik::layer_descriptor get_descriptor() const;
|
||||
std::map<std::string, mapnik::parameters> get_statistics() const;
|
||||
mapnik::statistics_ptr get_statistics() const;
|
||||
void bind() const;
|
||||
|
||||
private:
|
||||
|
@ -80,7 +80,7 @@ private:
|
|||
mutable bool has_spatial_index_;
|
||||
mutable bool using_subquery_;
|
||||
mutable std::vector<std::string> init_statements_;
|
||||
mutable std::map<std::string, mapnik::parameters> stats_;
|
||||
mutable mapnik::statistics_ptr stats_;
|
||||
|
||||
// Fill init_statements with any statements
|
||||
// needed to attach auxillary databases
|
||||
|
|
|
@ -120,7 +120,7 @@ layer_descriptor memory_datasource::get_descriptor() const
|
|||
|
||||
statistics_ptr memory_datasource::get_statistics() const
|
||||
{
|
||||
statistics_ptr(new std::map<std::string, mapnik::parameters>) _stats;
|
||||
statistics_ptr _stats;
|
||||
std::map<std::string, statistics_accumulator>::const_iterator it = accumulators_.begin();
|
||||
std::map<std::string, statistics_accumulator>::const_iterator end = accumulators_.end();
|
||||
for (; it != end; ++it) {
|
||||
|
@ -130,7 +130,7 @@ statistics_ptr memory_datasource::get_statistics() const
|
|||
p["min"] = boost::accumulators::min(it->second);
|
||||
p["stddev"] = sqrt(boost::accumulators::variance(it->second));
|
||||
p["max"] = boost::accumulators::max(it->second);
|
||||
_stats[it->first] = p;
|
||||
_stats->insert(std::pair<std::string, mapnik::parameters>(it->first, p));
|
||||
}
|
||||
return _stats;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue