GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
sync_interpolator.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2004,2008,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_RUNTIME_SYNC_INTERPOLATOR_H
12#define INCLUDED_GR_RUNTIME_SYNC_INTERPOLATOR_H
13
14#include <gnuradio/api.h>
15#include <gnuradio/sync_block.h>
16
17namespace gr {
18
19/*!
20 * \brief synchronous 1:N input to output with history
21 * \ingroup base_blk
22 *
23 * Override work to provide the signal processing implementation.
24 */
26{
27private:
28 unsigned d_interpolation;
29
30protected:
31 sync_interpolator(void) {} // allows pure virtual interface sub-classes
32 sync_interpolator(const std::string& name,
33 gr::io_signature::sptr input_signature,
34 gr::io_signature::sptr output_signature,
35 unsigned interpolation);
36
37public:
38 unsigned interpolation() const { return d_interpolation; }
39 void set_interpolation(unsigned interpolation)
40 {
41 d_interpolation = interpolation;
42 set_relative_rate((uint64_t)interpolation, 1);
43 set_output_multiple(interpolation);
44 }
45
46 // gr::sync_interpolator overrides these to assist work
47 void forecast(int noutput_items, gr_vector_int& ninput_items_required) override;
48 int general_work(int noutput_items,
49 gr_vector_int& ninput_items,
50 gr_vector_const_void_star& input_items,
51 gr_vector_void_star& output_items) override;
52
53 // derived classes should override work
54
55 int fixed_rate_ninput_to_noutput(int ninput) override;
56 int fixed_rate_noutput_to_ninput(int noutput) override;
57};
58
59} /* namespace gr */
60
61#endif /* INCLUDED_GR_RUNTIME_SYNC_INTERPOLATOR_H */
std::shared_ptr< io_signature > sptr
Definition: io_signature.h:47
synchronous 1:1 input to output with history
Definition: sync_block.h:26
synchronous 1:N input to output with history
Definition: sync_interpolator.h:26
void forecast(int noutput_items, gr_vector_int &ninput_items_required) override
Estimate input requirements given output request.
unsigned interpolation() const
Definition: sync_interpolator.h:38
int fixed_rate_ninput_to_noutput(int ninput) override
Given ninput samples, return number of output samples that will be produced. N.B. this is only define...
int fixed_rate_noutput_to_ninput(int noutput) override
Given noutput samples, return number of input samples required to produce noutput....
sync_interpolator(const std::string &name, gr::io_signature::sptr input_signature, gr::io_signature::sptr output_signature, unsigned interpolation)
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
compute output items from input items
sync_interpolator(void)
Definition: sync_interpolator.h:31
void set_interpolation(unsigned interpolation)
Definition: sync_interpolator.h:39
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::vector< const void * > gr_vector_const_void_star
Definition: types.h:28
std::vector< void * > gr_vector_void_star
Definition: types.h:27
std::vector< int > gr_vector_int
Definition: types.h:23