1. corrected LIBS in SConsctipt files

2. use boost::shared_ptr instead of ref_ptr
This commit is contained in:
Artem Pavlenko 2005-12-12 13:15:33 +00:00
parent 92803f1807
commit a6191fade0
37 changed files with 168 additions and 295 deletions

View file

@ -67,13 +67,17 @@ if not conf.CheckLib('z'):
Exit(1) Exit(1)
if not conf.CheckLibWithHeader('png','png.h','C'): if not conf.CheckLibWithHeader('png','png.h','C'):
print 'Could not find libpng/headers, exiting!' print 'Could not find png lib and/or headers, exiting!'
Exit(1) Exit(1)
if not conf.CheckLib('jpeg'): if not conf.CheckLib('jpeg'):
print 'Could not find jpeg lib, exiting!' print 'Could not find jpeg lib, exiting!'
Exit(1) Exit(1)
if not conf.CheckLibWithHeader('tiff','tiff.h','C'):
print 'Could not find tiff lib and/or headers, exiting!'
Exit(1)
env = conf.Finish() env = conf.Finish()
Export('env') Export('env')

View file

@ -25,4 +25,4 @@ agg_root = env['AGG_ROOT']
agg_headers = agg_root + '/include' agg_headers = agg_root + '/include'
agg_src_dir = agg_root + '/src/' agg_src_dir = agg_root + '/src/'
agg_src = glob.glob(agg_src_dir + '*.cpp') agg_src = glob.glob(agg_src_dir + '*.cpp')
agg_lib = env.StaticLibrary('libagg',agg_src,CPPPATH=agg_headers) agg_lib = env.StaticLibrary('libagg',agg_src,LIBS=[],CPPPATH=agg_headers)

View file

@ -27,12 +27,12 @@ boost_root = env['BOOST_ROOT']
# boost filesystem # boost filesystem
filesystem_src_dir = boost_root + '/libs/filesystem/src/' filesystem_src_dir = boost_root + '/libs/filesystem/src/'
boost_fs_src= glob.glob(filesystem_src_dir + '*.cpp') boost_fs_src= glob.glob(filesystem_src_dir + '*.cpp')
lib_boost_filesystem = env.SharedLibrary('libboost-filesystem',boost_fs_src,CPPPATH=boost_root) lib_boost_filesystem = env.SharedLibrary('libboost-filesystem',boost_fs_src,LIBS=[],CPPPATH=boost_root)
env.Install(prefix+'/lib',lib_boost_filesystem) env.Install(prefix+'/lib',lib_boost_filesystem)
#boost regex #boost regex
regex_src_dir = boost_root + '/libs/regex/src/' regex_src_dir = boost_root + '/libs/regex/src/'
boost_regex_src = glob.glob(regex_src_dir+ '*.cpp') boost_regex_src = glob.glob(regex_src_dir+ '*.cpp')
lib_boost_regex = env.SharedLibrary('libboost-regex',boost_regex_src,CPPPATH=boost_root) lib_boost_regex = env.SharedLibrary('libboost-regex',boost_regex_src,LIBS=[],CPPPATH=boost_root)
env.Install(prefix+'/lib',lib_boost_regex) env.Install(prefix+'/lib',lib_boost_regex)

View file

@ -56,16 +56,16 @@ public:
PQclear(result); PQclear(result);
return ok; return ok;
} }
ref_ptr<ResultSet> executeQuery(const std::string& sql,int type=0) const boost::shared_ptr<ResultSet> executeQuery(const std::string& sql,int type=0) const
{ {
PGresult *result=0; PGresult *result=0;
if (type==1) if (type==1)
{ {
result=PQexecParams(conn_,sql.c_str(),0,0,0,0,0,1); result=PQexecParams(conn_,sql.c_str(),0,0,0,0,0,1);
return ref_ptr<ResultSet>(new ResultSet(result)); return boost::shared_ptr<ResultSet>(new ResultSet(result));
} }
result=PQexec(conn_,sql.c_str()); result=PQexec(conn_,sql.c_str());
return ref_ptr<ResultSet>(new ResultSet(result)); return boost::shared_ptr<ResultSet>(new ResultSet(result));
} }
bool isOK() const bool isOK() const
{ {

View file

@ -25,6 +25,7 @@
#include "pool.hpp" #include "pool.hpp"
#include "utils.hpp" #include "utils.hpp"
#include "connection.hpp" #include "connection.hpp"
#include <boost/shared_ptr.hpp>
using namespace mapnik; using namespace mapnik;
using std::string; using std::string;
@ -59,8 +60,8 @@ class ConnectionManager : public singleton <ConnectionManager,CreateStatic>
friend class CreateStatic<ConnectionManager>; friend class CreateStatic<ConnectionManager>;
typedef Pool<Connection,ConnectionCreator> PoolType; typedef Pool<Connection,ConnectionCreator> PoolType;
typedef std::map<std::string,ref_ptr<PoolType> > ContType; typedef std::map<std::string,boost::shared_ptr<PoolType> > ContType;
typedef ref_ptr<Connection> HolderType; typedef boost::shared_ptr<Connection> HolderType;
ContType pools_; ContType pools_;
public: public:
@ -71,13 +72,13 @@ public:
if (pools_.find(creator.id())==pools_.end()) if (pools_.find(creator.id())==pools_.end())
{ {
return pools_.insert(std::make_pair(creator.id(), return pools_.insert(std::make_pair(creator.id(),
ref_ptr<PoolType>(new PoolType(creator,initialSize,maxSize)))).second; boost::shared_ptr<PoolType>(new PoolType(creator,initialSize,maxSize)))).second;
} }
return false; return false;
} }
const ref_ptr<PoolType>& getPool(const std::string& key) const boost::shared_ptr<PoolType>& getPool(const std::string& key)
{ {
Lock lock(&mutex_); Lock lock(&mutex_);
ContType::const_iterator itr=pools_.find(key); ContType::const_iterator itr=pools_.find(key);
@ -85,7 +86,7 @@ public:
{ {
return itr->second; return itr->second;
} }
static const ref_ptr<PoolType> emptyPool(0); static const boost::shared_ptr<PoolType> emptyPool;
return emptyPool; return emptyPool;
} }
@ -95,10 +96,10 @@ public:
ContType::const_iterator itr=pools_.find(key); ContType::const_iterator itr=pools_.find(key);
if (itr!=pools_.end()) if (itr!=pools_.end())
{ {
ref_ptr<PoolType> pool=itr->second; boost::shared_ptr<PoolType> pool=itr->second;
return pool->borrowObject(); return pool->borrowObject();
} }
static const HolderType EmptyConn(0); static const HolderType EmptyConn;
return EmptyConn; return EmptyConn;
} }

View file

@ -36,6 +36,7 @@ using std::endl;
using boost::lexical_cast; using boost::lexical_cast;
using boost::bad_lexical_cast; using boost::bad_lexical_cast;
using boost::shared_ptr;
postgis_datasource::postgis_datasource(const Parameters& params) postgis_datasource::postgis_datasource(const Parameters& params)
: table_(params.get("table")), : table_(params.get("table")),
@ -50,13 +51,13 @@ postgis_datasource::postgis_datasource(const Parameters& params)
ConnectionManager *mgr=ConnectionManager::instance(); ConnectionManager *mgr=ConnectionManager::instance();
mgr->registerPool(creator_,10,20); mgr->registerPool(creator_,10,20);
ref_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id()); shared_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
if (pool) if (pool)
{ {
const ref_ptr<Connection>& conn = pool->borrowObject(); const shared_ptr<Connection>& conn = pool->borrowObject();
if (conn && conn->isOK()) if (conn && conn->isOK())
{ {
PoolGuard<ref_ptr<Connection>,ref_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool); PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
std::string table_name=table_from_sql(table_); std::string table_name=table_from_sql(table_);
@ -64,7 +65,7 @@ postgis_datasource::postgis_datasource(const Parameters& params)
s << "select f_geometry_column,srid,type from "; s << "select f_geometry_column,srid,type from ";
s << GEOMETRY_COLUMNS <<" where f_table_name='"<<table_name<<"'"; s << GEOMETRY_COLUMNS <<" where f_table_name='"<<table_name<<"'";
ref_ptr<ResultSet> rs=conn->executeQuery(s.str()); shared_ptr<ResultSet> rs=conn->executeQuery(s.str());
if (rs->next()) if (rs->next())
{ {
@ -179,13 +180,13 @@ featureset_ptr postgis_datasource::features(const query& q) const
Featureset *fs=0; Featureset *fs=0;
Envelope<double> const& box=q.get_bbox(); Envelope<double> const& box=q.get_bbox();
ConnectionManager *mgr=ConnectionManager::instance(); ConnectionManager *mgr=ConnectionManager::instance();
ref_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id()); shared_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
if (pool) if (pool)
{ {
const ref_ptr<Connection>& conn = pool->borrowObject(); const shared_ptr<Connection>& conn = pool->borrowObject();
if (conn && conn->isOK()) if (conn && conn->isOK())
{ {
PoolGuard<ref_ptr<Connection>,ref_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool); PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
std::ostringstream s; std::ostringstream s;
// can we rely on 'gid' name??? // can we rely on 'gid' name???
s << "select gid,asbinary("<<geometryColumn_<<") as geom"; s << "select gid,asbinary("<<geometryColumn_<<") as geom";
@ -201,7 +202,7 @@ featureset_ptr postgis_datasource::features(const query& q) const
s << box.minx() << " " << box.miny() << ","; s << box.minx() << " " << box.miny() << ",";
s << box.maxx() << " " << box.maxy() << ")'::box3d,"<<srid_<<")"; s << box.maxx() << " " << box.maxy() << ")'::box3d,"<<srid_<<")";
cout << s.str() << endl; cout << s.str() << endl;
ref_ptr<ResultSet> rs=conn->executeQuery(s.str(),1); shared_ptr<ResultSet> rs=conn->executeQuery(s.str(),1);
fs=new postgis_featureset(rs,props.size()); fs=new postgis_featureset(rs,props.size());
} }
} }

View file

@ -65,12 +65,12 @@ private:
class postgis_featureset : public Featureset class postgis_featureset : public Featureset
{ {
private: private:
ref_ptr<ResultSet> rs_; boost::shared_ptr<ResultSet> rs_;
unsigned num_attrs_; unsigned num_attrs_;
mutable int totalGeomSize_; mutable int totalGeomSize_;
mutable int count_; mutable int count_;
public: public:
postgis_featureset(const ref_ptr<ResultSet>& rs,unsigned num_attrs); postgis_featureset(const boost::shared_ptr<ResultSet>& rs,unsigned num_attrs);
void dispose(); void dispose();
feature_ptr next(); feature_ptr next();
~postgis_featureset(); ~postgis_featureset();

View file

@ -27,7 +27,7 @@ using boost::lexical_cast;
using boost::bad_lexical_cast; using boost::bad_lexical_cast;
using std::string; using std::string;
postgis_featureset::postgis_featureset(const ref_ptr<ResultSet>& rs, postgis_featureset::postgis_featureset(boost::shared_ptr<ResultSet> const& rs,
unsigned num_attrs=0) unsigned num_attrs=0)
: rs_(rs), : rs_(rs),
num_attrs_(num_attrs), num_attrs_(num_attrs),
@ -97,7 +97,7 @@ feature_ptr postgis_featureset::next()
rs_->close(); rs_->close();
std::cout << "totalGeomSize="<<totalGeomSize_<<" bytes"<<std::endl; std::cout << "totalGeomSize="<<totalGeomSize_<<" bytes"<<std::endl;
std::cout << "count="<<count_<<std::endl; std::cout << "count="<<count_<<std::endl;
return feature_ptr(0); return feature_ptr();
} }
} }

View file

@ -72,7 +72,7 @@ feature_ptr raster_featureset<LookupPolicy>::next()
++curIter_; ++curIter_;
return feature; return feature;
} }
return feature_ptr(0); return feature_ptr();
} }

View file

@ -36,6 +36,6 @@ shape_src = Split(
headers = ['#include',boost_root] headers = ['#include',boost_root]
shape_datasource = env.SharedLibrary('shape',source=shape_src,SHLIBPREFIX='',LIBS="",CPPPATH=headers) shape_datasource = env.SharedLibrary('shape',source=shape_src,SHLIBPREFIX='',LIBS=[],CPPPATH=headers)
env.Install(prefix+"/datasources",shape_datasource) env.Install(prefix+"/datasources",shape_datasource)
env.Alias("install",prefix + '/datasources') env.Alias("install",prefix + '/datasources')

View file

@ -101,7 +101,7 @@ feature_ptr shape_featureset<filterT>::next()
} }
else else
{ {
return feature_ptr(0); return feature_ptr();
} }
} }
@ -152,7 +152,7 @@ feature_ptr shape_featureset<filterT>::next()
break; break;
} }
default: default:
return feature_ptr(0); return feature_ptr();
} }
if (attr_ids_.size()) if (attr_ids_.size())
@ -178,7 +178,7 @@ feature_ptr shape_featureset<filterT>::next()
else else
{ {
std::cout<<" total shapes read="<<count_<<"\n"; std::cout<<" total shapes read="<<count_<<"\n";
return feature_ptr(0); return feature_ptr();
} }
} }

View file

@ -178,7 +178,7 @@ feature_ptr shape_index_featureset<filterT>::next()
else else
{ {
std::cout<<count_<<" features\n"; std::cout<<count_<<" features\n";
return feature_ptr(0); return feature_ptr();
} }
} }

View file

@ -23,23 +23,25 @@
#include <map> #include <map>
#include <string> #include <string>
#include "ptr.hpp"
#include "ctrans.hpp" #include "ctrans.hpp"
#include "params.hpp" #include "params.hpp"
#include "feature.hpp" #include "feature.hpp"
#include "query.hpp" #include "query.hpp"
#include "feature_layer_desc.hpp" #include "feature_layer_desc.hpp"
//#include "ptr.hpp"
#include <boost/shared_ptr.hpp>
namespace mapnik namespace mapnik
{ {
typedef ref_ptr<Feature> feature_ptr; typedef shared_ptr<Feature> feature_ptr;
struct Featureset struct Featureset
{ {
virtual feature_ptr next()=0; virtual feature_ptr next()=0;
virtual ~Featureset() {}; virtual ~Featureset() {};
}; };
typedef ref_ptr<Featureset> featureset_ptr; typedef shared_ptr<Featureset> featureset_ptr;
class datasource_exception : public std::exception class datasource_exception : public std::exception
{ {
private: private:
@ -73,17 +75,18 @@ namespace mapnik
typedef datasource* create_ds(const Parameters& params); typedef datasource* create_ds(const Parameters& params);
typedef void destroy_ds(datasource *ds); typedef void destroy_ds(datasource *ds);
template <typename DATASOURCE>
struct datasource_delete class datasource_deleter
{ {
static void destroy(DATASOURCE* ds) public:
{ void operator() (datasource* ds)
{
delete ds; delete ds;
} }
}; };
typedef ref_ptr<datasource,datasource_delete> datasource_p; typedef boost::shared_ptr<datasource> datasource_p;
/////////////////////////////////////////// ///////////////////////////////////////////
#define DATASOURCE_PLUGIN(classname) \ #define DATASOURCE_PLUGIN(classname) \
extern "C" std::string datasource_name() \ extern "C" std::string datasource_name() \
@ -92,7 +95,7 @@ namespace mapnik
}\ }\
extern "C" datasource* create(const Parameters &params) \ extern "C" datasource* create(const Parameters &params) \
{ \ { \
return new classname(params);\ return new classname(params); \
}\ }\
extern "C" void destroy(datasource *ds) \ extern "C" void destroy(datasource *ds) \
{ \ { \

View file

@ -18,14 +18,14 @@
//$Id: datasource_cache.hpp 39 2005-04-10 20:39:53Z pavlenko $ //$Id: datasource_cache.hpp 39 2005-04-10 20:39:53Z pavlenko $
#ifndef DSFACTORY_HPP #ifndef DATASOURCE_CACHE_HPP
#define DSFACTORY_HPP #define DATASOURCE_CACHE_HPP
#include "utils.hpp" #include "utils.hpp"
#include "ptr.hpp"
#include "params.hpp" #include "params.hpp"
#include "plugin.hpp" #include "plugin.hpp"
#include "datasource.hpp" #include "datasource.hpp"
#include <boost/shared_ptr.hpp>
#include <map> #include <map>
namespace mapnik namespace mapnik
@ -38,12 +38,12 @@ namespace mapnik
~datasource_cache(); ~datasource_cache();
datasource_cache(const datasource_cache&); datasource_cache(const datasource_cache&);
datasource_cache& operator=(const datasource_cache&); datasource_cache& operator=(const datasource_cache&);
static std::map<std::string,ref_ptr<PluginInfo> > plugins_; static std::map<std::string,boost::shared_ptr<PluginInfo> > plugins_;
static bool registered_; static bool registered_;
static bool insert(const std::string& name,const lt_dlhandle module); static bool insert(const std::string& name,const lt_dlhandle module);
public: public:
static void register_datasources(const std::string& path); static void register_datasources(const std::string& path);
static ref_ptr<datasource,datasource_delete> create(const Parameters& params); static boost::shared_ptr<datasource> create(Parameters const& params);
}; };
} }
#endif //DSFACTORY_HPP #endif //DATASOURCE_CACHE_HPP

View file

@ -28,7 +28,7 @@
namespace mapnik namespace mapnik
{ {
typedef ref_ptr<raster> raster_ptr; typedef boost::shared_ptr<raster> raster_ptr;
typedef std::vector<value> properties; typedef std::vector<value> properties;
template <typename T1,typename T2> template <typename T1,typename T2>

View file

@ -23,7 +23,6 @@
#include "rule.hpp" #include "rule.hpp"
#include "feature.hpp" #include "feature.hpp"
#include "ptr.hpp"
#include <vector> #include <vector>
namespace mapnik namespace mapnik

View file

@ -25,7 +25,7 @@
#include "feature.hpp" #include "feature.hpp"
namespace mapnik namespace mapnik
{ {
typedef ref_ptr<filter<Feature> > filter_ptr; typedef boost::shared_ptr<filter<Feature> > filter_ptr;
template <typename FeatureT> class filter_visitor; template <typename FeatureT> class filter_visitor;
template <typename FeatureT> template <typename FeatureT>

View file

@ -18,6 +18,9 @@
//$Id$ //$Id$
#ifndef FILTER_FACTORY_HPP
#define FILTER_FACTORY_HPP
#include "filter_parser.hpp" #include "filter_parser.hpp"
using std::string; using std::string;
@ -30,8 +33,8 @@ namespace mapnik
public: public:
static filter_ptr compile(string const& str) static filter_ptr compile(string const& str)
{ {
stack<ref_ptr<filter<FeatureT> > > filters; stack<shared_ptr<filter<FeatureT> > > filters;
stack<ref_ptr<expression<FeatureT> > > exps; stack<shared_ptr<expression<FeatureT> > > exps;
filter_grammar<FeatureT> grammar(filters,exps); filter_grammar<FeatureT> grammar(filters,exps);
char const *text = str.c_str(); char const *text = str.c_str();
parse_info<> info = parse(text,text+strlen(text),grammar,space_p); parse_info<> info = parse(text,text+strlen(text),grammar,space_p);
@ -47,3 +50,5 @@ namespace mapnik
} }
}; };
} }
#endif //FILTER_FACTORY_HPP

View file

@ -21,6 +21,7 @@
#ifndef FILTER_PARSER_HPP #ifndef FILTER_PARSER_HPP
#define FILTER_PARSER_HPP #define FILTER_PARSER_HPP
#include <boost/shared_ptr.hpp>
#include <boost/spirit/core.hpp> #include <boost/spirit/core.hpp>
#include <boost/spirit/symbols.hpp> #include <boost/spirit/symbols.hpp>
#include <boost/spirit/utility/confix.hpp> #include <boost/spirit/utility/confix.hpp>
@ -46,32 +47,32 @@ namespace mapnik
template <typename FeatureT> template <typename FeatureT>
struct push_integer struct push_integer
{ {
push_integer(stack<ref_ptr<expression<FeatureT> > >& exprs) push_integer(stack<shared_ptr<expression<FeatureT> > >& exprs)
: exprs_(exprs) {} : exprs_(exprs) {}
void operator() (int val) const void operator() (int val) const
{ {
exprs_.push(ref_ptr<expression<FeatureT> >(new literal<FeatureT>(val))); exprs_.push(shared_ptr<expression<FeatureT> >(new literal<FeatureT>(val)));
} }
stack<ref_ptr<expression<FeatureT> > >& exprs_; stack<shared_ptr<expression<FeatureT> > >& exprs_;
}; };
template <typename FeatureT> template <typename FeatureT>
struct push_real struct push_real
{ {
push_real(stack<ref_ptr<expression<FeatureT> > >& exprs) push_real(stack<shared_ptr<expression<FeatureT> > >& exprs)
: exprs_(exprs) {} : exprs_(exprs) {}
void operator() (double val) const void operator() (double val) const
{ {
exprs_.push(ref_ptr<expression<FeatureT> >(new literal<FeatureT>(val))); exprs_.push(shared_ptr<expression<FeatureT> >(new literal<FeatureT>(val)));
} }
stack<ref_ptr<expression<FeatureT> > >& exprs_; stack<shared_ptr<expression<FeatureT> > >& exprs_;
}; };
template <typename FeatureT> template <typename FeatureT>
struct push_string struct push_string
{ {
push_string(stack<ref_ptr<expression<FeatureT> > >& exprs) push_string(stack<shared_ptr<expression<FeatureT> > >& exprs)
: exprs_(exprs) {} : exprs_(exprs) {}
template <typename Iter> template <typename Iter>
@ -86,30 +87,30 @@ namespace mapnik
str.erase(idx,1); str.erase(idx,1);
idx = str.find(quote); idx = str.find(quote);
} }
exprs_.push(ref_ptr<expression<FeatureT> >(new literal<FeatureT>(str))); exprs_.push(shared_ptr<expression<FeatureT> >(new literal<FeatureT>(str)));
} }
stack<ref_ptr<expression<FeatureT> > >& exprs_; stack<shared_ptr<expression<FeatureT> > >& exprs_;
}; };
template <typename FeatureT> template <typename FeatureT>
struct push_property struct push_property
{ {
push_property(stack<ref_ptr<expression<FeatureT> > >& exprs) push_property(stack<shared_ptr<expression<FeatureT> > >& exprs)
: exprs_(exprs) {} : exprs_(exprs) {}
template <typename Iter> template <typename Iter>
void operator() (Iter start,Iter end) const void operator() (Iter start,Iter end) const
{ {
string str(start,end); string str(start,end);
exprs_.push(ref_ptr<expression<FeatureT> >(new property<FeatureT>(str))); exprs_.push(shared_ptr<expression<FeatureT> >(new property<FeatureT>(str)));
} }
stack<ref_ptr<expression<FeatureT> > >& exprs_; stack<shared_ptr<expression<FeatureT> > >& exprs_;
}; };
template <typename FeatureT,typename Op> template <typename FeatureT,typename Op>
struct compose_expression struct compose_expression
{ {
compose_expression(stack<ref_ptr<expression<FeatureT> > >& exprs) compose_expression(stack<shared_ptr<expression<FeatureT> > >& exprs)
: exprs_(exprs) {} : exprs_(exprs) {}
template <typename Iter> template <typename Iter>
@ -117,24 +118,24 @@ namespace mapnik
{ {
if (exprs_.size()>=2) if (exprs_.size()>=2)
{ {
ref_ptr<expression<FeatureT> > right = exprs_.top(); shared_ptr<expression<FeatureT> > right = exprs_.top();
exprs_.pop(); exprs_.pop();
ref_ptr<expression<FeatureT> > left = exprs_.top(); shared_ptr<expression<FeatureT> > left = exprs_.top();
exprs_.pop(); exprs_.pop();
if (left && right) if (left && right)
{ {
exprs_.push(ref_ptr<expression<FeatureT> >(new math_expr_b<FeatureT,Op>(*left,*right))); exprs_.push(shared_ptr<expression<FeatureT> >(new math_expr_b<FeatureT,Op>(*left,*right)));
} }
} }
} }
stack<ref_ptr<expression<FeatureT> > >& exprs_; stack<shared_ptr<expression<FeatureT> > >& exprs_;
}; };
template <typename FeatureT> template <typename FeatureT>
struct compose_regex struct compose_regex
{ {
compose_regex(stack<ref_ptr<filter<FeatureT> > >& filters, compose_regex(stack<shared_ptr<filter<FeatureT> > >& filters,
stack<ref_ptr<expression<FeatureT> > >& exprs) stack<shared_ptr<expression<FeatureT> > >& exprs)
: filters_(filters),exprs_(exprs) {} : filters_(filters),exprs_(exprs) {}
template <typename Iter> template <typename Iter>
@ -142,14 +143,14 @@ namespace mapnik
{ {
if (exprs_.size()>=1) if (exprs_.size()>=1)
{ {
ref_ptr<expression<FeatureT> > exp = exprs_.top(); shared_ptr<expression<FeatureT> > exp = exprs_.top();
exprs_.pop(); exprs_.pop();
if (exp) if (exp)
{ {
std::string pattern(start,end); std::string pattern(start,end);
try try
{ {
filters_.push(ref_ptr<filter<FeatureT> >(new regex_filter<FeatureT>(*exp,pattern))); filters_.push(shared_ptr<filter<FeatureT> >(new regex_filter<FeatureT>(*exp,pattern)));
} }
catch (...)//boost::regex_error& ex) catch (...)//boost::regex_error& ex)
{ {
@ -159,16 +160,16 @@ namespace mapnik
} }
} }
} }
stack<ref_ptr<filter<FeatureT> > >& filters_; stack<shared_ptr<filter<FeatureT> > >& filters_;
stack<ref_ptr<expression<FeatureT> > >& exprs_; stack<shared_ptr<expression<FeatureT> > >& exprs_;
}; };
template <typename FeatureT,typename Op> template <typename FeatureT,typename Op>
struct compose_filter struct compose_filter
{ {
compose_filter(stack<ref_ptr<filter<FeatureT> > >& filters, compose_filter(stack<shared_ptr<filter<FeatureT> > >& filters,
stack<ref_ptr<expression<FeatureT> > >& exprs) stack<shared_ptr<expression<FeatureT> > >& exprs)
: filters_(filters),exprs_(exprs) {} : filters_(filters),exprs_(exprs) {}
template <typename Iter> template <typename Iter>
@ -176,24 +177,24 @@ namespace mapnik
{ {
if (exprs_.size()>=2) if (exprs_.size()>=2)
{ {
ref_ptr<expression<FeatureT> > right = exprs_.top(); shared_ptr<expression<FeatureT> > right = exprs_.top();
exprs_.pop(); exprs_.pop();
ref_ptr<expression<FeatureT> > left = exprs_.top(); shared_ptr<expression<FeatureT> > left = exprs_.top();
exprs_.pop(); exprs_.pop();
if (left && right) if (left && right)
{ {
filters_.push(ref_ptr<filter<FeatureT> >(new compare_filter<FeatureT,Op>(*left,*right))); filters_.push(shared_ptr<filter<FeatureT> >(new compare_filter<FeatureT,Op>(*left,*right)));
} }
} }
} }
stack<ref_ptr<filter<FeatureT> > >& filters_; stack<shared_ptr<filter<FeatureT> > >& filters_;
stack<ref_ptr<expression<FeatureT> > >& exprs_; stack<shared_ptr<expression<FeatureT> > >& exprs_;
}; };
template <typename FeatureT> template <typename FeatureT>
struct compose_and_filter struct compose_and_filter
{ {
compose_and_filter(stack<ref_ptr<filter<FeatureT> > >& filters) compose_and_filter(stack<shared_ptr<filter<FeatureT> > >& filters)
: filters_(filters) {} : filters_(filters) {}
template <typename Iter> template <typename Iter>
@ -201,23 +202,23 @@ namespace mapnik
{ {
if (filters_.size()>=2) if (filters_.size()>=2)
{ {
ref_ptr<filter<FeatureT> > right = filters_.top(); shared_ptr<filter<FeatureT> > right = filters_.top();
filters_.pop(); filters_.pop();
ref_ptr<filter<FeatureT> > left = filters_.top(); shared_ptr<filter<FeatureT> > left = filters_.top();
filters_.pop(); filters_.pop();
if (left && right) if (left && right)
{ {
filters_.push(ref_ptr<filter<FeatureT> >(new logical_and<FeatureT>(*left,*right))); filters_.push(shared_ptr<filter<FeatureT> >(new logical_and<FeatureT>(*left,*right)));
} }
} }
} }
stack<ref_ptr<filter<FeatureT> > >& filters_; stack<shared_ptr<filter<FeatureT> > >& filters_;
}; };
template <typename FeatureT> template <typename FeatureT>
struct compose_or_filter struct compose_or_filter
{ {
compose_or_filter(stack<ref_ptr<filter<FeatureT> > >& filters) compose_or_filter(stack<shared_ptr<filter<FeatureT> > >& filters)
: filters_(filters) {} : filters_(filters) {}
template <typename Iter> template <typename Iter>
@ -225,23 +226,23 @@ namespace mapnik
{ {
if (filters_.size()>=2) if (filters_.size()>=2)
{ {
ref_ptr<filter<FeatureT> > right = filters_.top(); shared_ptr<filter<FeatureT> > right = filters_.top();
filters_.pop(); filters_.pop();
ref_ptr<filter<FeatureT> > left = filters_.top(); shared_ptr<filter<FeatureT> > left = filters_.top();
filters_.pop(); filters_.pop();
if (left && right) if (left && right)
{ {
filters_.push(ref_ptr<filter<FeatureT> >(new logical_or<FeatureT>(*left,*right))); filters_.push(shared_ptr<filter<FeatureT> >(new logical_or<FeatureT>(*left,*right)));
} }
} }
} }
stack<ref_ptr<filter<FeatureT> > >& filters_; stack<shared_ptr<filter<FeatureT> > >& filters_;
}; };
template <typename FeatureT> template <typename FeatureT>
struct compose_not_filter struct compose_not_filter
{ {
compose_not_filter(stack<ref_ptr<filter<FeatureT> > >& filters) compose_not_filter(stack<shared_ptr<filter<FeatureT> > >& filters)
: filters_(filters) {} : filters_(filters) {}
template <typename Iter> template <typename Iter>
@ -249,22 +250,22 @@ namespace mapnik
{ {
if (filters_.size()>=1) if (filters_.size()>=1)
{ {
ref_ptr<filter<FeatureT> > filter_ = filters_.top(); shared_ptr<filter<FeatureT> > filter_ = filters_.top();
filters_.pop(); filters_.pop();
if (filter_) if (filter_)
{ {
filters_.push(ref_ptr<filter<FeatureT> >(new logical_not<FeatureT>(*filter_))); filters_.push(shared_ptr<filter<FeatureT> >(new logical_not<FeatureT>(*filter_)));
} }
} }
} }
stack<ref_ptr<filter<FeatureT> > >& filters_; stack<shared_ptr<filter<FeatureT> > >& filters_;
}; };
template <typename FeatureT> template <typename FeatureT>
struct filter_grammar : public grammar<filter_grammar<FeatureT> > struct filter_grammar : public grammar<filter_grammar<FeatureT> >
{ {
filter_grammar(stack<ref_ptr<filter<FeatureT> > >& filters_, filter_grammar(stack<shared_ptr<filter<FeatureT> > >& filters_,
stack<ref_ptr<expression<FeatureT> > >& exprs_) stack<shared_ptr<expression<FeatureT> > >& exprs_)
: filters(filters_),exprs(exprs_) {} : filters(filters_),exprs(exprs_) {}
template <typename ScannerT> template <typename ScannerT>
@ -430,8 +431,8 @@ namespace mapnik
symbols<string> func2_op; symbols<string> func2_op;
symbols<string> spatial_op; symbols<string> spatial_op;
}; };
stack<ref_ptr<filter<FeatureT> > >& filters; stack<shared_ptr<filter<FeatureT> > >& filters;
stack<ref_ptr<expression<FeatureT> > >& exprs; stack<shared_ptr<expression<FeatureT> > >& exprs;
}; };
} }

View file

@ -24,9 +24,10 @@
#include "vertex_vector.hpp" #include "vertex_vector.hpp"
#include "vertex_transform.hpp" #include "vertex_transform.hpp"
#include "ctrans.hpp" #include "ctrans.hpp"
#include "ptr.hpp"
#include "geom_util.hpp" #include "geom_util.hpp"
#include <boost/shared_ptr.hpp>
namespace mapnik namespace mapnik
{ {
enum { enum {
@ -259,7 +260,7 @@ namespace mapnik
typedef polygon<vertex2d> polygon_impl; typedef polygon<vertex2d> polygon_impl;
typedef geometry<vertex2d> geometry_type; typedef geometry<vertex2d> geometry_type;
typedef ref_ptr<geometry_type> geometry_ptr; typedef boost::shared_ptr<geometry_type> geometry_ptr;
} }
#endif //GEOMETRY_HPP #endif //GEOMETRY_HPP

View file

@ -23,8 +23,8 @@
#include <vector> #include <vector>
#include "feature.hpp" #include "feature.hpp"
#include "ptr.hpp"
#include "datasource.hpp" #include "datasource.hpp"
#include <boost/shared_ptr.hpp>
namespace mapnik namespace mapnik
{ {
@ -40,7 +40,7 @@ namespace mapnik
datasource_p ds_; datasource_p ds_;
std::vector<std::string> styles_; std::vector<std::string> styles_;
std::string selection_style_; std::string selection_style_;
mutable std::vector<ref_ptr<Feature> > selection_; mutable std::vector<boost::shared_ptr<Feature> > selection_;
public: public:
explicit Layer(const Parameters& params); explicit Layer(const Parameters& params);
@ -62,8 +62,8 @@ namespace mapnik
void setSelectable(bool selectable); void setSelectable(bool selectable);
bool isSelectable() const; bool isSelectable() const;
bool isVisible(double scale) const; bool isVisible(double scale) const;
void add_to_selection(ref_ptr<Feature>& feature) const; void add_to_selection(boost::shared_ptr<Feature>& feature) const;
std::vector<ref_ptr<Feature> >& selection() const; std::vector<boost::shared_ptr<Feature> >& selection() const;
void clear_selection() const; void clear_selection() const;
datasource_p const& datasource() const; datasource_p const& datasource() const;
Envelope<double> envelope() const; Envelope<double> envelope() const;
@ -72,4 +72,4 @@ namespace mapnik
void swap(const Layer& other); void swap(const Layer& other);
}; };
} }
#endif //LAYER_HPP #endif //LAYER_HPP

View file

@ -25,7 +25,6 @@
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include "global.hpp" #include "global.hpp"
#include "ptr.hpp"
#include "factory.hpp" #include "factory.hpp"
#include "filter.hpp" #include "filter.hpp"
#include "query.hpp" #include "query.hpp"

View file

@ -25,9 +25,8 @@
#include <map> #include <map>
#include <deque> #include <deque>
#include <ctime> #include <ctime>
#include "ptr.hpp"
#include "utils.hpp" #include "utils.hpp"
#include <boost/shared_ptr.hpp>
namespace mapnik namespace mapnik
{ {
@ -56,7 +55,7 @@ namespace mapnik
template <typename T,template <typename> class Creator> template <typename T,template <typename> class Creator>
class Pool class Pool
{ {
typedef ref_ptr<T> HolderType; typedef boost::shared_ptr<T> HolderType;
typedef std::deque<HolderType> ContType; typedef std::deque<HolderType> ContType;
Creator<T> creator_; Creator<T> creator_;
@ -90,7 +89,7 @@ namespace mapnik
mutex_.unlock(); mutex_.unlock();
return usedPool_[usedPool_.size()-1]; return usedPool_[usedPool_.size()-1];
} }
static const HolderType defaultObj(0); static const HolderType defaultObj;
return defaultObj; return defaultObj;
} }

View file

@ -1,107 +0,0 @@
/* This file is part of Mapnik (c++ mapping toolkit)
* Copyright (C) 2005 Artem Pavlenko
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//$Id: ptr.hpp 39 2005-04-10 20:39:53Z pavlenko $
#ifndef PTR_HPP
#define PTR_HPP
namespace mapnik
{
template <typename T> struct DefaultDeletePolicy
{
static void destroy(T* p)
{
delete p;
}
};
template <typename T,
template <typename T> class DeallocPolicy=DefaultDeletePolicy>
class ref_ptr
{
private:
T* ptr_;
int* pCount_;
public:
T* operator->() {return ptr_;}
const T* operator->() const {return ptr_;}
T* get() {return ptr_;}
const T* get() const {return ptr_;}
const T& operator *() const {return *ptr_;}
T& operator *() {return *ptr_;}
explicit ref_ptr(T* ptr=0)
:ptr_(ptr),pCount_(new int(1)) {}
ref_ptr(const ref_ptr& rhs)
:ptr_(rhs.ptr_),pCount_(rhs.pCount_)
{
(*pCount_)++;
}
ref_ptr& operator=(const ref_ptr& rhs)
{
if (ptr_==rhs.ptr_) return *this;
if (--(*pCount_)==0)
{
DeallocPolicy<T>::destroy(ptr_);
delete pCount_;
}
ptr_=rhs.ptr_;
pCount_=rhs.pCount_;
(*pCount_)++;
return *this;
}
bool operator !() const
{
return ptr_==0;
}
operator bool () const
{
return ptr_!=0;
}
inline friend bool operator==(const ref_ptr& lhs,
const T* rhs)
{
return lhs.ptr_==rhs;
}
inline friend bool operator==(const T* lhs,
const ref_ptr& rhs)
{
return lhs==rhs.ptr_;
}
inline friend bool operator!=(const ref_ptr& lhs,
const T* rhs)
{
return lhs.ptr_!=rhs;
}
inline friend bool operator!=(const T* lhs,
const ref_ptr& rhs)
{
return lhs!=rhs.ptr_;
}
~ref_ptr()
{
if (--(*pCount_)==0)
{
DeallocPolicy<T>::destroy(ptr_);
delete pCount_;
}
}
};
}
#endif //PTR_HPP

View file

@ -22,8 +22,6 @@
#define RENDER_HPP #define RENDER_HPP
#include <stack> #include <stack>
#include "memory.hpp"
#include "ptr.hpp"
#include "style.hpp" #include "style.hpp"
#include "envelope.hpp" #include "envelope.hpp"
#include "graphics.hpp" #include "graphics.hpp"

View file

@ -21,13 +21,13 @@
#include "symbolizer.hpp" #include "symbolizer.hpp"
#include "filter.hpp" #include "filter.hpp"
#include <ptr.hpp> #include <boost/shared_ptr.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
namespace mapnik namespace mapnik
{ {
typedef ref_ptr<symbolizer> symbolizer_ptr; typedef boost::shared_ptr<symbolizer> symbolizer_ptr;
typedef std::vector<symbolizer_ptr> symbolizers; typedef std::vector<symbolizer_ptr> symbolizers;
template <typename FeatureT> class all_filter; template <typename FeatureT> class all_filter;
@ -35,7 +35,7 @@ namespace mapnik
class rule class rule
{ {
typedef Filter<FeatureT> filter_type; typedef Filter<FeatureT> filter_type;
typedef ref_ptr<filter_type> filter_ptr; typedef boost::shared_ptr<filter_type> filter_ptr;
private: private:
std::string name_; std::string name_;

View file

@ -22,26 +22,26 @@
#define STYLE_HPP #define STYLE_HPP
#include "color.hpp" #include "color.hpp"
#include "ptr.hpp"
#include "symbolizer.hpp" #include "symbolizer.hpp"
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <boost/shared_ptr.hpp>
namespace mapnik namespace mapnik
{ {
class Style class Style
{ {
private: private:
std::vector<ref_ptr<symbolizer> > symbols_; std::vector<boost::shared_ptr<symbolizer> > symbols_;
static ref_ptr<symbolizer> zero_symbol_; static boost::shared_ptr<symbolizer> zero_symbol_;
public: public:
typedef std::vector<ref_ptr<symbolizer> >::const_iterator Iterator; typedef std::vector<boost::shared_ptr<symbolizer> >::const_iterator Iterator;
Style() {} Style() {}
Style(const ref_ptr<symbolizer>& symbol) Style(const boost::shared_ptr<symbolizer>& symbol)
{ {
symbols_.push_back(symbol); symbols_.push_back(symbol);
} }
@ -58,7 +58,7 @@ namespace mapnik
return *this; return *this;
} }
void add(const ref_ptr<symbolizer>& symbol) void add(const boost::shared_ptr<symbolizer>& symbol)
{ {
symbols_.push_back(symbol); symbols_.push_back(symbol);
} }

View file

@ -22,7 +22,6 @@
#define STYLE_CACHE_HPP #define STYLE_CACHE_HPP
#include "utils.hpp" #include "utils.hpp"
#include "ptr.hpp"
#include "style.hpp" #include "style.hpp"
#include <map> #include <map>
#include "feature_type_style.hpp" #include "feature_type_style.hpp"

View file

@ -39,8 +39,8 @@ namespace mapnik
std::string fontName_; std::string fontName_;
public: public:
TextRasterizer(PixBuffer& pixbuf,const char* fontName) TextRasterizer(PixBuffer& pixbuf,const char* fontName)
:pixbuf_(&pixbuf), : pixbuf_(&pixbuf),
fontName_(fontName) {} fontName_(fontName) {}
void render(const char* text); void render(const char* text);
private: private:
TextRasterizer(const TextRasterizer&); TextRasterizer(const TextRasterizer&);

View file

@ -45,11 +45,10 @@ namespace mapnik
} }
private: private:
expression<FeatureT>* label_; expression<FeatureT>* label_;
fill fill_; fill fill_;
private: private:
text_symbolizer(const text_symbolizer&); text_symbolizer(text_symbolizer const&);
text_symbolizer& operator=(const text_symbolizer&); text_symbolizer& operator=(text_symbolizer const&);
}; };
} }

View file

@ -93,8 +93,8 @@ mapnik_python_src=Split(
headers =[ '#include',boost_root,freetype2_root,agg_headers,python_headers] headers =[ '#include',boost_root,freetype2_root,agg_headers,python_headers]
libraries=['mapnik','agg','boost-filesystem','boost-regex','boost-python'] libraries=['mapnik','boost-python']
libpaths = [prefix+"/lib",'#agg'] libpaths = [prefix+"/lib"]
_mapnik_python = env.PythonExtension(target='_mapnik',\ _mapnik_python = env.PythonExtension(target='_mapnik',\
source=mapnik_python_src,\ source=mapnik_python_src,\

View file

@ -27,31 +27,6 @@
using namespace mapnik; using namespace mapnik;
namespace boost
{
namespace python
{
template <typename T,
template <typename T> class DeallocPolicy>
T* get_pointer(ref_ptr< T , DeallocPolicy> const& ptr)
{
return ( T* )ptr.get();
}
template <typename T>
struct pointee<ref_ptr<T> >
{
typedef T type;
};
template <> struct pointee<ref_ptr<datasource,datasource_delete> >
{
typedef datasource type;
};
}
}
void export_color(); void export_color();
void export_layer(); void export_layer();
void export_parameters(); void export_parameters();
@ -78,36 +53,36 @@ void render(const Map& map,Image32& image)
} }
ref_ptr<symbolizer> create_point_symbolizer(std::string const& file,unsigned w,unsigned h) boost::shared_ptr<symbolizer> create_point_symbolizer(std::string const& file,unsigned w,unsigned h)
{ {
return ref_ptr<symbolizer>(new image_symbolizer(file,"png",w,h)); return boost::shared_ptr<symbolizer>(new image_symbolizer(file,"png",w,h));
} }
ref_ptr<symbolizer> create_line_symbolizer(const Color& pen,float width) boost::shared_ptr<symbolizer> create_line_symbolizer(const Color& pen,float width)
{ {
return ref_ptr<symbolizer>(new line_symbolizer(pen,width)); return boost::shared_ptr<symbolizer>(new line_symbolizer(pen,width));
} }
ref_ptr<symbolizer> create_line_symbolizer2(stroke const& strk) boost::shared_ptr<symbolizer> create_line_symbolizer2(stroke const& strk)
{ {
return ref_ptr<symbolizer>(new line_symbolizer(strk)); return boost::shared_ptr<symbolizer>(new line_symbolizer(strk));
} }
ref_ptr<symbolizer> create_polygon_symbolizer(const Color& fill) boost::shared_ptr<symbolizer> create_polygon_symbolizer(const Color& fill)
{ {
return ref_ptr<symbolizer>(new polygon_symbolizer(fill)); return boost::shared_ptr<symbolizer>(new polygon_symbolizer(fill));
} }
ref_ptr<symbolizer> create_polygon_symbolizer2(std::string const& file,unsigned w,unsigned h) boost::shared_ptr<symbolizer> create_polygon_symbolizer2(std::string const& file,unsigned w,unsigned h)
{ {
return ref_ptr<symbolizer>(new pattern_symbolizer(file,"png",w,h)); return boost::shared_ptr<symbolizer>(new pattern_symbolizer(file,"png",w,h));
} }
BOOST_PYTHON_MODULE(_mapnik) BOOST_PYTHON_MODULE(_mapnik)
{ {
using namespace boost::python; using namespace boost::python;
class_<datasource,ref_ptr<datasource,datasource_delete>, class_<datasource,boost::shared_ptr<datasource>,
boost::noncopyable>("datasource",no_init) boost::noncopyable>("datasource",no_init)
.def("envelope",&datasource::envelope, .def("envelope",&datasource::envelope,
return_value_policy<reference_existing_object>()) return_value_policy<reference_existing_object>())
@ -115,7 +90,7 @@ BOOST_PYTHON_MODULE(_mapnik)
class_<symbolizer,boost::noncopyable> ("symbolizer_",no_init) class_<symbolizer,boost::noncopyable> ("symbolizer_",no_init)
; ;
class_<ref_ptr<symbolizer,mapnik::DefaultDeletePolicy>, class_<boost::shared_ptr<symbolizer>,
boost::noncopyable>("symbolizer",no_init) boost::noncopyable>("symbolizer",no_init)
; ;
export_parameters(); export_parameters();
@ -144,6 +119,6 @@ BOOST_PYTHON_MODULE(_mapnik)
def("line_symbolizer",&create_line_symbolizer2); def("line_symbolizer",&create_line_symbolizer2);
def("polygon_symbolizer",&create_polygon_symbolizer); def("polygon_symbolizer",&create_polygon_symbolizer);
def("polygon_symbolizer",&create_polygon_symbolizer2); def("polygon_symbolizer",&create_polygon_symbolizer2);
register_ptr_to_python<ref_ptr<symbolizer> >(); register_ptr_to_python<boost::shared_ptr<symbolizer> >();
register_ptr_to_python<filter_ptr>(); register_ptr_to_python<filter_ptr>();
} }

View file

@ -20,7 +20,7 @@
#edit this file #edit this file
PREFIX = '/opt/mapnik' PREFIX = '/opt/mapnik'
BOOST_ROOT = '/opt/boost/boost_1_33_1' BOOST_ROOT = '/opt/boost/boost_1_33_1'
FREETYPE2_ROOT = '/usr/include/freetype2' FREETYPE2_ROOT = '/opt/freetype'
PYTHON_VERSION = '2.4' PYTHON_VERSION = '2.4'
PYTHON_ROOT = '/opt/python' PYTHON_ROOT = '/opt/python'
AGG_ROOT = '/opt/agg-2.4' AGG_ROOT = '/opt/agg-2.4'

View file

@ -39,16 +39,16 @@ namespace mapnik
lt_dlexit(); lt_dlexit();
} }
std::map<string,ref_ptr<PluginInfo> > datasource_cache::plugins_; std::map<string,boost::shared_ptr<PluginInfo> > datasource_cache::plugins_;
bool datasource_cache::registered_=false; bool datasource_cache::registered_=false;
datasource_p datasource_cache::create(const Parameters& params) datasource_p datasource_cache::create(const Parameters& params)
{ {
datasource *ds=0; datasource_p ds;
try try
{ {
std::string type=params.get("type"); std::string type=params.get("type");
map<string,ref_ptr<PluginInfo> >::iterator itr=plugins_.find(type); map<string,boost::shared_ptr<PluginInfo> >::iterator itr=plugins_.find(type);
if (itr!=plugins_.end()) if (itr!=plugins_.end())
{ {
if (itr->second->handle()) if (itr->second->handle())
@ -60,7 +60,7 @@ namespace mapnik
} }
else else
{ {
ds=create_datasource(params); ds=datasource_p(create_datasource(params),datasource_deleter());
} }
} }
else else
@ -78,12 +78,12 @@ namespace mapnik
{ {
std::cerr<<"exception caught "<<std::endl; std::cerr<<"exception caught "<<std::endl;
} }
return ref_ptr<datasource,datasource_delete>(ds); return ds;
} }
bool datasource_cache::insert(const std::string& type,const lt_dlhandle module) bool datasource_cache::insert(const std::string& type,const lt_dlhandle module)
{ {
return plugins_.insert(make_pair(type,ref_ptr<PluginInfo>(new PluginInfo(type,module)))).second; return plugins_.insert(make_pair(type,boost::shared_ptr<PluginInfo>(new PluginInfo(type,module)))).second;
} }
void datasource_cache::register_datasources(const std::string& str) void datasource_cache::register_datasources(const std::string& str)

View file

@ -19,7 +19,6 @@
//$Id: layer.cpp 17 2005-03-08 23:58:43Z pavlenko $ //$Id: layer.cpp 17 2005-03-08 23:58:43Z pavlenko $
#include <string> #include <string>
#include "ptr.hpp"
#include "style.hpp" #include "style.hpp"
#include "datasource.hpp" #include "datasource.hpp"
#include "datasource_cache.hpp" #include "datasource_cache.hpp"
@ -41,17 +40,14 @@ namespace mapnik
try try
{ {
name_=params_.get("name"); name_=params_.get("name");
//volatile datasource_cache* factory=datasource_cache::instance();
//ds_=factory->create(params_);
ds_=datasource_cache::instance()->create(params_); ds_=datasource_cache::instance()->create(params_);
} }
catch (...) catch (...)
{ {
throw; throw;
} }
} }
Layer::Layer(const Layer& rhs) Layer::Layer(const Layer& rhs)
:params_(rhs.params_), :params_(rhs.params_),
name_(rhs.name_), name_(rhs.name_),
@ -177,12 +173,12 @@ namespace mapnik
return selection_style_; return selection_style_;
} }
void Layer::add_to_selection(ref_ptr<Feature>& feature) const void Layer::add_to_selection(shared_ptr<Feature>& feature) const
{ {
selection_.push_back(feature); selection_.push_back(feature);
} }
vector<ref_ptr<Feature> >& Layer::selection() const vector<shared_ptr<Feature> >& Layer::selection() const
{ {
return selection_; return selection_;
} }

View file

@ -22,5 +22,5 @@
namespace mapnik namespace mapnik
{ {
ref_ptr<symbolizer> Style::zero_symbol_=ref_ptr<symbolizer>(0); boost::shared_ptr<symbolizer> Style::zero_symbol_ = boost::shared_ptr<symbolizer>();
} }

View file

@ -49,7 +49,7 @@ namespace mapnik
{ {
return itr->second; return itr->second;
} }
static const Style default_style(ref_ptr<symbolizer>(new line_symbolizer(Color(255,0,0)))); static const Style default_style(boost::shared_ptr<symbolizer>(new line_symbolizer(Color(255,0,0))));
return default_style; return default_style;
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////