merge ranges.pyx + array.pyx -> base.pyx

This commit is contained in:
Christian Zimmermann 2023-05-07 21:45:41 +02:00
parent 33f7b0322d
commit e26a1622da
4 changed files with 20 additions and 13 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
build/
cnorxz.egg-info/
*.so
*.cpp

View File

@ -1,11 +0,0 @@
from libcpp.memory cimport shared_ptr, make_shared, dynamic_pointer_cast
from array cimport cpp_CArrayBase
cdef class Array:
cdef shared_ptr[cpp_CArrayBase[double]] cpp_array
def size(self):
return self.cpp_array.get().size()

View File

@ -2,6 +2,12 @@
from libcpp.memory cimport shared_ptr, make_shared, dynamic_pointer_cast
from range cimport cpp_RangeBase
from range_factory cimport cpp_RangeFactoryBase, cpp_CRangeFactory
from array cimport cpp_CArrayBase
## ============
## Range
## ============
cdef class Range:
cdef shared_ptr[cpp_RangeBase] cpp_range
@ -29,4 +35,16 @@ cdef class RangeFactory:
r = Range()
r.cpp_range = self.cpp_rfactory.get().create()
return r
## ===========
## Array
## ===========
cdef class Array:
cdef shared_ptr[cpp_CArrayBase[double]] cpp_array
def size(self):
return self.cpp_array.get().size()

View File

@ -58,8 +58,7 @@ if __name__ == "__main__":
setuptools.Extension(
name = libname + ".base",
sources = [
"cnorxz/base/ranges.pyx",
#"cnorxz/base/array.pyx",
"cnorxz/base/base.pyx",
],
**default_extension_args
)