GNU Radio 3.7.1 C++ API
|
Single writer, multiple reader fifo. More...
#include <buffer.h>
Public Member Functions | |
virtual | ~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 |
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 () |
size_t | get_sizeof_item () |
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::deque< tag_t >::iterator | get_tags_begin () |
std::deque< tag_t >::iterator | get_tags_end () |
Protected Attributes | |
char * | d_base |
unsigned int | d_bufsize |
Friends | |
class | buffer_reader |
GR_RUNTIME_API buffer_sptr | make_buffer (int nitems, size_t sizeof_item, block_sptr link) |
Allocate a buffer that holds at least nitems of size sizeof_item . | |
GR_RUNTIME_API buffer_reader_sptr | buffer_add_reader (buffer_sptr buf, int nzero_preload, block_sptr link) |
Create a new gr::buffer_reader and attach it to buffer buf . |
Single writer, multiple reader fifo.
virtual gr::buffer::~buffer | ( | ) | [virtual] |
void gr::buffer::add_item_tag | ( | const tag_t & | tag | ) |
Adds a new tag to the buffer.
tag | the new tag |
int gr::buffer::bufsize | ( | ) | const [inline] |
return size of this buffer in items
bool gr::buffer::done | ( | ) | const [inline] |
size_t gr::buffer::get_sizeof_item | ( | ) | [inline] |
std::deque<tag_t>::iterator gr::buffer::get_tags_begin | ( | ) | [inline] |
std::deque<tag_t>::iterator gr::buffer::get_tags_end | ( | ) | [inline] |
block_sptr gr::buffer::link | ( | ) | [inline] |
Return the block that writes to this buffer.
gr::thread::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. |
buffer_reader* gr::buffer::reader | ( | size_t | index | ) | [inline] |
void gr::buffer::remove_item_tag | ( | const tag_t & | tag, |
long | id | ||
) |
Removes an existing tag from the buffer.
If no such tag is found, does nothing. Note: Doesn't actually physically delete the tag, but marks it as deleted. For the user, this has the same effect: Any subsequent calls to get_tags_in_range() will not return the tag.
tag | the tag that needs to be removed |
id | the unique ID of the block calling this function |
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
return pointer to write buffer.
The return value points at space that can hold at least space_available() items.
GR_RUNTIME_API buffer_reader_sptr buffer_add_reader | ( | buffer_sptr | buf, |
int | nzero_preload, | ||
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 buffer_reader [friend] |
GR_RUNTIME_API buffer_sptr make_buffer | ( | int | nitems, |
size_t | sizeof_item, | ||
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] |