GNU Radio 3.6.5.1 C++ API
gr::digital::packet_headergenerator_bb_impl Class Reference

#include <packet_headergenerator_bb_impl.h>

Inheritance diagram for gr::digital::packet_headergenerator_bb_impl:
gr::digital::packet_headergenerator_bb gr_tagged_stream_block gr_block gr_basic_block gr_msg_accepter gruel::msg_accepter

Public Member Functions

 packet_headergenerator_bb_impl (const packet_header_default::sptr &header_formatter, const std::string &len_tag_key)
 ~packet_headergenerator_bb_impl ()
void remove_length_tags (const std::vector< std::vector< gr_tag_t > > &tags)
int calculate_output_stream_length (const gr_vector_int &ninput_items)
 Calculate the number of output items.
int work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
 Just like gr_block::general_work, but makes sure the input is valid.

Additional Inherited Members

- Public Types inherited from gr::digital::packet_headergenerator_bb
typedef boost::shared_ptr
< packet_headergenerator_bb
sptr
- Static Public Member Functions inherited from gr::digital::packet_headergenerator_bb
static sptr make (const packet_header_default::sptr &header_formatter, const std::string &len_tag_key="packet_len")
static sptr make (long header_len, const std::string &len_tag_key="packet_len")
- Protected Types inherited from gr_basic_block
enum  vcolor { WHITE, GREY, BLACK }
- Protected Member Functions inherited from gr_tagged_stream_block
 gr_tagged_stream_block (void)
 gr_tagged_stream_block (const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature, const std::string &length_tag_key)
virtual void parse_length_tags (const std::vector< std::vector< gr_tag_t > > &tags, gr_vector_int &n_input_items_reqd)
 Parse all tags on the first sample of a PDU, return the number of items per input and prune the length tags.
virtual void update_length_tags (int n_produced, int n_ports)
 Set the new length tags on the output stream.
- Protected Attributes inherited from gr_tagged_stream_block
std::string d_length_tag_key_str

Constructor & Destructor Documentation

gr::digital::packet_headergenerator_bb_impl::packet_headergenerator_bb_impl ( const packet_header_default::sptr header_formatter,
const std::string &  len_tag_key 
)
gr::digital::packet_headergenerator_bb_impl::~packet_headergenerator_bb_impl ( )

Member Function Documentation

int gr::digital::packet_headergenerator_bb_impl::calculate_output_stream_length ( const gr_vector_int ninput_items)
inlinevirtual

Calculate the number of output items.

This is basically the inverse function to forecast(): Given a number of input items, it returns the maximum number of output items.

You most likely need to override this function, unless your block is a sync block or integer interpolator/decimator.

Reimplemented from gr_tagged_stream_block.

void gr::digital::packet_headergenerator_bb_impl::remove_length_tags ( const std::vector< std::vector< gr_tag_t > > &  tags)
inline
int gr::digital::packet_headergenerator_bb_impl::work ( int  noutput_items,
gr_vector_int ninput_items,
gr_vector_const_void_star input_items,
gr_vector_void_star output_items 
)
virtual

Just like gr_block::general_work, but makes sure the input is valid.

The user must override work to define the signal processing code. Check the documentation for general_work() to see what happens here.

Like gr_sync_block, this calls consume() for you (it consumes ninput_items[i] items from the i-th port).

A note on tag propagation: The PDU length tags are handled by other functions, but all other tags are handled just as in any other gr_block. So, most likely, you either set the tag propagation policy to TPP_DONT and handle the tag propagation manually, or you propagate tags through the scheduler and don't do anything here.

Parameters
noutput_itemsThe size of the writable output buffer
ninput_itemsThe exact size of the items on every input for this particular PDU. These will be consumed if a length tag key is provided!
input_itemsSee gr_block
output_itemsSee gr_block

Implements gr_tagged_stream_block.


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