summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-runtime/include/gnuradio/CMakeLists.txt2
-rw-r--r--gnuradio-runtime/include/gnuradio/buffer.h28
-rw-r--r--gnuradio-runtime/include/gnuradio/buffer_double_mapped.h4
-rw-r--r--gnuradio-runtime/include/gnuradio/buffer_reader_sm.h1
-rw-r--r--gnuradio-runtime/include/gnuradio/buffer_type.h2
-rw-r--r--gnuradio-runtime/include/gnuradio/host_buffer.h2
-rw-r--r--gnuradio-runtime/include/gnuradio/transfer_type.h (renamed from gnuradio-runtime/include/gnuradio/buffer_context.h)8
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt2
-rw-r--r--gnuradio-runtime/lib/buffer.cc18
-rw-r--r--gnuradio-runtime/lib/buffer_context.cc32
-rw-r--r--gnuradio-runtime/lib/flat_flowgraph.cc18
-rw-r--r--gnuradio-runtime/lib/host_buffer.cc60
-rw-r--r--gnuradio-runtime/lib/qa_host_buffer.cc14
-rw-r--r--gnuradio-runtime/lib/transfer_type.cc32
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc2
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/bindings/buffer_type_python.cc2
16 files changed, 117 insertions, 110 deletions
diff --git a/gnuradio-runtime/include/gnuradio/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/CMakeLists.txt
index b45b84e4fa..406bfd32d2 100644
--- a/gnuradio-runtime/include/gnuradio/CMakeLists.txt
+++ b/gnuradio-runtime/include/gnuradio/CMakeLists.txt
@@ -20,7 +20,6 @@ install(FILES
block_gateway.h
block_registry.h
buffer.h
- buffer_context.h
buffer_double_mapped.h
buffer_reader.h
buffer_reader_sm.h
@@ -57,6 +56,7 @@ install(FILES
tagged_stream_block.h
top_block.h
tpb_detail.h
+ transfer_type.h
sincos.h
sptr_magic.h
sync_block.h
diff --git a/gnuradio-runtime/include/gnuradio/buffer.h b/gnuradio-runtime/include/gnuradio/buffer.h
index 4b3fc55cf8..092994eae8 100644
--- a/gnuradio-runtime/include/gnuradio/buffer.h
+++ b/gnuradio-runtime/include/gnuradio/buffer.h
@@ -12,12 +12,12 @@
#define INCLUDED_GR_RUNTIME_BUFFER_H
#include <gnuradio/api.h>
-#include <gnuradio/buffer_context.h>
#include <gnuradio/custom_lock.h>
#include <gnuradio/logger.h>
#include <gnuradio/runtime_types.h>
#include <gnuradio/tags.h>
#include <gnuradio/thread/thread.h>
+#include <gnuradio/transfer_type.h>
#include <boost/weak_ptr.hpp>
#include <functional>
@@ -139,7 +139,7 @@ public:
uint32_t get_max_reader_output_multiple() { return d_max_reader_output_multiple; }
- virtual void update_reader_block_history(unsigned history, int delay)
+ virtual void update_reader_block_history(unsigned history, [[maybe_unused]] int delay)
{
d_max_reader_history = std::max(d_max_reader_history, history);
d_has_history = (d_max_reader_history > 1);
@@ -198,7 +198,8 @@ public:
* false otherwise. Note if input_blocked_callback is overridden then this
* function should also be overridden.
*/
- virtual bool input_blkd_cb_ready(int items_required, unsigned read_index)
+ virtual bool input_blkd_cb_ready([[maybe_unused]] int items_required,
+ [[maybe_unused]] unsigned read_index)
{
return false;
}
@@ -207,8 +208,9 @@ public:
* \brief Callback function that the scheduler will call when it determines
* that the input is blocked. Override this function if needed.
*/
- virtual bool
- input_blocked_callback(int items_required, int items_avail, unsigned read_index)
+ virtual bool input_blocked_callback([[maybe_unused]] int items_required,
+ [[maybe_unused]] int items_avail,
+ [[maybe_unused]] unsigned read_index)
{
return false;
}
@@ -219,13 +221,17 @@ public:
* output_blocked_callback is overridden this function should also be
* overridden.
*/
- virtual bool output_blkd_cb_ready(int output_multiple) { return false; }
+ virtual bool output_blkd_cb_ready([[maybe_unused]] int output_multiple)
+ {
+ return false;
+ }
/*!
* \brief Callback function that the scheduler will call when it determines
* that the output is blocked. Override this function if needed.
*/
- virtual bool output_blocked_callback(int output_multiple, bool force = false)
+ virtual bool output_blocked_callback([[maybe_unused]] int output_multiple,
+ [[maybe_unused]] bool force = false)
{
return false;
}
@@ -268,9 +274,9 @@ public:
// -------------------------------------------------------------------------
/*!
- * \brief Assign buffer context
+ * \brief Assign buffer's transfer_type
*/
- void set_context(const buffer_context& context);
+ void set_transfer_type(const transfer_type& type);
private:
friend class buffer_reader;
@@ -324,7 +330,7 @@ protected:
uint64_t d_write_multiple;
uint32_t d_max_reader_output_multiple;
- buffer_context d_context;
+ transfer_type d_transfer_type;
/*!
* \brief Increment read or write index for this buffer
@@ -336,7 +342,7 @@ protected:
*/
virtual unsigned index_sub(unsigned a, unsigned b) = 0;
- virtual bool allocate_buffer(int nitems) { return false; };
+ virtual bool allocate_buffer([[maybe_unused]] int nitems) { return false; };
/*!
* \brief constructor is private. Use gr_make_buffer to create instances.
diff --git a/gnuradio-runtime/include/gnuradio/buffer_double_mapped.h b/gnuradio-runtime/include/gnuradio/buffer_double_mapped.h
index e23432bb13..d4bfa28ff4 100644
--- a/gnuradio-runtime/include/gnuradio/buffer_double_mapped.h
+++ b/gnuradio-runtime/include/gnuradio/buffer_double_mapped.h
@@ -33,7 +33,7 @@ GR_RUNTIME_API buffer_sptr make_buffer_double_mapped(int nitems,
block_sptr link = block_sptr(),
block_sptr buf_owner = block_sptr());
-MAKE_CUSTOM_BUFFER_TYPE(DEFAULT_NON_CUSTOM, make_buffer_double_mapped);
+DEFINE_CUSTOM_BUFFER_TYPE(DEFAULT_NON_CUSTOM, make_buffer_double_mapped);
/*!
* \brief Single writer, multiple reader fifo.
@@ -58,7 +58,7 @@ public:
* Inherited from buffer class.
* @param nitems is the number of items produced by the general_work() function.
*/
- virtual void post_work(int nitems) {}
+ virtual void post_work([[maybe_unused]] int nitems) {}
protected:
/*!
diff --git a/gnuradio-runtime/include/gnuradio/buffer_reader_sm.h b/gnuradio-runtime/include/gnuradio/buffer_reader_sm.h
index 7e203c93b7..a60c5d6a7f 100644
--- a/gnuradio-runtime/include/gnuradio/buffer_reader_sm.h
+++ b/gnuradio-runtime/include/gnuradio/buffer_reader_sm.h
@@ -49,7 +49,6 @@ public:
private:
friend class buffer;
- friend class buffer_double_mapped;
friend class buffer_single_mapped;
friend GR_RUNTIME_API buffer_reader_sptr buffer_add_reader(buffer_sptr buf,
diff --git a/gnuradio-runtime/include/gnuradio/buffer_type.h b/gnuradio-runtime/include/gnuradio/buffer_type.h
index 3d69f72ca6..b304899750 100644
--- a/gnuradio-runtime/include/gnuradio/buffer_type.h
+++ b/gnuradio-runtime/include/gnuradio/buffer_type.h
@@ -106,7 +106,7 @@ protected:
typedef const buffer_type_base& buffer_type;
typedef std::vector<std::reference_wrapper<const buffer_type_base>> gr_vector_buffer_type;
-#define MAKE_CUSTOM_BUFFER_TYPE(CLASSNAME, FACTORY_FUNC_PTR) \
+#define DEFINE_CUSTOM_BUFFER_TYPE(CLASSNAME, FACTORY_FUNC_PTR) \
class GR_RUNTIME_API buftype_##CLASSNAME : public buffer_type_base \
{ \
public: \
diff --git a/gnuradio-runtime/include/gnuradio/host_buffer.h b/gnuradio-runtime/include/gnuradio/host_buffer.h
index 83f46d2e85..ac09cdfe33 100644
--- a/gnuradio-runtime/include/gnuradio/host_buffer.h
+++ b/gnuradio-runtime/include/gnuradio/host_buffer.h
@@ -119,7 +119,7 @@ private:
// See buffer_type.h for details on this macro. It is used here to generate
// compile-time class representing the host_buffer classes "type".
-MAKE_CUSTOM_BUFFER_TYPE(HOST_BUFFER, &host_buffer::make_host_buffer);
+DEFINE_CUSTOM_BUFFER_TYPE(HOST_BUFFER, &host_buffer::make_host_buffer);
} // namespace gr
diff --git a/gnuradio-runtime/include/gnuradio/buffer_context.h b/gnuradio-runtime/include/gnuradio/transfer_type.h
index 477a3cbd43..ab01ead0b9 100644
--- a/gnuradio-runtime/include/gnuradio/buffer_context.h
+++ b/gnuradio-runtime/include/gnuradio/transfer_type.h
@@ -8,15 +8,15 @@
*
*/
-#ifndef INCLUDED_GR_RUNTIME_BUFFER_CONTEXT_H
-#define INCLUDED_GR_RUNTIME_BUFFER_CONTEXT_H
+#ifndef INCLUDED_GR_RUNTIME_TRANSFER_TYPE_H
+#define INCLUDED_GR_RUNTIME_TRANSFER_TYPE_H
#include <gnuradio/api.h>
#include <ostream>
namespace gr {
-enum class buffer_context {
+enum class transfer_type {
DEFAULT_INVALID,
HOST_TO_DEVICE,
DEVICE_TO_HOST,
@@ -24,7 +24,7 @@ enum class buffer_context {
DEVICE_TO_DEVICE
};
-GR_RUNTIME_API std::ostream& operator<<(std::ostream& os, const buffer_context& context);
+GR_RUNTIME_API std::ostream& operator<<(std::ostream& os, const transfer_type& type);
} // namespace gr
#endif
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index 6fcd31bac4..f91900f5cc 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -55,7 +55,6 @@ add_library(gnuradio-runtime
block_gateway_impl.cc
block_registry.cc
buffer.cc
- buffer_context.cc
buffer_double_mapped.cc
buffer_reader.cc
buffer_reader_sm.cc
@@ -92,6 +91,7 @@ add_library(gnuradio-runtime
top_block_impl.cc
tpb_detail.cc
tpb_thread_body.cc
+ transfer_type.cc
vmcircbuf.cc
vmcircbuf_createfilemapping.cc
vmcircbuf_mmap_shm_open.cc
diff --git a/gnuradio-runtime/lib/buffer.cc b/gnuradio-runtime/lib/buffer.cc
index 75fc447e8d..1f949f4ec9 100644
--- a/gnuradio-runtime/lib/buffer.cc
+++ b/gnuradio-runtime/lib/buffer.cc
@@ -80,7 +80,7 @@ buffer::buffer(buffer_mapping_type buf_type,
d_downstream_lcm_nitems(downstream_lcm_nitems),
d_write_multiple(0),
d_max_reader_output_multiple(downstream_max_out_mult),
- d_context(buffer_context::DEFAULT_INVALID)
+ d_transfer_type(transfer_type::DEFAULT_INVALID)
{
gr::configure_default_loggers(d_logger, d_debug_logger, "buffer");
@@ -256,18 +256,20 @@ std::ostream& operator<<(std::ostream& os, const buffer& buf)
return os;
}
-void buffer::set_context(const buffer_context& context)
+void buffer::set_transfer_type(const transfer_type& type)
{
- if ((d_context == buffer_context::DEFAULT_INVALID) || (d_context == context)) {
- // Set the context if the existing value is the default or if it is the
+ if ((d_transfer_type == transfer_type::DEFAULT_INVALID) ||
+ (d_transfer_type == type)) {
+ // Set the transfer type if the existing value is the default or if it is the
// same as what's already been set
- d_context = context;
+ d_transfer_type = type;
} else {
- // Otherwise error out as the context value cannot be changed after
+ // Otherwise error out as the transfer type value cannot be changed after
// it is set
std::ostringstream msg;
- msg << "Block: " << link()->identifier() << " has context " << d_context
- << " assigned. Cannot change to context " << context << ".";
+ msg << "Block: " << link()->identifier() << " has transfer type "
+ << d_transfer_type << " assigned. Cannot change to transfer type " << type
+ << ".";
GR_LOG_ERROR(d_logger, msg.str());
throw std::runtime_error(msg.str());
}
diff --git a/gnuradio-runtime/lib/buffer_context.cc b/gnuradio-runtime/lib/buffer_context.cc
deleted file mode 100644
index 9cd27add36..0000000000
--- a/gnuradio-runtime/lib/buffer_context.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2021 BlackLynx, Inc.
- *
- * This file is part of GNU Radio
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- *
- */
-#include <gnuradio/buffer_context.h>
-
-namespace gr {
-
-std::ostream& operator<<(std::ostream& os, const buffer_context& context)
-{
- switch (context) {
- case buffer_context::DEFAULT_INVALID:
- return os << "DEFAULT_INVALID";
- case buffer_context::HOST_TO_DEVICE:
- return os << "HOST_TO_DEVICE";
- case buffer_context::DEVICE_TO_HOST:
- return os << "DEVICE_TO_HOST";
- case buffer_context::HOST_TO_HOST:
- return os << "HOST_TO_HOST";
- case buffer_context::DEVICE_TO_DEVICE:
- return os << "DEVICE_TO_DEVICE";
- default:
- return os << "Unknown buffer context: " << static_cast<int>(context);
- }
-}
-
-} // namespace gr
diff --git a/gnuradio-runtime/lib/flat_flowgraph.cc b/gnuradio-runtime/lib/flat_flowgraph.cc
index ef96ef21ac..3856b170d9 100644
--- a/gnuradio-runtime/lib/flat_flowgraph.cc
+++ b/gnuradio-runtime/lib/flat_flowgraph.cc
@@ -201,26 +201,26 @@ void flat_flowgraph::connect_block_inputs(basic_block_sptr block)
if (!src_grblock)
throw std::runtime_error("connect_block_inputs found non-gr::block");
- // In order to determine the buffer context, we need to examine both
+ // In order to determine the buffer's transfer type, we need to examine both
// the upstream and the downstream buffer_types
buffer_type src_buf_type =
src_grblock->output_signature()->stream_buffer_type(src_port);
buffer_type dest_buf_type =
grblock->input_signature()->stream_buffer_type(dst_port);
- buffer_context context;
+ transfer_type buf_xfer_type;
if (src_buf_type == buffer_double_mapped::type &&
dest_buf_type == buffer_double_mapped::type) {
- context = buffer_context::HOST_TO_HOST;
+ buf_xfer_type = transfer_type::HOST_TO_HOST;
} else if (src_buf_type != buffer_double_mapped::type &&
dest_buf_type == buffer_double_mapped::type) {
- context = buffer_context::DEVICE_TO_HOST;
+ buf_xfer_type = transfer_type::DEVICE_TO_HOST;
} else if (src_buf_type == buffer_double_mapped::type &&
dest_buf_type != buffer_double_mapped::type) {
- context = buffer_context::HOST_TO_DEVICE;
+ buf_xfer_type = transfer_type::HOST_TO_DEVICE;
} else if (src_buf_type != buffer_double_mapped::type &&
dest_buf_type != buffer_double_mapped::type) {
- context = buffer_context::DEVICE_TO_DEVICE;
+ buf_xfer_type = transfer_type::DEVICE_TO_DEVICE;
}
buffer_sptr src_buffer;
@@ -255,12 +255,12 @@ void flat_flowgraph::connect_block_inputs(basic_block_sptr block)
}
}
- // Set buffer's context
- src_buffer->set_context(context);
+ // Set buffer's transfer type
+ src_buffer->set_transfer_type(buf_xfer_type);
std::ostringstream msg;
msg << "Setting input " << dst_port << " from edge " << (*e).identifier()
- << " context: " << context;
+ << " transfer type: " << buf_xfer_type;
GR_LOG_DEBUG(d_debug_logger, msg.str());
detail->set_input(dst_port,
diff --git a/gnuradio-runtime/lib/host_buffer.cc b/gnuradio-runtime/lib/host_buffer.cc
index 6e1a1d1003..535a7a5286 100644
--- a/gnuradio-runtime/lib/host_buffer.cc
+++ b/gnuradio-runtime/lib/host_buffer.cc
@@ -55,7 +55,7 @@ void host_buffer::post_work(int nitems)
#ifdef BUFFER_DEBUG
std::ostringstream msg;
msg << "[" << this << "] "
- << "host_buffer [" << d_context << "] -- post_work: " << nitems;
+ << "host_buffer [" << d_transfer_type << "] -- post_work: " << nitems;
GR_LOG_DEBUG(d_logger, msg.str());
#endif
@@ -65,26 +65,26 @@ void host_buffer::post_work(int nitems)
// NOTE: when this function is called the write pointer has not yet been
// advanced so it can be used directly as the source ptr
- switch (d_context) {
- case buffer_context::HOST_TO_DEVICE: {
+ switch (d_transfer_type) {
+ case transfer_type::HOST_TO_DEVICE: {
// Copy data from host buffer to device buffer
void* dest_ptr = &d_device_base[d_write_index * d_sizeof_item];
device_memcpy(dest_ptr, write_pointer(), nitems * d_sizeof_item);
} break;
- case buffer_context::DEVICE_TO_HOST: {
+ case transfer_type::DEVICE_TO_HOST: {
// Copy data from device buffer to host buffer
void* dest_ptr = &d_base[d_write_index * d_sizeof_item];
device_memcpy(dest_ptr, write_pointer(), nitems * d_sizeof_item);
} break;
- case buffer_context::DEVICE_TO_DEVICE:
+ case transfer_type::DEVICE_TO_DEVICE:
// No op
break;
default:
std::ostringstream msg;
- msg << "Unexpected context for host_buffer: " << d_context;
+ msg << "Unexpected transfer type for host_buffer: " << d_transfer_type;
GR_LOG_ERROR(d_logger, msg.str());
throw std::runtime_error(msg.str());
}
@@ -115,21 +115,21 @@ bool host_buffer::do_allocate_buffer(size_t final_nitems, size_t sizeof_item)
void* host_buffer::write_pointer()
{
void* ptr = nullptr;
- switch (d_context) {
- case buffer_context::HOST_TO_DEVICE:
+ switch (d_transfer_type) {
+ case transfer_type::HOST_TO_DEVICE:
// Write into host buffer
ptr = &d_base[d_write_index * d_sizeof_item];
break;
- case buffer_context::DEVICE_TO_HOST:
- case buffer_context::DEVICE_TO_DEVICE:
+ case transfer_type::DEVICE_TO_HOST:
+ case transfer_type::DEVICE_TO_DEVICE:
// Write into "device" buffer
ptr = &d_device_base[d_write_index * d_sizeof_item];
break;
default:
std::ostringstream msg;
- msg << "Unexpected context for host_buffer: " << d_context;
+ msg << "Unexpected transfer type for host_buffer: " << d_transfer_type;
GR_LOG_ERROR(d_logger, msg.str());
throw std::runtime_error(msg.str());
}
@@ -140,21 +140,21 @@ void* host_buffer::write_pointer()
const void* host_buffer::_read_pointer(unsigned int read_index)
{
void* ptr = nullptr;
- switch (d_context) {
- case buffer_context::HOST_TO_DEVICE:
- case buffer_context::DEVICE_TO_DEVICE:
+ switch (d_transfer_type) {
+ case transfer_type::HOST_TO_DEVICE:
+ case transfer_type::DEVICE_TO_DEVICE:
// Read from "device" buffer
ptr = &d_device_base[read_index * d_sizeof_item];
break;
- case buffer_context::DEVICE_TO_HOST:
+ case transfer_type::DEVICE_TO_HOST:
// Read from host buffer
ptr = &d_base[read_index * d_sizeof_item];
break;
default:
std::ostringstream msg;
- msg << "Unexpected context for host_buffer: " << d_context;
+ msg << "Unexpected transfer type for host_buffer: " << d_transfer_type;
GR_LOG_ERROR(d_logger, msg.str());
throw std::runtime_error(msg.str());
}
@@ -169,14 +169,14 @@ bool host_buffer::input_blocked_callback(int items_required,
#ifdef BUFFER_DEBUG
std::ostringstream msg;
msg << "[" << this << "] "
- << "host_buffer [" << d_context << "] -- input_blocked_callback";
+ << "host_buffer [" << d_transfer_type << "] -- input_blocked_callback";
GR_LOG_DEBUG(d_logger, msg.str());
#endif
bool rc = false;
- switch (d_context) {
- case buffer_context::HOST_TO_DEVICE:
- case buffer_context::DEVICE_TO_DEVICE:
+ switch (d_transfer_type) {
+ case transfer_type::HOST_TO_DEVICE:
+ case transfer_type::DEVICE_TO_DEVICE:
// Adjust "device" buffer
rc = input_blocked_callback_logic(items_required,
items_avail,
@@ -186,8 +186,8 @@ bool host_buffer::input_blocked_callback(int items_required,
host_buffer::device_memmove);
break;
- case buffer_context::DEVICE_TO_HOST:
- case buffer_context::HOST_TO_HOST:
+ case transfer_type::DEVICE_TO_HOST:
+ case transfer_type::HOST_TO_HOST:
// Adjust host buffer
rc = input_blocked_callback_logic(
items_required, items_avail, read_index, d_base, std::memcpy, std::memmove);
@@ -195,7 +195,7 @@ bool host_buffer::input_blocked_callback(int items_required,
default:
std::ostringstream msg;
- msg << "Unexpected context for host_buffer: " << d_context;
+ msg << "Unexpected transfer type for host_buffer: " << d_transfer_type;
GR_LOG_ERROR(d_logger, msg.str());
throw std::runtime_error(msg.str());
}
@@ -208,20 +208,20 @@ bool host_buffer::output_blocked_callback(int output_multiple, bool force)
#ifdef BUFFER_DEBUG
std::ostringstream msg;
msg << "[" << this << "] "
- << "host_buffer [" << d_context << "] -- output_blocked_callback";
+ << "host_buffer [" << d_transfer_type << "] -- output_blocked_callback";
GR_LOG_DEBUG(d_logger, msg.str());
#endif
bool rc = false;
- switch (d_context) {
- case buffer_context::HOST_TO_DEVICE:
- case buffer_context::HOST_TO_HOST:
+ switch (d_transfer_type) {
+ case transfer_type::HOST_TO_DEVICE:
+ case transfer_type::HOST_TO_HOST:
// Adjust host buffer
rc = output_blocked_callback_logic(output_multiple, force, d_base, std::memmove);
break;
- case buffer_context::DEVICE_TO_HOST:
- case buffer_context::DEVICE_TO_DEVICE:
+ case transfer_type::DEVICE_TO_HOST:
+ case transfer_type::DEVICE_TO_DEVICE:
// Adjust "device" buffer
rc = output_blocked_callback_logic(
output_multiple, force, d_device_base, host_buffer::device_memmove);
@@ -229,7 +229,7 @@ bool host_buffer::output_blocked_callback(int output_multiple, bool force)
default:
std::ostringstream msg;
- msg << "Unexpected context for host_buffer: " << d_context;
+ msg << "Unexpected transfer type for host_buffer: " << d_transfer_type;
GR_LOG_ERROR(d_logger, msg.str());
throw std::runtime_error(msg.str());
}
diff --git a/gnuradio-runtime/lib/qa_host_buffer.cc b/gnuradio-runtime/lib/qa_host_buffer.cc
index e8f29afe8d..c710d3ec48 100644
--- a/gnuradio-runtime/lib/qa_host_buffer.cc
+++ b/gnuradio-runtime/lib/qa_host_buffer.cc
@@ -13,10 +13,10 @@
#endif
#include <gnuradio/block.h>
-#include <gnuradio/buffer_context.h>
#include <gnuradio/buffer_reader.h>
#include <gnuradio/host_buffer.h>
#include <gnuradio/random.h>
+#include <gnuradio/transfer_type.h>
#include <boost/test/unit_test.hpp>
#include <cstdlib>
#include <iostream>
@@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(t0)
gr::buffer_sptr buf(
gr::host_buffer::make_host_buffer(nitems, sizeof(int), nitems, 1, nop, nop));
- buf->set_context(gr::buffer_context::HOST_TO_HOST);
+ buf->set_transfer_type(gr::transfer_type::HOST_TO_HOST);
gr::buffer_reader_sptr rdr1(gr::buffer_add_reader(buf, 0, nop));
@@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(t1)
gr::buffer_sptr buf(
gr::host_buffer::make_host_buffer(nitems, sizeof(int), nitems, 1, nop, nop));
- buf->set_context(gr::buffer_context::HOST_TO_HOST);
+ buf->set_transfer_type(gr::transfer_type::HOST_TO_HOST);
gr::buffer_reader_sptr rdr1(gr::buffer_add_reader(buf, 0, nop));
@@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE(t2)
gr::buffer_sptr buf(
gr::host_buffer::make_host_buffer(nitems, sizeof(int), nitems, 1, nop, nop));
- buf->set_context(gr::buffer_context::HOST_TO_HOST);
+ buf->set_transfer_type(gr::transfer_type::HOST_TO_HOST);
gr::buffer_reader_sptr rdr1(gr::buffer_add_reader(buf, 0, nop));
@@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE(t3)
gr::buffer_sptr buf(
gr::host_buffer::make_host_buffer(nitems, sizeof(int), nitems, 1, nop, nop));
- buf->set_context(gr::buffer_context::HOST_TO_HOST);
+ buf->set_transfer_type(gr::transfer_type::HOST_TO_HOST);
gr::buffer_reader_sptr rdr1(gr::buffer_add_reader(buf, 0, nop));
gr::buffer_reader_sptr rdr2(gr::buffer_add_reader(buf, 0, nop));
@@ -249,7 +249,7 @@ BOOST_AUTO_TEST_CASE(t4)
gr::buffer_sptr buf(
gr::host_buffer::make_host_buffer(nitems, sizeof(int), nitems, 1, nop, nop));
- buf->set_context(gr::buffer_context::HOST_TO_HOST);
+ buf->set_transfer_type(gr::transfer_type::HOST_TO_HOST);
gr::buffer_reader_sptr rdr1(gr::buffer_add_reader(buf, 0, nop));
@@ -298,7 +298,7 @@ BOOST_AUTO_TEST_CASE(t5)
gr::buffer_sptr buf(
gr::host_buffer::make_host_buffer(nitems, sizeof(int), nitems, 1, nop, nop));
- buf->set_context(gr::buffer_context::HOST_TO_HOST);
+ buf->set_transfer_type(gr::transfer_type::HOST_TO_HOST);
gr::buffer_reader_sptr rdr1(gr::buffer_add_reader(buf, 0, nop));
diff --git a/gnuradio-runtime/lib/transfer_type.cc b/gnuradio-runtime/lib/transfer_type.cc
new file mode 100644
index 0000000000..befb3e4a39
--- /dev/null
+++ b/gnuradio-runtime/lib/transfer_type.cc
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2021 BlackLynx, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+#include <gnuradio/transfer_type.h>
+
+namespace gr {
+
+std::ostream& operator<<(std::ostream& os, const transfer_type& type)
+{
+ switch (type) {
+ case transfer_type::DEFAULT_INVALID:
+ return os << "DEFAULT_INVALID";
+ case transfer_type::HOST_TO_DEVICE:
+ return os << "HOST_TO_DEVICE";
+ case transfer_type::DEVICE_TO_HOST:
+ return os << "DEVICE_TO_HOST";
+ case transfer_type::HOST_TO_HOST:
+ return os << "HOST_TO_HOST";
+ case transfer_type::DEVICE_TO_DEVICE:
+ return os << "DEVICE_TO_DEVICE";
+ default:
+ return os << "Unknown transfer type: " << static_cast<int>(type);
+ }
+}
+
+} // namespace gr
diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc
index 9d79d0ac2a..65598624e0 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(c1b5cc864cfbb6dd9c9f3bf41f36c6ba) */
+/* BINDTOOL_HEADER_FILE_HASH(a9735c1e3334b958ac0ae85cf03b7eaf) */
/***********************************************************************************/
#include <pybind11/complex.h>
diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_type_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_type_python.cc
index 28bfcfac3c..2490c815f6 100644
--- a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_type_python.cc
+++ b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_type_python.cc
@@ -14,7 +14,7 @@
/* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */
/* BINDTOOL_HEADER_FILE(buffer_type.h) */
-/* BINDTOOL_HEADER_FILE_HASH(0b679f644e232dd519bb812b93c8c0e3) */
+/* BINDTOOL_HEADER_FILE_HASH(6ed358bbc956244006073acb8c2efab2) */
/***********************************************************************************/
#include <pybind11/complex.h>