First bit stats push.

This commit is contained in:
Tom MacWright 2012-01-20 18:46:13 -05:00
parent e7fdf1fa51
commit 38aadc16af
3 changed files with 21 additions and 12 deletions

View file

@ -42,15 +42,15 @@
namespace mapnik {
typedef MAPNIK_DECL boost::shared_ptr<Feature> feature_ptr;
struct MAPNIK_DECL Featureset
{
virtual feature_ptr next()=0;
virtual ~Featureset() {};
};
typedef MAPNIK_DECL boost::shared_ptr<Featureset> 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<double> envelope() const=0;
virtual boost::optional<geometry_t> get_geometry_type() const=0;
virtual layer_descriptor get_descriptor() const=0;
virtual std::map<std::string, mapnik::parameters> 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> datasource_ptr;
#define DATASOURCE_PLUGIN(classname) \
extern "C" MAPNIK_EXP std::string datasource_name() \
{ \

View file

@ -45,6 +45,7 @@ public:
box2d<double> envelope() const;
boost::optional<geometry_t> get_geometry_type() const;
layer_descriptor get_descriptor() const;
std::map<std::string, mapnik::parameters> get_statistics() const;
size_t size() const;
void clear();
private:

View file

@ -24,6 +24,7 @@
// mapnik
#include <mapnik/memory_datasource.hpp>
#include <mapnik/memory_featureset.hpp>
#include <mapnik/params.hpp>
#include <mapnik/feature_factory.hpp>
// stl
#include <algorithm>
@ -107,6 +108,12 @@ layer_descriptor memory_datasource::get_descriptor() const
{
return desc_;
}
std::map<std::string, mapnik::parameters> memory_datasource::get_statistics() const
{
std::map<std::string, mapnik::parameters> _stats;
return _stats;
}
size_t memory_datasource::size() const
{