GNU Radio Manual and C++ API Reference  3.10.9.2
The Free & Open Software Radio Ecosystem
sync_block.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_BLOCK_H
12 #define INCLUDED_GR_RUNTIME_SYNC_BLOCK_H
13 
14 #include <gnuradio/api.h>
15 #include <gnuradio/block.h>
16 
17 namespace gr {
18 
19 /*!
20  * \brief synchronous 1:1 input to output with history
21  * \ingroup base_blk
22  *
23  * Override work to provide the signal processing implementation.
24  */
26 {
27 protected:
28  sync_block(void) {} // allows pure virtual interface sub-classes
29  sync_block(const std::string& name,
30  gr::io_signature::sptr input_signature,
31  gr::io_signature::sptr output_signature);
32 
33 public:
34  /*!
35  * \brief just like gr::block::general_work, only this arranges to
36  * call consume_each for you
37  *
38  * The user must override work to define the signal processing code
39  */
40  virtual int work(int noutput_items,
41  gr_vector_const_void_star& input_items,
42  gr_vector_void_star& output_items) = 0;
43 
44  // gr::sync_block overrides these to assist work
45  void forecast(int noutput_items, gr_vector_int& ninput_items_required) override;
46  int general_work(int noutput_items,
47  gr_vector_int& ninput_items,
48  gr_vector_const_void_star& input_items,
49  gr_vector_void_star& output_items) override;
50 
51  int fixed_rate_ninput_to_noutput(int ninput) override;
52  int fixed_rate_noutput_to_ninput(int noutput) override;
53 };
54 
55 } /* namespace gr */
56 
57 #endif /* INCLUDED_GR_RUNTIME_SYNC_BLOCK_H */
std::shared_ptr< io_signature > sptr
Definition: io_signature.h:52
std::vector< const void * > gr_vector_const_void_star
Definition: types.h:28
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
std::vector< void * > gr_vector_void_star
Definition: types.h:27
GNU Radio logging wrapper.
Definition: basic_block.h:29
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:25
sync_block(void)
Definition: sync_block.h:28
The abstract base class for all &#39;terminal&#39; processing blocks.A signal processing flow is constructed ...
Definition: gnuradio-runtime/include/gnuradio/block.h:62
std::vector< int > gr_vector_int
Definition: types.h:23