GNU Radio 3.4.0 C++ API
|
Single writer, multiple reader fifo. More...
#include <gr_buffer.h>
Public Member Functions | |
virtual | ~gr_buffer () |
int | space_available () |
return number of items worth of space available for writing | |
int | bufsize () const |
return size of this buffer in items | |
void * | write_pointer () |
return pointer to write buffer. | |
void | update_write_pointer (int nitems) |
tell buffer that we wrote nitems into it | |
void | set_done (bool done) |
bool | done () const |
gr_block_sptr | link () |
Return the block that writes to this buffer. | |
size_t | nreaders () const |
gr_buffer_reader * | reader (size_t index) |
gruel::mutex * | mutex () |
uint64_t | nitems_written () |
void | add_item_tag (const pmt::pmt_t &tag) |
Adds a new tag to the buffer. | |
void | prune_tags (uint64_t max_time) |
Removes all tags before max_time from buffer. | |
std::deque< pmt::pmt_t >::iterator | get_tags_begin () |
std::deque< pmt::pmt_t >::iterator | get_tags_end () |
Protected Attributes | |
char * | d_base |
unsigned int | d_bufsize |
Friends | |
class | gr_buffer_reader |
gr_buffer_sptr | gr_make_buffer (int nitems, size_t sizeof_item, gr_block_sptr link) |
Allocate a buffer that holds at least nitems of size sizeof_item . | |
gr_buffer_reader_sptr | gr_buffer_add_reader (gr_buffer_sptr buf, int nzero_preload, gr_block_sptr link) |
Create a new gr_buffer_reader and attach it to buffer buf . |
Single writer, multiple reader fifo.
virtual gr_buffer::~gr_buffer | ( | ) | [virtual] |
void gr_buffer::add_item_tag | ( | const pmt::pmt_t & | tag | ) |
Adds a new tag to the buffer.
tag | a PMT tuple containing the new tag |
int gr_buffer::bufsize | ( | ) | const [inline] |
return size of this buffer in items
References d_bufsize.
bool gr_buffer::done | ( | ) | const [inline] |
std::deque<pmt::pmt_t>::iterator gr_buffer::get_tags_begin | ( | ) | [inline] |
std::deque<pmt::pmt_t>::iterator gr_buffer::get_tags_end | ( | ) | [inline] |
gr_block_sptr gr_buffer::link | ( | ) | [inline] |
Return the block that writes to this buffer.
gruel::mutex* gr_buffer::mutex | ( | ) | [inline] |
uint64_t gr_buffer::nitems_written | ( | ) | [inline] |
size_t gr_buffer::nreaders | ( | ) | const [inline] |
void gr_buffer::prune_tags | ( | uint64_t | max_time | ) |
Removes all tags before max_time
from buffer.
max_time | the time (item number) to trim up until. |
gr_buffer_reader* gr_buffer::reader | ( | size_t | index | ) | [inline] |
void gr_buffer::set_done | ( | bool | done | ) |
int gr_buffer::space_available | ( | ) |
return number of items worth of space available for writing
void gr_buffer::update_write_pointer | ( | int | nitems | ) |
tell buffer that we wrote nitems
into it
void* gr_buffer::write_pointer | ( | ) |
return pointer to write buffer.
The return value points at space that can hold at least space_available() items.
gr_buffer_reader_sptr gr_buffer_add_reader | ( | gr_buffer_sptr | buf, |
int | nzero_preload, | ||
gr_block_sptr | link | ||
) | [friend] |
Create a new gr_buffer_reader and attach it to buffer buf
.
buf | is the buffer the gr_buffer_reader reads from. |
nzero_preload | -- number of zero items to "preload" into buffer. |
link | is the block that reads from the buffer using this gr_buffer_reader. |
friend class gr_buffer_reader [friend] |
gr_buffer_sptr gr_make_buffer | ( | int | nitems, |
size_t | sizeof_item, | ||
gr_block_sptr | link | ||
) | [friend] |
Allocate a buffer that holds at least nitems
of size sizeof_item
.
The total size of the buffer will be rounded up to a system dependent boundary. This is typically the system page size, but under MS windows is 64KB.
nitems | is the minimum number of items the buffer will hold. |
sizeof_item | is the size of an item in bytes. |
link | is the block that writes to this buffer. |
char* gr_buffer::d_base [protected] |
unsigned int gr_buffer::d_bufsize [protected] |
Referenced by bufsize().