GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
buffer_reader_sm.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2009-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_RUNTIME_BUFFER_READER_SM_H
12 #define INCLUDED_GR_RUNTIME_BUFFER_READER_SM_H
13 
14 #include <gnuradio/api.h>
15 #include <gnuradio/buffer.h>
16 #include <gnuradio/buffer_reader.h>
17 #include <gnuradio/runtime_types.h>
18 
19 namespace gr {
20 
22 {
23 public:
25 
26  /*!
27  * \brief Return number of items available for reading.
28  */
29  virtual int items_available() const;
30 
31  /*!
32  * \brief Return true if thread is ready to call input_blocked_callback,
33  * false otherwise; delegate calls to buffer class's input_blkd_cb_ready()
34  */
35  virtual bool input_blkd_cb_ready(int items_required) const;
36 
37  /*!
38  * \brief Callback function that the scheduler will call when it determines
39  * that the input is blocked; delegate calls to buffer class's
40  * input_blocked_callback()
41  */
42  virtual bool input_blocked_callback(int items_required, int items_avail);
43 
44 private:
45  friend class buffer;
46  friend class buffer_single_mapped;
47 
48  friend GR_RUNTIME_API buffer_reader_sptr buffer_add_reader(buffer_sptr buf,
49  int nzero_preload,
50  block_sptr link,
51  int delay);
52 
53  //! constructor is private. Use gr::buffer::add_reader to create instances
54  buffer_reader_sm(buffer_sptr buffer, unsigned int read_index, block_sptr link);
55 };
56 
57 } // namespace gr
58 
59 #endif /* INCLUDED_GR_RUNTIME_BUFFER_READER_SM_H */
Definition: buffer_reader_sm.h:22
virtual int items_available() const
Return number of items available for reading.
virtual bool input_blkd_cb_ready(int items_required) const
Return true if thread is ready to call input_blocked_callback, false otherwise; delegate calls to buf...
friend GR_RUNTIME_API buffer_reader_sptr buffer_add_reader(buffer_sptr buf, int nzero_preload, block_sptr link, int delay)
Create a new gr::buffer_reader and attach it to buffer buf.
virtual bool input_blocked_callback(int items_required, int items_avail)
Callback function that the scheduler will call when it determines that the input is blocked; delegate...
How we keep track of the readers of a gr::buffer.
Definition: buffer_reader.h:49
A single mapped buffer where wrapping conditions are handled explicitly via input/output_blocked_call...
Definition: buffer_single_mapped.h:30
Single writer, multiple reader fifo.
Definition: buffer.h:67
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29