GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
selector.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2019 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_GR_SELECTOR_H
12 #define INCLUDED_GR_SELECTOR_H
13 
14 #include <gnuradio/block.h>
15 #include <gnuradio/blocks/api.h>
16 
17 namespace gr {
18 namespace blocks {
19 
20 /*!
21  * \brief output[output_index][i] = input[input_index][i]
22  * \ingroup misc_blk
23  *
24  * \details
25  * Connect the sink at input index to the source at output index.
26  *
27  * Samples from other input ports are consumed and dumped at a rate
28  * which is limited by (but not necessarily the same as) the rate of
29  * samples copied from the active input to the active output.
30  *
31  * Other output ports produce no samples.
32  *
33  */
34 class BLOCKS_API selector : virtual public block
35 {
36 public:
37  typedef std::shared_ptr<selector> sptr;
38 
39  /*!
40  * Create new selector block and return a shared pointer to it
41  *
42  * \param itemsize size of the input and output items
43  * \param input_index the initially active input index
44  * \param output_index the initially active output index
45  */
46  static sptr
47  make(size_t itemsize, unsigned int input_index, unsigned int output_index);
48 
49  /*!
50  * When enabled is set to false, no output samples are produced.
51  * Otherwise samples are copied to the selected output port
52  */
53  virtual void set_enabled(bool enable) = 0;
54  virtual bool enabled() const = 0;
55 
56  virtual void set_input_index(unsigned int input_index) = 0;
57  virtual int input_index() const = 0;
58 
59  virtual void set_output_index(unsigned int output_index) = 0;
60  virtual int output_index() const = 0;
61 };
62 
63 } /* namespace blocks */
64 } /* namespace gr */
65 
66 #endif /* INCLUDED_GR_SELECTOR_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
output[output_index][i] = input[input_index][i]
Definition: selector.h:35
virtual int input_index() const =0
virtual void set_output_index(unsigned int output_index)=0
static sptr make(size_t itemsize, unsigned int input_index, unsigned int output_index)
std::shared_ptr< selector > sptr
Definition: selector.h:37
virtual bool enabled() const =0
virtual void set_input_index(unsigned int input_index)=0
virtual int output_index() const =0
virtual void set_enabled(bool enable)=0
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GR_RUNTIME_API size_t itemsize(types::vector_type type)
GNU Radio logging wrapper.
Definition: basic_block.h:29