Loading...
Searching...
No Matches
sync_interpolator.h
Go to the documentation of this file.
/* -*- c++ -*- */
/*
* Copyright 2004,2008,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef INCLUDED_GR_RUNTIME_SYNC_INTERPOLATOR_H
#define INCLUDED_GR_RUNTIME_SYNC_INTERPOLATOR_H
#include <gnuradio/api.h>
#include <gnuradio/sync_block.h>
namespace gr {
/*!
* \brief synchronous 1:N input to output with history
* \ingroup base_blk
*
* Override work to provide the signal processing implementation.
*/
class GR_RUNTIME_API sync_interpolator : public sync_block
{
private:
unsigned d_interpolation;
protected:
sync_interpolator(void) {} // allows pure virtual interface sub-classes
sync_interpolator(const std::string& name,
gr::io_signature::sptr input_signature,
gr::io_signature::sptr output_signature,
unsigned interpolation);
public:
unsigned interpolation() const { return d_interpolation; }
void set_interpolation(unsigned interpolation)
{
d_interpolation = interpolation;
set_relative_rate((uint64_t)interpolation, 1);
set_output_multiple(interpolation);
}
// gr::sync_interpolator overrides these to assist work
void forecast(int noutput_items, gr_vector_int& ninput_items_required) override;
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;
// derived classes should override work
int fixed_rate_ninput_to_noutput(int ninput) override;
int fixed_rate_noutput_to_ninput(int noutput) override;
};
} /* namespace gr */
#endif /* INCLUDED_GR_RUNTIME_SYNC_INTERPOLATOR_H */
gr::basic_block::input_signature
gr::io_signature::sptr input_signature() const
Definition basic_block.h:181
gr::basic_block::output_signature
gr::io_signature::sptr output_signature() const
Definition basic_block.h:182
gr::basic_block::name
std::string name() const
Definition basic_block.h:168
gr::block::set_output_multiple
void set_output_multiple(int multiple)
Constrain the noutput_items argument passed to forecast and general_work.
gr::block::set_relative_rate
void set_relative_rate(double relative_rate)
Set the approximate output rate / input rate.
gr::io_signature::sptr
std::shared_ptr< io_signature > sptr
Definition io_signature.h:52
gr::sync_block::sync_block
sync_block(void)
Definition sync_block.h:28
gr::sync_interpolator::forecast
void forecast(int noutput_items, gr_vector_int &ninput_items_required) override
Estimate input requirements given output request.
gr::sync_interpolator::interpolation
unsigned interpolation() const
Definition sync_interpolator.h:38
gr::sync_interpolator::fixed_rate_ninput_to_noutput
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...
gr::sync_interpolator::fixed_rate_noutput_to_ninput
int fixed_rate_noutput_to_ninput(int noutput) override
Given noutput samples, return number of input samples required to produce noutput....
gr::sync_interpolator::sync_interpolator
sync_interpolator(const std::string &name, gr::io_signature::sptr input_signature, gr::io_signature::sptr output_signature, unsigned interpolation)
gr::sync_interpolator::general_work
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
gr::sync_interpolator::sync_interpolator
sync_interpolator(void)
Definition sync_interpolator.h:31
gr::sync_interpolator::set_interpolation
void set_interpolation(unsigned interpolation)
Definition sync_interpolator.h:39
api.h
GR_RUNTIME_API
#define GR_RUNTIME_API
Definition gnuradio-runtime/include/gnuradio/api.h:18
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
sync_block.h
gr_vector_const_void_star
std::vector< const void * > gr_vector_const_void_star
Definition types.h:28
gr_vector_void_star
std::vector< void * > gr_vector_void_star
Definition types.h:27
gr_vector_int
std::vector< int > gr_vector_int
Definition types.h:23