Head of stats changes - moving towards shared_ptr
This commit is contained in:
parent
6f06316f28
commit
f836a43bca
4 changed files with 7 additions and 6 deletions
|
@ -95,10 +95,10 @@ boost::python::dict describe(boost::shared_ptr<mapnik::datasource> const& ds)
|
||||||
boost::python::dict statistics(boost::shared_ptr<mapnik::datasource> const& ds)
|
boost::python::dict statistics(boost::shared_ptr<mapnik::datasource> const& ds)
|
||||||
{
|
{
|
||||||
boost::python::dict description;
|
boost::python::dict description;
|
||||||
std::map<std::string, mapnik::parameters> stats = ds->get_statistics();
|
mapnik::statistics_ptr stats = ds->get_statistics();
|
||||||
std::map<std::string, mapnik::parameters>::iterator it;
|
std::map<std::string, mapnik::parameters>::iterator it;
|
||||||
|
|
||||||
for (it = stats.begin(); it != stats.end(); it++) {
|
for (it = stats->begin(); it != stats->end(); it++) {
|
||||||
boost::python::dict field;
|
boost::python::dict field;
|
||||||
mapnik::parameters::const_iterator k = it->second.begin();
|
mapnik::parameters::const_iterator k = it->second.begin();
|
||||||
for (; k != it->second.end(); ++k) {
|
for (; k != it->second.end(); ++k) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ struct MAPNIK_DECL Featureset : private boost::noncopyable
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef MAPNIK_DECL boost::shared_ptr<Featureset> featureset_ptr;
|
typedef MAPNIK_DECL boost::shared_ptr<Featureset> featureset_ptr;
|
||||||
|
typedef MAPNIK_DECL boost::shared_ptr< std::map<std::string, mapnik::parameters> > statistics_ptr;
|
||||||
|
|
||||||
class MAPNIK_DECL datasource_exception : public std::exception
|
class MAPNIK_DECL datasource_exception : public std::exception
|
||||||
{
|
{
|
||||||
|
@ -114,7 +115,7 @@ public:
|
||||||
virtual box2d<double> envelope() const=0;
|
virtual box2d<double> envelope() const=0;
|
||||||
virtual boost::optional<geometry_t> get_geometry_type() const=0;
|
virtual boost::optional<geometry_t> get_geometry_type() const=0;
|
||||||
virtual layer_descriptor get_descriptor() const=0;
|
virtual layer_descriptor get_descriptor() const=0;
|
||||||
virtual std::map<std::string, mapnik::parameters> get_statistics() const=0;
|
virtual statistics_ptr get_statistics() const=0;
|
||||||
virtual ~datasource() {};
|
virtual ~datasource() {};
|
||||||
protected:
|
protected:
|
||||||
parameters params_;
|
parameters params_;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
box2d<double> envelope() const;
|
box2d<double> envelope() const;
|
||||||
boost::optional<geometry_t> get_geometry_type() const;
|
boost::optional<geometry_t> get_geometry_type() const;
|
||||||
layer_descriptor get_descriptor() const;
|
layer_descriptor get_descriptor() const;
|
||||||
std::map<std::string, mapnik::parameters> get_statistics() const;
|
statistics_ptr get_statistics() const;
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
void clear();
|
void clear();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -118,9 +118,9 @@ layer_descriptor memory_datasource::get_descriptor() const
|
||||||
return desc_;
|
return desc_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, mapnik::parameters> memory_datasource::get_statistics() const
|
statistics_ptr memory_datasource::get_statistics() const
|
||||||
{
|
{
|
||||||
std::map<std::string, mapnik::parameters> _stats;
|
statistics_ptr(new std::map<std::string, mapnik::parameters>) _stats;
|
||||||
std::map<std::string, statistics_accumulator>::const_iterator it = accumulators_.begin();
|
std::map<std::string, statistics_accumulator>::const_iterator it = accumulators_.begin();
|
||||||
std::map<std::string, statistics_accumulator>::const_iterator end = accumulators_.end();
|
std::map<std::string, statistics_accumulator>::const_iterator end = accumulators_.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue