GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
vector_map.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012,2013 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_VECTOR_MAP_H
12 #define INCLUDED_GR_VECTOR_MAP_H
13 
14 #include <gnuradio/blocks/api.h>
15 #include <gnuradio/sync_block.h>
16 #include <vector>
17 
18 namespace gr {
19 namespace blocks {
20 
21 /*!
22  * \brief Maps elements from a set of input vectors to a set of output vectors.
23  * \ingroup stream_operators_blk
24  *
25  * \details
26  * If in[i] is the input vector in the i'th stream then the output
27  * vector in the j'th stream is:
28  *
29  * out[j][k] = in[mapping[j][k][0]][mapping[j][k][1]]
30  *
31  * That is mapping is of the form (out_stream1_mapping,
32  * out_stream2_mapping, ...) and out_stream1_mapping is of the
33  * form (element1_mapping, element2_mapping, ...) and
34  * element1_mapping is of the form (in_stream, in_element).
35  */
36 class BLOCKS_API vector_map : virtual public sync_block
37 {
38 public:
39  // gr::blocks::vector_map::sptr
40  typedef std::shared_ptr<vector_map> sptr;
41 
42  /*!
43  * Build a vector map block.
44  *
45  * \param item_size (integer) size of vector elements
46  * \param in_vlens (vector of integers) number of elements in each
47  * input vector
48  * \param mapping (vector of vectors of vectors of integers) how to
49  * map elements from input to output vectors
50  */
51  static sptr make(size_t item_size,
52  std::vector<size_t> in_vlens,
53  std::vector<std::vector<std::vector<size_t>>> mapping);
54 
55  virtual void set_mapping(std::vector<std::vector<std::vector<size_t>>> mapping) = 0;
56 };
57 
58 } /* namespace blocks */
59 } /* namespace gr */
60 
61 #endif /* INCLUDED_GR_VECTOR_MAP_H */
Maps elements from a set of input vectors to a set of output vectors.
Definition: vector_map.h:37
static sptr make(size_t item_size, std::vector< size_t > in_vlens, std::vector< std::vector< std::vector< size_t >>> mapping)
std::shared_ptr< vector_map > sptr
Definition: vector_map.h:40
virtual void set_mapping(std::vector< std::vector< std::vector< size_t >>> mapping)=0
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29