== Boost.Python std::shared_ptr ==

+ ensure mapnik::memory_datasource is wrapped in std::shared_ptr in Python bindings
+ register implicit conversion from std::shared_ptr<memory_datasource> to std::shared_pre<datasource>

ref #2020
This commit is contained in:
artemp 2013-10-01 14:44:54 +01:00
parent ecc2b39865
commit a3c329a6f8

View file

@ -190,7 +190,9 @@ void export_datasource()
def("CreateDatasource",&create_datasource); def("CreateDatasource",&create_datasource);
class_<memory_datasource, bases<datasource>, boost::noncopyable>("MemoryDatasource", init<>()) class_<memory_datasource,
bases<datasource>, std::shared_ptr<memory_datasource>,
boost::noncopyable>("MemoryDatasource", init<>())
.def("add_feature",&memory_datasource::push, .def("add_feature",&memory_datasource::push,
"Adds a Feature:\n" "Adds a Feature:\n"
">>> ms = MemoryDatasource()\n" ">>> ms = MemoryDatasource()\n"
@ -198,4 +200,6 @@ void export_datasource()
">>> ms.add_feature(Feature(1))\n") ">>> ms.add_feature(Feature(1))\n")
.def("num_features",&memory_datasource::size) .def("num_features",&memory_datasource::size)
; ;
implicitly_convertible<std::shared_ptr<memory_datasource>,std::shared_ptr<datasource> >();
} }