GNU Radio C++ API Reference: gr::host_buffer Class Reference

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
gr::host_buffer Class Reference

`#include <gnuradio/host_buffer.h>`

## Public Member Functions
| ~host_buffer () override
void | post_work (int nitems) override
| Handles post-general_work() cleanup and data transfer.
bool | do_allocate_buffer (size_t final_nitems, size_t sizeof_item) override
| Do actual buffer allocation. Inherited from buffer_single_mapped.
void * | write_pointer () override
| Return a pointer to the write buffer depending on the context.
const void * | _read_pointer (unsigned int read_index) override
| return pointer to read buffer depending on the context
bool | input_blocked_callback (int items_required, int items_avail, unsigned read_index) override
| Callback function that the scheduler will call when it determines that the input is blocked. Override this function if needed.
bool | output_blocked_callback (int output_multiple, bool force) override
| Callback function that the scheduler will call when it determines that the output is blocked.
Public Member Functions inherited from gr::buffer_single_mapped
| ~buffer_single_mapped () override
block_sptr | buf_owner ()
| Return the block that owns this buffer.
int | space_available () override
| return number of items worth of space available for writing
void | update_reader_block_history (unsigned history, int delay) override
bool | input_blkd_cb_ready (int items_required, unsigned read_index) override
| Return true if thread is ready to call input_blocked_callback, false otherwise.
bool | output_blkd_cb_ready (int output_multiple) override
| Return true if thread is ready to call the callback, false otherwise.
Public Member Functions inherited from gr::buffer
| ~buffer () override
buffer_mapping_type | get_mapping_type ()
| return the buffer's mapping type
unsigned int | bufsize () const
| return size of this buffer in items
const char * | base () const
| return the base address of the buffer
void | update_write_pointer (int nitems)
| tell buffer that we wrote `nitems` into it
void | set_done (bool done)
bool | done () const
block_sptr | link ()
| Return the block that writes to this buffer.
size_t | nreaders () const
buffer_reader * | reader (size_t index)
gr::thread::mutex * | mutex ()
uint64_t | nitems_written ()
void | reset_nitem_counter ()
size_t | get_sizeof_item ()
uint64_t | get_downstream_lcm_nitems ()
uint32_t | get_max_reader_output_multiple ()
void | add_item_tag (const tag_t &tag)
| Adds a new tag to the buffer.
void | remove_item_tag (const tag_t &tag, long id)
| Removes an existing tag from the buffer.
void | prune_tags (uint64_t max_time)
| Removes all tags before `max_time` from buffer.
std::multimap< uint64_t, tag_t >::iterator | get_tags_begin ()
std::multimap< uint64_t, tag_t >::iterator | get_tags_end ()
std::multimap< uint64_t, tag_t >::iterator | get_tags_lower_bound (uint64_t x)
std::multimap< uint64_t, tag_t >::iterator | get_tags_upper_bound (uint64_t x)
void | increment_active ()
| Increment the number of active pointers for this buffer.
void | decrement_active ()
| Decrement the number of active pointers for this buffer and signal anyone waiting when the count reaches zero.
void | on_lock (gr::thread::scoped_lock &lock) override
| "on_lock" function from the custom_lock_if.
void | on_unlock () override
| "on_unlock" function from the custom_lock_if.
void | set_transfer_type (const transfer_type &type)
| Assign buffer's transfer_type.
Public Member Functions inherited from gr::custom_lock_if
virtual | ~custom_lock_if ()

## Static Public Member Functions
static void * | device_memcpy (void *dest, const void *src, std::size_t count)
static void * | device_memmove (void *dest, const void *src, std::size_t count)
static buffer_sptr | make_buffer (int nitems, size_t sizeof_item, uint64_t downstream_lcm_nitems, uint32_t downstream_max_out_mult, block_sptr link=block_sptr(), block_sptr buf_owner=block_sptr())
static buffer_sptr | make_host_buffer (int nitems, std::size_t sizeof_item, uint64_t downstream_lcm_nitems, uint32_t downstream_max_out_mult, block_sptr link, block_sptr buf_owner)
| Creates a new host_buffer object.

## Static Public Attributes
static buffer_type | type

## Additional Inherited Members
Public Attributes inherited from gr::buffer_single_mapped
gr::logger_ptr | d_logger
gr::logger_ptr | d_debug_logger
Public Attributes inherited from gr::buffer
gr::logger_ptr | d_logger
gr::logger_ptr | d_debug_logger
Protected Member Functions inherited from gr::buffer_single_mapped
bool | allocate_buffer (int nitems) override
| Make reasonable attempt to adjust nitems based on read/write granularity then delegate actual allocation to do_allocate_buffer().
unsigned | index_add (unsigned a, unsigned b) override
| Increment read or write index for this buffer.
unsigned | index_sub (unsigned a, unsigned b) override
| Decrement read or write index for this buffer.
| buffer_single_mapped (int nitems, size_t sizeof_item, uint64_t downstream_lcm_nitems, uint32_t downstream_max_out_mult, block_sptr link, block_sptr buf_owner)
| constructor is private. Use gr_make_buffer to create instances.
virtual bool | input_blocked_callback_logic (int items_required, int items_avail, unsigned read_index, char *buffer_ptr, mem_func_t const &memcpy_func, mem_func_t const &memmove_func)
| Abstracted logic for the input blocked callback function.
virtual bool | output_blocked_callback_logic (int output_multiple, bool force, char *buffer_ptr, mem_func_t const &memmove_func)
| Abstracted logic for the output blocked callback function.
Protected Member Functions inherited from gr::buffer
| buffer (buffer_mapping_type buftype, int nitems, size_t sizeof_item, uint64_t downstream_lcm_nitems, uint32_t downstream_max_out_mult, block_sptr link)
| constructor is private. Use gr_make_buffer to create instances.
void | drop_reader (buffer_reader *reader)
| disassociate `reader` from this buffer
Protected Attributes inherited from gr::buffer_single_mapped
block_sptr | d_buf_owner
std::unique_ptr< char[]> | d_buffer
Protected Attributes inherited from gr::buffer
char * | d_base
unsigned int | d_bufsize
buffer_mapping_type | d_buf_map_type
unsigned | d_max_reader_delay
unsigned | d_max_reader_history
bool | d_has_history
size_t | d_sizeof_item
std::vector< buffer_reader * > | d_readers
std::weak_ptr< block > | d_link
gr::thread::mutex | d_mutex
unsigned int | d_write_index
uint64_t | d_abs_write_offset
bool | d_done
std::multimap< uint64_t, tag_t > | d_item_tags
uint64_t | d_last_min_items_read
gr::thread::condition_variable | d_cv
bool | d_callback_flag
uint32_t | d_active_pointer_counter
uint64_t | d_downstream_lcm_nitems
uint64_t | d_write_multiple
uint32_t | d_max_reader_output_multiple
transfer_type | d_transfer_type

## Constructor & Destructor Documentation

## ◆ ~host_buffer()

gr::host_buffer::~host_buffer | ( |  | ) |
| override

## Member Function Documentation

## ◆ _read_pointer()

const void * gr::host_buffer::_read_pointer | ( | unsigned int | read_index | ) |
| overridevirtual

return pointer to read buffer depending on the context

The return value points to at least items_available() items.

Reimplemented from gr::buffer.

## ◆ device_memcpy()

void * gr::host_buffer::device_memcpy | ( | void * | dest,
|  | const void * | src,
|  | std::size_t | count )
| static

## ◆ device_memmove()

void * gr::host_buffer::device_memmove | ( | void * | dest,
|  | const void * | src,
|  | std::size_t | count )
| static

## ◆ do_allocate_buffer()

bool gr::host_buffer::do_allocate_buffer | ( | size_t | final_nitems,
|  | size_t | sizeof_item )
| overridevirtual

Do actual buffer allocation. Inherited from buffer_single_mapped.

Implements gr::buffer_single_mapped.

## ◆ input_blocked_callback()

bool gr::host_buffer::input_blocked_callback | ( | int | items_required,
|  | int | items_avail,
|  | unsigned | read_index )
| overridevirtual

Callback function that the scheduler will call when it determines that the input is blocked. Override this function if needed.

Implements gr::buffer_single_mapped.

## ◆ make_buffer()

buffer_sptr gr::host_buffer::make_buffer | ( | int | nitems,
|  | size_t | sizeof_item,
|  | uint64_t | downstream_lcm_nitems,
|  | uint32_t | downstream_max_out_mult,
|  | block_sptr | link = block_sptr(),
|  | block_sptr | buf_owner = block_sptr() )
| static

References gr::buffer_single_mapped::buf_owner(), and gr::buffer::link().

## ◆ make_host_buffer()

buffer_sptr gr::host_buffer::make_host_buffer | ( | int | nitems,
|  | std::size_t | sizeof_item,
|  | uint64_t | downstream_lcm_nitems,
|  | uint32_t | downstream_max_out_mult,
|  | block_sptr | link,
|  | block_sptr | buf_owner )
| static

Creates a new host_buffer object.

Parameters

  nitems |
  sizeof_item |
  downstream_lcm_nitems |
  downstream_max_out_mult |
  link |
  buf_owner |

Returns
  pointer to buffer base class

References gr::buffer_single_mapped::buf_owner(), and gr::buffer::link().

## ◆ output_blocked_callback()

bool gr::host_buffer::output_blocked_callback | ( | int | output_multiple,
|  | bool | force )
| overridevirtual

Callback function that the scheduler will call when it determines that the output is blocked.

Implements gr::buffer_single_mapped.

## ◆ post_work()

void gr::host_buffer::post_work | ( | int | nitems | ) |
| overridevirtual

Handles post-general_work() cleanup and data transfer.

Called directly after call to general_work() completes and is used for data transfer (and perhaps other administrative activities)

Parameters

  nitems | is the number of items produced by the general_work() function.

Implements gr::buffer.

## ◆ write_pointer()

void * gr::host_buffer::write_pointer | ( |  | ) |
| overridevirtual

Return a pointer to the write buffer depending on the context.

Reimplemented from gr::buffer.

## Member Data Documentation

## ◆ type

buffer_type gr::host_buffer::type
| static

The documentation for this class was generated from the following file:

- host_buffer.h