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