summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/vector_insert_impl.h
blob: b15f977a96e2e659b113ac197dabc5370f834ea5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* -*- c++ -*- */
/*
 * Copyright 2012,2013,2018 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */


#ifndef VECTOR_INSERT_IMPL_H
#define VECTOR_INSERT_IMPL_H

#include <gnuradio/blocks/vector_insert.h>

namespace gr {
namespace blocks {

template <class T>
class vector_insert_impl : public vector_insert<T>
{
private:
    std::vector<T> d_data;
    int d_offset;
    const int d_periodicity;

public:
    vector_insert_impl(const std::vector<T>& data, int periodicity, int offset);
    ~vector_insert_impl() override;

    void rewind() override { d_offset = 0; }
    void set_data(const std::vector<T>& data) override
    {
        d_data = data;
        rewind();
    }

    int general_work(int noutput_items,
                     gr_vector_int& ninput_items,
                     gr_vector_const_void_star& input_items,
                     gr_vector_void_star& output_items) override;
};

} /* namespace blocks */
} /* namespace gr */

#endif /* VECTOR_INSERT_IMPL_H */