selector_impl.h
Go to the documentation of this file.
/* -*- c++ -*- */
/*
* Copyright 2019 Free Software Foundation, Inc.
* Copyright 2023 Daniel Estevez <daniel@destevez.net>
*
* This file is part of gr-satellites
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* This is a copy of the GNU Radio Selector block modified to consume all the
* items that are available on inactive inputs. This is required to use selector
* blocks to bypass sections of the flowgraph. See
* https://github.com/gnuradio/gnuradio/issues/6792
* for more information.
*
*/
#ifndef INCLUDED_SATELLITES_SELECTOR_IMPL_H
#define INCLUDED_SATELLITES_SELECTOR_IMPL_H
#include <gnuradio/thread/thread.h>
#include <satellites/selector.h>
namespace gr {
namespace satellites {
class selector_impl : public selector
{
private:
const size_t d_itemsize;
unsigned int d_input_index, d_output_index;
unsigned int d_num_inputs, d_num_outputs; // keep track of the topology
bool d_enabled;
gr::thread::mutex d_mutex;
public:
selector_impl(size_t itemsize, unsigned int input_index, unsigned int output_index);
~selector_impl() override;
void forecast(int noutput_items, gr_vector_int& ninput_items_required) override;
bool check_topology(int ninputs, int noutputs) override;
void setup_rpc() override;
void handle_msg_input_index(const pmt::pmt_t& msg);
void handle_msg_output_index(const pmt::pmt_t& msg);
void handle_enable(const pmt::pmt_t& msg);
void set_enabled(bool enable) override
{
gr::thread::scoped_lock l(d_mutex);
d_enabled = enable;
}
bool enabled() const override { return d_enabled; }
void set_input_index(unsigned int input_index) override;
int input_index() const override { return d_input_index; }
void set_output_index(unsigned int output_index) override;
int output_index() const override { return d_output_index; }
int general_work(int noutput_items,
gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items) override;
};
} /* namespace satellites */
} /* namespace gr */
#endif /* INCLUDED_SATELLITES_SELECTOR_IMPL_H */
gr::satellites::selector_impl::forecast
void forecast(int noutput_items, gr_vector_int &ninput_items_required) override
gr::satellites::selector_impl::selector_impl
selector_impl(size_t itemsize, unsigned int input_index, unsigned int output_index)
gr::satellites::selector_impl::check_topology
bool check_topology(int ninputs, int noutputs) override
gr::satellites::selector_impl::set_enabled
void set_enabled(bool enable) override
Definition selector_impl.h:47
gr::satellites::selector_impl::handle_msg_output_index
void handle_msg_output_index(const pmt::pmt_t &msg)
gr::satellites::selector_impl::handle_enable
void handle_enable(const pmt::pmt_t &msg)
gr::satellites::selector_impl::input_index
int input_index() const override
Definition selector_impl.h:55
gr::satellites::selector_impl::set_input_index
void set_input_index(unsigned int input_index) override
gr::satellites::selector_impl::enabled
bool enabled() const override
Definition selector_impl.h:52
gr::satellites::selector_impl::~selector_impl
~selector_impl() override
gr::satellites::selector_impl::set_output_index
void set_output_index(unsigned int output_index) override
gr::satellites::selector_impl::handle_msg_input_index
void handle_msg_input_index(const pmt::pmt_t &msg)
gr::satellites::selector_impl::general_work
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override
gr::satellites::selector_impl::setup_rpc
void setup_rpc() override
gr::satellites::selector_impl::output_index
int output_index() const override
Definition selector_impl.h:58
gr::satellites::selector
output[output_index][i] = input[input_index][i]
Definition selector.h:40
gr::satellites
Definition ax100_decode.h:18
gr
Definition ax100_decode.h:17
selector.h