GNU Radio Manual and C++ API Reference  3.9.2.0
The Free & Open Software Radio Ecosystem
throttle.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2005-2011,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_THROTTLE_H
12 #define INCLUDED_GR_THROTTLE_H
13 
14 #include <gnuradio/blocks/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace blocks {
19 
20 /*!
21  * \brief throttle flow of samples such that the average rate does
22  * not exceed samples_per_sec.
23  * \ingroup misc_blk
24  *
25  * \details
26  * input: one stream of itemsize; output: one stream of itemsize
27  *
28  * N.B. this should only be used in GUI apps where there is no
29  * other rate limiting block. It is not intended nor effective at
30  * precisely controlling the rate of samples. That should be
31  * controlled by a source or sink tied to sample clock. E.g., a
32  * USRP or audio card.
33  */
34 class BLOCKS_API throttle : virtual public sync_block
35 {
36 public:
37  typedef std::shared_ptr<throttle> sptr;
38 
39  static sptr make(size_t itemsize, double samples_per_sec, bool ignore_tags = true);
40 
41  //! Sets the sample rate in samples per second.
42  virtual void set_sample_rate(double rate) = 0;
43 
44  //! Get the sample rate in samples per second.
45  virtual double sample_rate() const = 0;
46 };
47 
48 } /* namespace blocks */
49 } /* namespace gr */
50 
51 #endif /* INCLUDED_GR_THROTTLE_H */
throttle flow of samples such that the average rate does not exceed samples_per_sec.
Definition: throttle.h:35
virtual double sample_rate() const =0
Get the sample rate in samples per second.
virtual void set_sample_rate(double rate)=0
Sets the sample rate in samples per second.
static sptr make(size_t itemsize, double samples_per_sec, bool ignore_tags=true)
std::shared_ptr< throttle > sptr
Definition: throttle.h:37
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
BLOCKS_API size_t itemsize(vector_type type)
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:29