GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
blockinterleaving.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2022 Johannes Demel.
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_BLOCKS_BLOCKINTERLEAVING_H
12 #define INCLUDED_GR_BLOCKS_BLOCKINTERLEAVING_H
13 
14 #include <gnuradio/blocks/api.h>
15 #include <cstddef>
16 #include <vector>
17 
18 namespace gr {
19 namespace blocks {
20 namespace kernel {
21 
23 {
24 public:
25  block_interleaving(std::vector<size_t> interleaver_indices);
26 
27  size_t interleaver_length() { return _interleaver_indices.size(); };
28  std::vector<size_t> interleaver_indices() { return _interleaver_indices; };
29  std::vector<size_t> deinterleaver_indices() { return _deinterleaver_indices; };
30 
31  template <class T>
32  void interleave(T* target, const T* src)
33  {
34  for (auto idx : _interleaver_indices) {
35  *target++ = src[idx];
36  }
37  }
38 
39  template <class T>
40  void deinterleave(T* target, const T* src)
41  {
42  for (auto idx : _deinterleaver_indices) {
43  *target++ = src[idx];
44  }
45  }
46 
47 private:
48  std::vector<size_t> _interleaver_indices;
49  std::vector<size_t> _deinterleaver_indices;
50 
51  void set_interleaver_indices(const std::vector<size_t>& interleaver_indices);
52 };
53 
54 } /* namespace kernel */
55 } /* namespace blocks */
56 } /* namespace gr */
57 
58 #endif /* INCLUDED_GR_BLOCKS_BLOCKINTERLEAVING_H */
Definition: blockinterleaving.h:23
size_t interleaver_length()
Definition: blockinterleaving.h:27
void interleave(T *target, const T *src)
Definition: blockinterleaving.h:32
std::vector< size_t > interleaver_indices()
Definition: blockinterleaving.h:28
std::vector< size_t > deinterleaver_indices()
Definition: blockinterleaving.h:29
block_interleaving(std::vector< size_t > interleaver_indices)
void deinterleave(T *target, const T *src)
Definition: blockinterleaving.h:40
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29