diff --git a/include/mapnik/datasource.hpp b/include/mapnik/datasource.hpp index 9934fa401..7bac29ca6 100644 --- a/include/mapnik/datasource.hpp +++ b/include/mapnik/datasource.hpp @@ -42,15 +42,15 @@ namespace mapnik { typedef MAPNIK_DECL boost::shared_ptr feature_ptr; - + struct MAPNIK_DECL Featureset { virtual feature_ptr next()=0; virtual ~Featureset() {}; }; - + typedef MAPNIK_DECL boost::shared_ptr featureset_ptr; - + class MAPNIK_DECL datasource_exception : public std::exception { private: @@ -65,7 +65,7 @@ public: return message_.c_str(); } }; - + class MAPNIK_DECL datasource : private boost::noncopyable { public: @@ -85,7 +85,7 @@ public: : params_(params), is_bound_(false) {} - + /*! * @brief Get the configuration parameters of the data source. * @@ -97,34 +97,35 @@ public: { return params_; } - + /*! * @brief Get the type of the datasource * @return The type of the datasource (Vector or Raster) */ virtual datasource_t type() const=0; - + /*! * @brief Connect to the datasource */ virtual void bind() const {}; - + virtual featureset_ptr features(const query& q) const=0; virtual featureset_ptr features_at_point(coord2d const& pt) const=0; virtual box2d envelope() const=0; virtual boost::optional get_geometry_type() const=0; virtual layer_descriptor get_descriptor() const=0; + virtual std::map get_statistics() const=0; virtual ~datasource() {}; protected: parameters params_; mutable bool is_bound_; }; - + typedef std::string datasource_name(); typedef datasource* create_ds(const parameters& params, bool bind); typedef void destroy_ds(datasource *ds); - + class datasource_deleter { public: @@ -135,8 +136,8 @@ public: }; typedef boost::shared_ptr datasource_ptr; - - + + #define DATASOURCE_PLUGIN(classname) \ extern "C" MAPNIK_EXP std::string datasource_name() \ { \ diff --git a/include/mapnik/memory_datasource.hpp b/include/mapnik/memory_datasource.hpp index 769a8efc8..3728e1cdd 100644 --- a/include/mapnik/memory_datasource.hpp +++ b/include/mapnik/memory_datasource.hpp @@ -45,6 +45,7 @@ public: box2d envelope() const; boost::optional get_geometry_type() const; layer_descriptor get_descriptor() const; + std::map get_statistics() const; size_t size() const; void clear(); private: diff --git a/src/memory_datasource.cpp b/src/memory_datasource.cpp index 7d142c06a..fdf2c1969 100644 --- a/src/memory_datasource.cpp +++ b/src/memory_datasource.cpp @@ -24,6 +24,7 @@ // mapnik #include #include +#include #include // stl #include @@ -107,6 +108,12 @@ layer_descriptor memory_datasource::get_descriptor() const { return desc_; } + +std::map memory_datasource::get_statistics() const +{ + std::map _stats; + return _stats; +} size_t memory_datasource::size() const {