diff options
author | David Sorber <david.sorber@blacklynx.tech> | 2021-08-30 08:41:45 -0400 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-10-25 11:27:01 -0400 |
commit | 0c08ee00da21f48d30273338b2c62aacbc912eff (patch) | |
tree | d13fd9c9d810990b76d6a289f7acc95c857c4d0b | |
parent | f3c558d88bc68d865f823c31e7d9aa78b3feab59 (diff) |
runtime: use std::function for callback logic
Signed-off-by: David Sorber <david.sorber@blacklynx.tech>
4 files changed, 9 insertions, 9 deletions
diff --git a/gnuradio-runtime/include/gnuradio/buffer.h b/gnuradio-runtime/include/gnuradio/buffer.h index 96daf3adcd..4b3fc55cf8 100644 --- a/gnuradio-runtime/include/gnuradio/buffer.h +++ b/gnuradio-runtime/include/gnuradio/buffer.h @@ -20,6 +20,7 @@ #include <gnuradio/thread/thread.h> #include <boost/weak_ptr.hpp> +#include <functional> #include <iostream> #include <map> #include <memory> @@ -33,8 +34,7 @@ class buffer_reader_sm; enum class buffer_mapping_type { double_mapped, single_mapped }; -typedef void* (*memcpy_func_t)(void* dest, const void* src, std::size_t count); -typedef void* (*memmove_func_t)(void* dest, const void* src, std::size_t count); +typedef std::function<void*(void*, const void*, std::size_t)> mem_func_t; /*! * \brief Allocate a buffer that holds at least \p nitems of size \p sizeof_item. diff --git a/gnuradio-runtime/include/gnuradio/buffer_single_mapped.h b/gnuradio-runtime/include/gnuradio/buffer_single_mapped.h index 3b2edc0aef..d20ab742ac 100644 --- a/gnuradio-runtime/include/gnuradio/buffer_single_mapped.h +++ b/gnuradio-runtime/include/gnuradio/buffer_single_mapped.h @@ -175,8 +175,8 @@ protected: int items_avail, unsigned read_index, char* buffer_ptr, - memcpy_func_t memcpy_func, - memmove_func_t memmove_func); + mem_func_t const& memcpy_func, + mem_func_t const& memmove_func); /*! * \brief Abstracted logic for the output blocked callback function. @@ -204,7 +204,7 @@ protected: virtual bool output_blocked_callback_logic(int output_multiple, bool force, char* buffer_ptr, - memmove_func_t memmove_func); + mem_func_t const& memmove_func); }; } /* namespace gr */ diff --git a/gnuradio-runtime/lib/buffer_single_mapped.cc b/gnuradio-runtime/lib/buffer_single_mapped.cc index db7959c5b4..56d52344d8 100644 --- a/gnuradio-runtime/lib/buffer_single_mapped.cc +++ b/gnuradio-runtime/lib/buffer_single_mapped.cc @@ -269,8 +269,8 @@ bool buffer_single_mapped::input_blocked_callback_logic(int items_required, int items_avail, unsigned read_index, char* buffer_ptr, - memcpy_func_t memcpy_func, - memmove_func_t memmove_func) + mem_func_t const& memcpy_func, + mem_func_t const& memmove_func) { #ifdef BUFFER_DEBUG std::ostringstream msg; @@ -357,7 +357,7 @@ bool buffer_single_mapped::input_blocked_callback_logic(int items_required, bool buffer_single_mapped::output_blocked_callback_logic(int output_multiple, bool force, char* buffer_ptr, - memmove_func_t memmove_func) + mem_func_t const& memmove_func) { uint32_t space_avail = space_available(); diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc index 4a991397be..9d79d0ac2a 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc @@ -14,7 +14,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(buffer.h) */ -/* BINDTOOL_HEADER_FILE_HASH(e34c34f70f65bbc7dfbc45adcadf7796) */ +/* BINDTOOL_HEADER_FILE_HASH(c1b5cc864cfbb6dd9c9f3bf41f36c6ba) */ /***********************************************************************************/ #include <pybind11/complex.h> |