GNU Radio 3.6.4.2 C++ API
|
#include <gr_block.h>
Public Types | |
enum | { WORK_CALLED_PRODUCE = -2, WORK_DONE = -1 } |
Return options for the work call. More... | |
enum | tag_propagation_policy_t { TPP_DONT = 0, TPP_ALL_TO_ALL = 1, TPP_ONE_TO_ONE = 2 } |
typedef std::deque< pmt::pmt_t > | msg_queue_t |
typedef std::map< pmt::pmt_t, msg_queue_t, pmt::pmt_comperator > | msg_queue_map_t |
typedef std::map< pmt::pmt_t, msg_queue_t, pmt::pmt_comperator > ::iterator | msg_queue_map_itr |
typedef boost::function< void(pmt::pmt_t)> | msg_handler_t |
typedef std::map< pmt::pmt_t, msg_handler_t, pmt::pmt_comperator > | d_msg_handlers_t |
Public Member Functions | |
gr_block (void) | |
gr_block (const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature) | |
long | unique_id (void) const |
std::string | name (void) const |
virtual | ~gr_block (void) |
gr_io_signature_sptr | input_signature (void) const |
gr_io_signature_sptr | output_signature (void) const |
void | set_input_signature (gr_io_signature_sptr sig) |
void | set_output_signature (gr_io_signature_sptr sig) |
virtual bool | check_topology (int ninputs, int noutputs) |
virtual void | forecast (int, std::vector< int > &) |
Overload me! I am the forecast. More... | |
virtual int | general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) |
compute output items from input items More... | |
virtual bool | start (void) |
virtual bool | stop (void) |
void | consume_each (const int how_many_items) |
Call during work to consume items. More... | |
void | consume (const size_t i, const int how_many_items) |
void | produce (const size_t o, const int how_many_items) |
uint64_t | nitems_read (const size_t which_input=0) |
Get absolute count of all items consumed on the given input port. More... | |
uint64_t | nitems_written (const size_t which_output=0) |
Get absolute count of all items produced on the given output port. More... | |
void | add_item_tag (const size_t which_output, const gr_tag_t &tag) |
void | add_item_tag (const size_t which_output, uint64_t abs_offset, const pmt::pmt_t &key, const pmt::pmt_t &value, const pmt::pmt_t &srcid=pmt::PMT_F) |
void | get_tags_in_range (std::vector< gr_tag_t > &tags, const size_t which_input, uint64_t abs_start, uint64_t abs_end, const pmt::pmt_t &key=pmt::pmt_t()) |
void | set_alignment (const size_t alignment) |
bool | is_unaligned (void) |
size_t | fixed_rate_noutput_to_ninput (const size_t noutput_items) |
size_t | interpolation (void) const |
void | set_interpolation (const size_t) |
size_t | decimation (void) const |
void | set_decimation (const size_t) |
int | max_noutput_items (void) const |
void | set_max_noutput_items (int) |
void | unset_max_noutput_items (void) |
bool | is_set_max_noutput_items (void) const |
unsigned | history (void) const |
void | set_history (unsigned history) |
void | set_fixed_rate (const bool fixed_rate) |
bool | fixed_rate (void) const |
Get the fixed rate setting. More... | |
void | set_relative_rate (const double relative_rate) |
double | relative_rate (void) const |
Get the relative rate setting. More... | |
void | set_output_multiple (const size_t multiple) |
size_t | output_multiple (void) const |
Get the output multiple setting. More... | |
tag_propagation_policy_t | tag_propagation_policy (void) |
void | set_tag_propagation_policy (tag_propagation_policy_t p) |
void | set_max_output_buffer (long) |
void | set_max_output_buffer (int, long) |
long | max_output_buffer (size_t) |
void | set_min_output_buffer (long) |
void | set_min_output_buffer (int, long) |
long | min_output_buffer (size_t) |
std::string | symbol_name () const |
bool | alias_set () |
std::string | alias () |
pmt::pmt_t | alias_pmt () |
void | set_block_alias (std::string name) |
template<typename T > | |
void | set_msg_handler (pmt::pmt_t which_port, T msg_handler) |
void | message_port_register_in (pmt::pmt_t) |
void | message_port_register_out (pmt::pmt_t) |
void | message_port_pub (pmt::pmt_t, pmt::pmt_t) |
void | message_port_sub (pmt::pmt_t, pmt::pmt_t) |
void | message_port_unsub (pmt::pmt_t, pmt::pmt_t) |
virtual bool | message_port_is_hier (pmt::pmt_t port_id) |
virtual bool | message_port_is_hier_in (pmt::pmt_t port_id) |
virtual bool | message_port_is_hier_out (pmt::pmt_t port_id) |
pmt::pmt_t | message_ports_in () |
Get input message port names. More... | |
pmt::pmt_t | message_ports_out () |
Get output message port names. More... | |
bool | empty_p (pmt::pmt_t which_port) |
is the queue empty? More... | |
bool | empty_p () |
void | insert_tail (pmt::pmt_t, pmt::pmt_t) |
pmt::pmt_t | delete_head_nowait (pmt::pmt_t) |
pmt::pmt_t | delete_head_blocking (pmt::pmt_t) |
msg_queue_t::iterator | get_iterator (pmt::pmt_t which_port) |
void | erase_msg (pmt::pmt_t which_port, msg_queue_t::iterator it) |
virtual bool | has_msg_port (pmt::pmt_t which_port) |
bool | has_msg_handler (pmt::pmt_t which_port) |
Tests if there is a handler attached to port which_port . More... | |
virtual void | dispatch_msg (pmt::pmt_t which_port, pmt::pmt_t msg) |
void | set_processor_affinity (const std::vector< int > &mask) |
Set the thread's affinity to processor core n . More... | |
void | unset_processor_affinity () |
Remove processor affinity to a specific core. More... | |
std::vector< int > | processor_affinity () |
Get the current processor affinity. More... | |
void | work (const InputItems &, const OutputItems &) |
implements work -> calls general work More... | |
void | notify_topology (const size_t, const size_t) |
notifications of new topological commits More... | |
void | notify_active (void) |
start notification More... | |
void | notify_inactive (void) |
stop notification More... | |
virtual void | propagate_tags (const size_t, const gras::TagIter &) |
implements tag_propagation_policy() More... | |
void | _update_input_reserve (void) |
gras::BufferQueueSptr | input_buffer_allocator (const size_t, const gras::SBufferConfig &) |
gras::BufferQueueSptr | output_buffer_allocator (const size_t, const gras::SBufferConfig &) |
Public Attributes | |
long | _unique_id |
std::string | _name |
std::string | d_symbol_alias |
std::string | d_symbol_name |
msg_queue_map_t | msg_queue |
pmt::pmt_t | message_subscribers |
d_msg_handlers_t | d_msg_handlers |
gruel::mutex | d_setlock |
std::vector< int > | d_affinity |
gr_vector_int | _work_ninput_items |
gr_vector_int | _fcast_ninput_items |
size_t | _num_outputs |
ptrdiff_t | _work_io_ptr_mask |
size_t | _output_multiple_items |
double | _relative_rate |
bool | _enable_fixed_rate |
size_t | _input_history_items |
tag_propagation_policy_t | _tag_prop_policy |
size_t | _interp |
size_t | _decim |
gr_io_signature_sptr | _in_sig |
gr_io_signature_sptr | _out_sig |
typedef std::map<pmt::pmt_t , msg_handler_t, pmt::pmt_comperator> gr_block::d_msg_handlers_t |
typedef boost::function<void(pmt::pmt_t)> gr_block::msg_handler_t |
typedef std::map<pmt::pmt_t, msg_queue_t, pmt::pmt_comperator>::iterator gr_block::msg_queue_map_itr |
typedef std::map<pmt::pmt_t, msg_queue_t, pmt::pmt_comperator> gr_block::msg_queue_map_t |
typedef std::deque<pmt::pmt_t> gr_block::msg_queue_t |
gr_block::gr_block | ( | void | ) |
gr_block::gr_block | ( | const std::string & | name, |
gr_io_signature_sptr | input_signature, | ||
gr_io_signature_sptr | output_signature | ||
) |
|
virtual |
Referenced by gr_block_gateway::gr_block__add_item_tag().
void gr_block::add_item_tag | ( | const size_t | which_output, |
uint64_t | abs_offset, | ||
const pmt::pmt_t & | key, | ||
const pmt::pmt_t & | value, | ||
const pmt::pmt_t & | srcid = pmt::PMT_F |
||
) |
|
inline |
|
inline |
References pmt::pmt_intern().
|
inline |
|
virtual |
Reimplemented in gr_pfb_clock_sync_ccf, gr_pfb_clock_sync_fff, gr_test, comedi_source_s, comedi_sink_s, gr_align_on_samplenumbers_ss, gr_oscope_sink_f, gr_deinterleave, gr_interleave, gr_copy, gr_kludge_copy, gr::blocks::deinterleave_impl, and gr::blocks::interleave_impl.
Referenced by gr_test::set_check_topology().
GRAS_FORCE_INLINE void gr_block::consume | ( | const size_t | i, |
const int | how_many_items | ||
) |
Referenced by gr_block_gateway::gr_block__consume().
GRAS_FORCE_INLINE void gr_block::consume_each | ( | const int | how_many_items | ) |
Call during work to consume items.
Referenced by gr_sync_block::general_work(), and gr_block_gateway::gr_block__consume_each().
GRAS_FORCE_INLINE size_t gr_block::decimation | ( | void | ) | const |
References _decim.
Referenced by gr_sync_block::general_work().
|
inline |
References pmt::PMT_NIL.
|
inline |
References pmt::PMT_NIL.
|
inlinevirtual |
Reimplemented in gr_block_gateway.
Referenced by gr_block_gateway::dispatch_msg().
|
inline |
is the queue empty?
|
inline |
|
inline |
Get the fixed rate setting.
Referenced by gr_block_gateway::gr_block__fixed_rate().
size_t gr_block::fixed_rate_noutput_to_ninput | ( | const size_t | noutput_items | ) |
|
virtual |
Overload me! I am the forecast.
|
virtual |
compute output items from input items
noutput_items | number of output items to write on each output stream |
ninput_items | number of input items available on each input stream |
input_items | vector of pointers to the input items, one entry per input stream |
output_items | vector of pointers to the output items, one entry per output stream |
general_work must call consume or consume_each to indicate how many items were consumed on each input stream.
Reimplemented in gr_pfb_clock_sync_ccf, gr_pfb_clock_sync_fff, gr_pfb_channelizer_ccf, gr_pfb_arb_resampler_ccf, gr_pfb_arb_resampler_fff, qtgui_sink_c, qtgui_sink_f, gr_simple_correlator, gr_align_on_samplenumbers_ss, gr_stream_mux, gr_rational_resampler_base_ccc, gr_rational_resampler_base_ccf, gr_rational_resampler_base_fcc, gr_rational_resampler_base_fff, gr_rational_resampler_base_fsf, gr_rational_resampler_base_scc, gr::filter::pfb_arb_resampler_ccf_impl, gr::filter::pfb_arb_resampler_fff_impl, gr_ofdm_bpsk_demapper, gr_test, gr::filter::pfb_channelizer_ccf_impl, gr_copy, gr_keep_m_in_n, gr_delay, gr_skiphead, gr_keep_one_in_n, gr_squelch_base_cc, gr_squelch_base_ff, gr_nop, gr_simple_framer, gr_vector_insert_b, gr::blocks::delay_impl, gr::filter::fractional_interpolator_cc_impl, gr::filter::fractional_interpolator_ff_impl, gr_fractional_interpolator_cc, gr_fractional_interpolator_ff, gr::blocks::stream_mux_impl, gr::blocks::keep_m_in_n_impl, gr::blocks::keep_one_in_n_impl, gr_sync_block, and gr::blocks::patterned_interleaver_impl.
|
inline |
void gr_block::get_tags_in_range | ( | std::vector< gr_tag_t > & | tags, |
const size_t | which_input, | ||
uint64_t | abs_start, | ||
uint64_t | abs_end, | ||
const pmt::pmt_t & | key = pmt::pmt_t() |
||
) |
Referenced by gr_block_gateway::gr_block__get_tags_in_range().
|
inline |
Tests if there is a handler attached to port which_port
.
|
inlinevirtual |
References pmt::pmt_dict_has_key().
unsigned gr_block::history | ( | void | ) | const |
Referenced by gr_delay::delay(), gr::blocks::delay_impl::dly(), gr_test::forecast(), gr_block_gateway::gr_block__history(), gr_rational_resampler_base_fff::set_history(), gr_rational_resampler_base_fcc::set_history(), gr_rational_resampler_base_scc::set_history(), gr_rational_resampler_base_ccc::set_history(), gr_rational_resampler_base_ccf::set_history(), and gr_rational_resampler_base_fsf::set_history().
gras::BufferQueueSptr gr_block::input_buffer_allocator | ( | const size_t | , |
const gras::SBufferConfig & | |||
) |
gr_io_signature_sptr gr_block::input_signature | ( | void | ) | const |
|
inline |
GRAS_FORCE_INLINE size_t gr_block::interpolation | ( | void | ) | const |
References _interp.
Referenced by gr_sync_block::general_work().
References _work_io_ptr_mask.
int gr_block::max_noutput_items | ( | void | ) | const |
|
inline |
|
inlinevirtual |
References void().
|
inlinevirtual |
References void().
|
inlinevirtual |
References void().
|
inline |
Referenced by gr_block_gateway::gr_block__message_port_pub().
|
inline |
Referenced by gr_block_gateway::gr_block__message_port_register_in().
|
inline |
Referenced by gr_block_gateway::gr_block__message_port_register_out().
|
inline |
Referenced by gr_block_gateway::gr_block__message_port_sub().
|
inline |
Referenced by gr_block_gateway::gr_block__message_port_unsub().
|
inline |
Get input message port names.
Returns the available input message ports for a block. The return object is a PMT vector that is filled with PMT symbols.
References pmt::PMT_NIL.
Referenced by gr_block_gateway::gr_block__message_ports_in().
|
inline |
Get output message port names.
Returns the available output message ports for a block. The return object is a PMT vector that is filled with PMT symbols.
References pmt::PMT_NIL.
Referenced by gr_block_gateway::gr_block__message_ports_out().
|
inline |
|
inline |
Referenced by gr_block_gateway::gr_block__name().
GRAS_FORCE_INLINE uint64_t gr_block::nitems_read | ( | const size_t | which_input = 0 | ) |
Get absolute count of all items consumed on the given input port.
Referenced by gr_block_gateway::gr_block__nitems_read().
GRAS_FORCE_INLINE uint64_t gr_block::nitems_written | ( | const size_t | which_output = 0 | ) |
Get absolute count of all items produced on the given output port.
Referenced by gr_block_gateway::gr_block__nitems_written().
void gr_block::notify_topology | ( | const size_t | , |
const size_t | |||
) |
notifications of new topological commits
gras::BufferQueueSptr gr_block::output_buffer_allocator | ( | const size_t | , |
const gras::SBufferConfig & | |||
) |
size_t gr_block::output_multiple | ( | void | ) | const |
Get the output multiple setting.
Referenced by gr_block_gateway::gr_block__output_multiple().
gr_io_signature_sptr gr_block::output_signature | ( | void | ) | const |
|
inline |
Get the current processor affinity.
GRAS_FORCE_INLINE void gr_block::produce | ( | const size_t | o, |
const int | how_many_items | ||
) |
Referenced by gr_block_gateway::gr_block__produce().
|
virtual |
implements tag_propagation_policy()
double gr_block::relative_rate | ( | void | ) | const |
Get the relative rate setting.
Referenced by gr_test::fixed_rate_ninput_to_noutput(), gr_test::fixed_rate_noutput_to_ninput(), gr_test::forecast(), and gr_block_gateway::gr_block__relative_rate().
void gr_block::set_alignment | ( | const size_t | alignment | ) |
void gr_block::set_decimation | ( | const size_t | ) |
Enable fixed rate logic. When enabled, relative rate is assumed to be set, and forecast is automatically called. Also, consume will be called automatically.
Referenced by gr_block_gateway::gr_block__set_fixed_rate(), and gr_test::set_fixed_rate_public().
void gr_block::set_history | ( | unsigned | history | ) |
Referenced by gr_block_gateway::gr_block__set_history().
void gr_block::set_input_signature | ( | gr_io_signature_sptr | sig | ) |
void gr_block::set_interpolation | ( | const size_t | ) |
void gr_block::set_max_noutput_items | ( | int | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void gr_block::set_output_multiple | ( | const size_t | multiple | ) |
The output multiple setting controls work output buffer sizes. Buffers will be number of items modulo rounted to the multiple.
Referenced by gr_block_gateway::gr_block__set_output_multiple().
void gr_block::set_output_signature | ( | gr_io_signature_sptr | sig | ) |
|
inline |
Set the thread's affinity to processor core n
.
mask | a vector of unsigned ints of the core numbers available to this block. |
void gr_block::set_relative_rate | ( | const double | relative_rate | ) |
The relative rate can be thought of as interpolation/decimation. In other words, relative rate is the ratio of output items to input items.
Referenced by gr_block_gateway::gr_block__set_relative_rate(), gr_pfb_arb_resampler_fff::set_rate(), and gr_pfb_arb_resampler_ccf::set_rate().
void gr_block::set_tag_propagation_policy | ( | tag_propagation_policy_t | p | ) |
Referenced by gr_block_gateway::gr_block__set_tag_propagation_policy().
Reimplemented in gr_random_pdu.
|
inline |
tag_propagation_policy_t gr_block::tag_propagation_policy | ( | void | ) |
Referenced by gr_block_gateway::gr_block__tag_propagation_policy().
|
inline |
Referenced by gr_block_gateway::gr_block__unique_id().
|
inline |
Remove processor affinity to a specific core.
void gr_block::work | ( | const InputItems & | , |
const OutputItems & | |||
) |
implements work -> calls general work
size_t gr_block::_decim |
Referenced by decimation().
bool gr_block::_enable_fixed_rate |
gr_vector_int gr_block::_fcast_ninput_items |
gr_io_signature_sptr gr_block::_in_sig |
size_t gr_block::_input_history_items |
size_t gr_block::_interp |
Referenced by interpolation().
std::string gr_block::_name |
size_t gr_block::_num_outputs |
gr_io_signature_sptr gr_block::_out_sig |
size_t gr_block::_output_multiple_items |
double gr_block::_relative_rate |
tag_propagation_policy_t gr_block::_tag_prop_policy |
long gr_block::_unique_id |
ptrdiff_t gr_block::_work_io_ptr_mask |
Referenced by is_unaligned().
gr_vector_int gr_block::_work_ninput_items |
std::vector<int> gr_block::d_affinity |
d_msg_handlers_t gr_block::d_msg_handlers |
gruel::mutex gr_block::d_setlock |
Used by block's setters and work functions to make setting/resetting of parameters thread-safe.
Used by calling gruel::scoped_lock l(d_setlock);
std::string gr_block::d_symbol_alias |
std::string gr_block::d_symbol_name |
pmt::pmt_t gr_block::message_subscribers |
msg_queue_map_t gr_block::msg_queue |