== 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:
parent
ecc2b39865
commit
a3c329a6f8
1 changed files with 5 additions and 1 deletions
|
@ -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> >();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue