Loading...
Searching...
No Matches
sync_decimator.h
Go to the documentation of this file.
/* -*- c++ -*- */
/*
* Copyright 2004, 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_DECIMATOR_H
#define INCLUDED_GR_RUNTIME_SYNC_DECIMATOR_H
#include <gnuradio/api.h>
#include <gnuradio/sync_block.h>
namespace gr {
/*!
* \brief synchronous N:1 input to output with history
* \ingroup base_blk
*
* Override work to provide the signal processing implementation.
*/
class GR_RUNTIME_API sync_decimator : public sync_block
{
private:
unsigned d_decimation;
protected:
sync_decimator(void) {} // allows pure virtual interface sub-classes
sync_decimator(const std::string& name,
gr::io_signature::sptr input_signature,
gr::io_signature::sptr output_signature,
unsigned decimation);
public:
unsigned decimation() const { return d_decimation; }
void set_decimation(unsigned decimation)
{
d_decimation = decimation;
set_relative_rate(1, (uint64_t)decimation);
}
// gr::sync_decimator 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_DECIMATOR_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_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_decimator::sync_decimator
sync_decimator(void)
Definition sync_decimator.h:31
gr::sync_decimator::sync_decimator
sync_decimator(const std::string &name, gr::io_signature::sptr input_signature, gr::io_signature::sptr output_signature, unsigned decimation)
gr::sync_decimator::set_decimation
void set_decimation(unsigned decimation)
Definition sync_decimator.h:39
gr::sync_decimator::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_decimator::forecast
void forecast(int noutput_items, gr_vector_int &ninput_items_required) override
Estimate input requirements given output request.
gr::sync_decimator::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_decimator::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_decimator::decimation
unsigned decimation() const
Definition sync_decimator.h:38
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