GNU Radio C++ API Reference: blockinterleaving.h Source File

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
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
18namespace gr {
19namespace blocks {
20 namespace kernel {
21
22 class BLOCKS_API block_interleaving
23{
24public:
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
47private:
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 */
gr::blocks::kernel::block_interleaving::interleaver_length
size_t interleaver_length()
Definition blockinterleaving.h:27
gr::blocks::kernel::block_interleaving::interleave
void interleave(T *target, const T *src)
Definition blockinterleaving.h:32
gr::blocks::kernel::block_interleaving::deinterleaver_indices
std::vector< size_t > deinterleaver_indices()
Definition blockinterleaving.h:29
gr::blocks::kernel::block_interleaving::block_interleaving
block_interleaving(std::vector< size_t > interleaver_indices)
gr::blocks::kernel::block_interleaving::interleaver_indices
std::vector< size_t > interleaver_indices()
Definition blockinterleaving.h:28
gr::blocks::kernel::block_interleaving::deinterleave
void deinterleave(T *target, const T *src)
Definition blockinterleaving.h:40
api.h
BLOCKS_API
#define BLOCKS_API
Definition gr-blocks/include/gnuradio/blocks/api.h:18
gr::blocks::kernel
Definition blockinterleaving.h:20
gr::blocks
Definition abs_blk.h:20
gr
GNU Radio logging wrapper.
Definition basic_block.h:29