diff options
Diffstat (limited to 'blocklib/zeromq/push_msg_sink')
-rw-r--r-- | blocklib/zeromq/push_msg_sink/push_msg_sink.yml | 38 | ||||
-rw-r--r-- | blocklib/zeromq/push_msg_sink/push_msg_sink_cpu.cc | 50 | ||||
-rw-r--r-- | blocklib/zeromq/push_msg_sink/push_msg_sink_cpu.h | 40 |
3 files changed, 0 insertions, 128 deletions
diff --git a/blocklib/zeromq/push_msg_sink/push_msg_sink.yml b/blocklib/zeromq/push_msg_sink/push_msg_sink.yml deleted file mode 100644 index 172631951..000000000 --- a/blocklib/zeromq/push_msg_sink/push_msg_sink.yml +++ /dev/null @@ -1,38 +0,0 @@ -module: zeromq -block: push_msg_sink -label: Push Msg Sink -blocktype: block -category: '[Core]/ZeroMQ Interfaces' - -# Example Parameters -parameters: - - id: address - label: IP Address - dtype: string - settable: false - - id: timeout - label: Timeout - dtype: int - settable: false - default: 100 - - id: bind - label: Bind - dtype: bool - settable: false - default: "true" - -callbacks: -- id: last_endpoint - return: std::string - const: true - -ports: -- domain: message - id: in - direction: input - -implementations: -- id: cpu -# - id: cuda - -file_format: 1 diff --git a/blocklib/zeromq/push_msg_sink/push_msg_sink_cpu.cc b/blocklib/zeromq/push_msg_sink/push_msg_sink_cpu.cc deleted file mode 100644 index dd044868d..000000000 --- a/blocklib/zeromq/push_msg_sink/push_msg_sink_cpu.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013,2014 Free Software Foundation, Inc. - * Copyright 2022 Josh Morman - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -#include "push_msg_sink_cpu.h" -#include "push_msg_sink_cpu_gen.h" - -namespace { -constexpr int LINGER_DEFAULT = 1000; // 1 second. -} - -namespace gr { -namespace zeromq { - -push_msg_sink_cpu::push_msg_sink_cpu(block_args args) - : INHERITED_CONSTRUCTORS, - d_timeout(args.timeout), - d_context(1), - d_socket(d_context, ZMQ_PUSH) -{ - - d_socket.set(zmq::sockopt::linger, LINGER_DEFAULT); - - if (args.bind) { - d_socket.bind(args.address); - } - else { - d_socket.connect(args.address); - } -} - -void push_msg_sink_cpu::handle_msg_in(pmtf::pmt msg) -{ - std::stringbuf sb(""); - msg.serialize(sb); - std::string s = sb.str(); - zmq::message_t zmsg(s.size()); - memcpy(zmsg.data(), s.c_str(), s.size()); - d_socket.send(zmsg, zmq::send_flags::none); -} - -} // namespace zeromq -} // namespace gr
\ No newline at end of file diff --git a/blocklib/zeromq/push_msg_sink/push_msg_sink_cpu.h b/blocklib/zeromq/push_msg_sink/push_msg_sink_cpu.h deleted file mode 100644 index ad8e01d4e..000000000 --- a/blocklib/zeromq/push_msg_sink/push_msg_sink_cpu.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2013,2014 Free Software Foundation, Inc. - * Copyright 2022 Josh Morman - * - * This file is part of GNU Radio - * - * SPDX-License-Identifier: GPL-3.0-or-later - * - */ - -#pragma once - -#include <gnuradio/zeromq/push_msg_sink.h> - -#include <zmq.hpp> - -namespace gr { -namespace zeromq { - -class push_msg_sink_cpu : public virtual push_msg_sink -{ -public: - push_msg_sink_cpu(block_args args); - - std::string last_endpoint() const override - { - return d_socket.get(zmq::sockopt::last_endpoint); - } - -private: - int d_timeout; // microseconds, -1 is blocking - zmq::context_t d_context; - zmq::socket_t d_socket; - - void handle_msg_in(pmtf::pmt msg) override; -}; - -} // namespace zeromq -} // namespace gr
\ No newline at end of file |