diff options
Diffstat (limited to 'gruel/src/swig')
-rw-r--r-- | gruel/src/swig/CMakeLists.txt | 6 | ||||
-rw-r--r-- | gruel/src/swig/pmt_swig.i | 50 |
2 files changed, 24 insertions, 32 deletions
diff --git a/gruel/src/swig/CMakeLists.txt b/gruel/src/swig/CMakeLists.txt index a5e3f9399..aeceaa605 100644 --- a/gruel/src/swig/CMakeLists.txt +++ b/gruel/src/swig/CMakeLists.txt @@ -24,7 +24,11 @@ include(GrPython) include(GrSwig) set(GR_SWIG_TARGET_DEPS pmt_generated) -set(GR_SWIG_INCLUDE_DIRS ${GRUEL_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ${Boost_INCLUDE_DIRS}) +set(GR_SWIG_INCLUDE_DIRS + ${CMAKE_CURRENT_BINARY_DIR} + ${GRUEL_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} +) set(GR_SWIG_LIBRARIES gruel) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i) diff --git a/gruel/src/swig/pmt_swig.i b/gruel/src/swig/pmt_swig.i index b65857167..84f48b099 100644 --- a/gruel/src/swig/pmt_swig.i +++ b/gruel/src/swig/pmt_swig.i @@ -212,6 +212,8 @@ bool pmt_is_complex(pmt_t obj); //! Return a complex number constructed of the given real and imaginary parts. pmt_t pmt_make_rectangular(double re, double im); +pmt_t pmt_from_complex(const std::complex<double> &z); + /*! * If \p z is complex, real or integer, return the closest complex<double>. * Otherwise, raise the wrong_type exception. @@ -441,37 +443,23 @@ void pmt_c64vector_set(pmt_t v, size_t k, std::complex<double> x); // Return const pointers to the elements -const void *pmt_uniform_vector_elements(pmt_t v, size_t &len); //< works with any; len is in bytes - -const uint8_t *pmt_u8vector_elements(pmt_t v, size_t &len); //< len is in elements -const int8_t *pmt_s8vector_elements(pmt_t v, size_t &len); //< len is in elements -const uint16_t *pmt_u16vector_elements(pmt_t v, size_t &len); //< len is in elements -const int16_t *pmt_s16vector_elements(pmt_t v, size_t &len); //< len is in elements -const uint32_t *pmt_u32vector_elements(pmt_t v, size_t &len); //< len is in elements -const int32_t *pmt_s32vector_elements(pmt_t v, size_t &len); //< len is in elements -const uint64_t *pmt_u64vector_elements(pmt_t v, size_t &len); //< len is in elements -const int64_t *pmt_s64vector_elements(pmt_t v, size_t &len); //< len is in elements -const float *pmt_f32vector_elements(pmt_t v, size_t &len); //< len is in elements -const double *pmt_f64vector_elements(pmt_t v, size_t &len); //< len is in elements -const std::complex<float> *pmt_c32vector_elements(pmt_t v, size_t &len); //< len is in elements -const std::complex<double> *pmt_c64vector_elements(pmt_t v, size_t &len); //< len is in elements - -// Return non-const pointers to the elements - -void *pmt_uniform_vector_writable_elements(pmt_t v, size_t &len); //< works with any; len is in bytes - -uint8_t *pmt_u8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int8_t *pmt_s8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -uint16_t *pmt_u16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int16_t *pmt_s16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -uint32_t *pmt_u32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int32_t *pmt_s32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -uint64_t *pmt_u64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int64_t *pmt_s64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -float *pmt_f32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -double *pmt_f64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -std::complex<float> *pmt_c32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -std::complex<double> *pmt_c64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +%apply size_t & INOUT { size_t &len }; + +// works with any; len is in bytes +// Returns an opaque Python type +const void *pmt_uniform_vector_elements(pmt_t v, size_t &len); + +// Returns a Python tuple +const std::vector<uint8_t> pmt_u8vector_elements(pmt_t v); +const std::vector<int8_t> pmt_s8vector_elements(pmt_t v); +const std::vector<uint16_t> pmt_u16vector_elements(pmt_t v); +const std::vector<int16_t> pmt_s16vector_elements(pmt_t v); +const std::vector<uint32_t> pmt_u32vector_elements(pmt_t v); +const std::vector<int32_t> pmt_s32vector_elements(pmt_t v); +const std::vector<float> pmt_f32vector_elements(pmt_t v); +const std::vector<double> pmt_f64vector_elements(pmt_t v); +const std::vector<std::complex<float> > pmt_c32vector_elements(pmt_t v); +const std::vector<std::complex<double> > pmt_c64vector_elements(pmt_t v); /* * ------------------------------------------------------------------------ |