Skip to content

Commit

Permalink
refactor Python extension to use new PyArray.hpp header
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Jun 19, 2017
1 parent 1f233eb commit 1608bae
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 77 deletions.
9 changes: 5 additions & 4 deletions plugins/python/plang/Array.hpp → pdal/PyArray.hpp
Expand Up @@ -47,14 +47,15 @@
#undef tolower
#undef isspace


#ifndef PY_ARRAY_UNIQUE_SYMBOL
#define PY_ARRAY_UNIQUE_SYMBOL PDALARRAY_ARRAY_API
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#endif

#include <numpy/arrayobject.h>

namespace pdal
{
namespace plang
namespace python
{


Expand Down Expand Up @@ -212,6 +213,6 @@ class PDAL_DLL Array
Array& operator=(Array const& rhs);
};

} // namespace plang
} // namespace python
} // namespace pdal

65 changes: 0 additions & 65 deletions plugins/python/plang/Array.cpp

This file was deleted.

1 change: 0 additions & 1 deletion plugins/python/plang/CMakeLists.txt
@@ -1,6 +1,5 @@

set(plang_srcs
Array.cpp
Invocation.cpp
Environment.cpp
Redirector.cpp
Expand Down
4 changes: 2 additions & 2 deletions plugins/python/test/PythonFilterTest.cpp
Expand Up @@ -40,7 +40,7 @@
#include <filters/StatsFilter.hpp>

#include "../plang/Invocation.hpp"
#include "../plang/Array.hpp"
#include <pdal/PyArray.hpp>
#include "../plang/Environment.hpp"

#include <pdal/StageWrapper.hpp>
Expand Down Expand Up @@ -993,7 +993,7 @@ TEST(PLangTest, PLangTest_array)
PointTable table;
PointViewPtr view = makeTestView(table, 40);

plang::Array array;
python::Array array;
array.update(view);
verifyTestView(*view.get(), 4);

Expand Down
2 changes: 1 addition & 1 deletion python/pdal/PyPipeline.cpp
Expand Up @@ -91,7 +91,7 @@ std::vector<PArray> Pipeline::getArrays() const

for (auto i: pvset)
{
PArray array = new pdal::plang::Array;
PArray array = new pdal::python::Array;
array->update(i);
output.push_back(array);
}
Expand Down
6 changes: 4 additions & 2 deletions python/pdal/PyPipeline.hpp
Expand Up @@ -37,7 +37,7 @@
#include <pdal/PipelineManager.hpp>
#include <pdal/PipelineWriter.hpp>
#include <pdal/util/FileUtils.hpp>
#include <pdal/plang/Array.hpp>
#include <pdal/PyArray.hpp>
#include <pdal/PipelineExecutor.hpp>

#include <string>
Expand All @@ -46,7 +46,9 @@
#undef tolower
#undef isspace

#ifndef PY_ARRAY_UNIQUE_SYMBOL
#define PY_ARRAY_UNIQUE_SYMBOL LIBPDALPYTHON_ARRAY_API
#endif

#include <numpy/arrayobject.h>

Expand All @@ -61,7 +63,7 @@ class python_error : public std::runtime_error
{}
};

typedef pdal::plang::Array* PArray;
typedef pdal::python::Array* PArray;

class Pipeline {
public:
Expand Down
2 changes: 1 addition & 1 deletion python/pdal/libpdalpython.pyx
Expand Up @@ -12,7 +12,7 @@ from cpython cimport PyObject, Py_INCREF
from cython.operator cimport dereference as deref, preincrement as inc


cdef extern from "pdal/plang/Array.hpp" namespace "pdal::plang":
cdef extern from "pdal/PyArray.hpp" namespace "pdal::python":
cdef cppclass Array:
void* getPythonArray() except+

Expand Down
1 change: 0 additions & 1 deletion python/setup.py
Expand Up @@ -145,7 +145,6 @@ def get_pdal_config(option):

include_dirs.append(numpy.get_include())
extra_compile_args = ['-std=c++11',]
libraries.append('pdal_plang')

DEBUG=False
if DEBUG:
Expand Down

0 comments on commit 1608bae

Please sign in to comment.