@@ -6,6 +6,7 @@ from types import SimpleNamespace
66
77from cpython.ref cimport Py_DECREF
88from libcpp cimport bool
9+ from libcpp.memory cimport make_shared, shared_ptr
910from libcpp.string cimport string
1011from libcpp.vector cimport vector
1112
@@ -72,7 +73,7 @@ def infer_writer_driver(driver):
7273
7374cdef extern from " PyArray.hpp" namespace " pdal::python" :
7475 cdef cppclass Array:
75- Array(np.ndarray ) except +
76+ Array(np.PyArrayObject * ) except +
7677
7778
7879cdef extern from " pdal/PipelineExecutor.hpp" namespace " pdal" :
@@ -91,14 +92,14 @@ cdef extern from "pdal/PipelineExecutor.hpp" namespace "pdal":
9192
9293cdef extern from " PyPipeline.hpp" namespace " pdal::python" :
9394 void readPipeline(PipelineExecutor* , string) except +
94- void addArrayReaders(PipelineExecutor* , vector[Array * ]) except +
95+ void addArrayReaders(PipelineExecutor* , vector[shared_ptr[ Array] ]) except +
9596 vector[np.PyArrayObject* ] getArrays(const PipelineExecutor* ) except +
9697 vector[np.PyArrayObject* ] getMeshes(const PipelineExecutor* ) except +
9798
9899
99100cdef class Pipeline:
100101 cdef PipelineExecutor* _executor
101- cdef vector[Array* ] _inputs
102+ cdef vector[shared_ptr[ Array] ] _inputs
102103
103104 def __dealloc__ (self ):
104105 self .inputs = []
@@ -116,7 +117,7 @@ cdef class Pipeline:
116117 def inputs (self , ndarrays ):
117118 self ._inputs.clear()
118119 for ndarray in ndarrays:
119- self ._inputs.push_back(new Array( ndarray))
120+ self ._inputs.push_back(make_shared[ Array]( < np.PyArrayObject * > ndarray))
120121 self ._delete_executor()
121122
122123 @property
0 commit comments