GNU Radio's SATELLITES Package
selector.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2019 Free Software Foundation, Inc.
4 * Copyright 2023 Daniel Estevez <daniel@destevez.net>
5 *
6 * This file is part of gr-satellites
7 *
8 * SPDX-License-Identifier: GPL-3.0-or-later
9 *
10 * This is a copy of the GNU Radio Selector block modified to consume all the
11 * items that are available on inactive inputs. This is required to use selector
12 * blocks to bypass sections of the flowgraph. See
13 * https://github.com/gnuradio/gnuradio/issues/6792
14 * for more information.
15 *
16 */
17
18#ifndef INCLUDED_SATELLITES_SELECTOR_H
19#define INCLUDED_SATELLITES_SELECTOR_H
20
21#include <gnuradio/block.h>
22#include <satellites/api.h>
23
24namespace gr {
25namespace satellites {
26
27/*!
28 * \brief output[output_index][i] = input[input_index][i]
29 * \ingroup satellites
30 *
31 * \details
32 * Connect the sink at input index to the source at output index.
33 *
34 * All the samples available from other input ports are consumed and dumped.
35 *
36 * Other output ports produce no samples.
37 *
38 */
39class SATELLITES_API selector : virtual public gr::block
40{
41public:
42 typedef std::shared_ptr<selector> sptr;
43
44 /*!
45 * Create new selector block and return a shared pointer to it
46 *
47 * \param itemsize size of the input and output items
48 * \param input_index the initially active input index
49 * \param output_index the initially active output index
50 */
51 static sptr
52 make(size_t itemsize, unsigned int input_index, unsigned int output_index);
53
54 /*!
55 * When enabled is set to false, no output samples are produced.
56 * Otherwise samples are copied to the selected output port
57 */
58 virtual void set_enabled(bool enable) = 0;
59 virtual bool enabled() const = 0;
60
61 virtual void set_input_index(unsigned int input_index) = 0;
62 virtual int input_index() const = 0;
63
64 virtual void set_output_index(unsigned int output_index) = 0;
65 virtual int output_index() const = 0;
66};
67
68} /* namespace satellites */
69} /* namespace gr */
70
71#endif /* INCLUDED_SATELLITES_SELECTOR_H */
#define SATELLITES_API
Definition api.h:31
output[output_index][i] = input[input_index][i]
Definition selector.h:40
static sptr make(size_t itemsize, unsigned int input_index, unsigned int output_index)
virtual void set_input_index(unsigned int input_index)=0
virtual int input_index() const =0
std::shared_ptr< selector > sptr
Definition selector.h:42
virtual bool enabled() const =0
virtual void set_output_index(unsigned int output_index)=0
virtual void set_enabled(bool enable)=0
virtual int output_index() const =0
Definition ax100_decode.h:17