11 #ifndef INCLUDED_GR_RUNTIME_BLOCK_H
12 #define INCLUDED_GR_RUNTIME_BLOCK_H
247 void consume(
int which_input,
int how_many_items);
268 void produce(
int which_output,
int how_many_items);
313 return (uint64_t)d_mp_relative_rate.get_num().get_ui();
322 return (uint64_t)d_mp_relative_rate.get_den().get_ui();
550 const std::vector<int>& downstream_max_nitems_vec,
551 const std::vector<uint64_t>& downstream_lcm_nitems_vec,
552 const std::vector<uint32_t>& downstream_max_out_mult_vec);
567 buffer_sptr
replace_buffer(
size_t src_port,
size_t dst_port, block_sptr block_owner);
784 int d_output_multiple;
785 bool d_output_multiple_set;
788 double d_relative_rate;
789 mpq_class d_mp_relative_rate;
790 block_detail_sptr d_detail;
792 unsigned d_attr_delay;
794 bool d_max_noutput_items_set;
795 int d_max_noutput_items;
796 int d_min_noutput_items;
798 d_tag_propagation_policy;
799 std::vector<int> d_affinity;
834 this->add_item_tag(which_output, tag);
868 this->remove_item_tag(which_input, tag);
893 unsigned int which_input,
913 unsigned int which_input,
940 unsigned int which_input,
957 unsigned int which_input,
970 int downstream_max_nitems,
971 uint64_t downstream_lcm_nitems,
972 uint32_t downstream_max_out_mult);
977 unsigned int d_blkd_input_timer_value = 250;
998 block_detail_sptr
detail()
const {
return d_detail; }
999 void set_detail(block_detail_sptr detail) { d_detail = detail; }
1015 inline block_sptr cast_to_block_sptr(basic_block_sptr p)
1017 return std::dynamic_pointer_cast<block, basic_block>(p);
The abstract base class for all signal processing blocks.
Definition: basic_block.h:63
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
void set_processor_affinity(const std::vector< int > &mask) override
Set the thread's affinity to processor core n.
float pc_input_buffers_full_var(int which)
Gets variance of fullness of which input buffer.
int unaligned() const
Definition: gnuradio-runtime/include/gnuradio/block.h:234
virtual bool stop()
Called to disable drivers, etc for i/o devices.
float pc_input_buffers_full_avg(int which)
Gets average fullness of which input buffer.
int active_thread_priority()
Get the current thread priority in use.
mpq_class & mp_relative_rate()
return a reference to the multiple precision rational representation of the approximate output rate /...
Definition: gnuradio-runtime/include/gnuradio/block.h:329
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
void set_is_unaligned(bool u)
std::vector< float > pc_output_buffers_full_avg()
Gets average fullness of all output buffers.
float pc_output_buffers_full_avg(int which)
Gets average fullness of which output buffer.
void consume_each(int how_many_items)
Tell the scheduler how_many_items were consumed on each input stream.
buffer_sptr replace_buffer(size_t src_port, size_t dst_port, block_sptr block_owner)
Replace the block's buffer with a new one owned by the block_owner parameter.
float pc_nproduced_var()
Gets variance of num items produced performance counter.
uint64_t nitems_read(unsigned int which_input)
Return the number of items read on input stream which_input.
const pmt::pmt_t d_system_port
Definition: gnuradio-runtime/include/gnuradio/block.h:995
double relative_rate() const
return the approximate output rate / input rate
Definition: gnuradio-runtime/include/gnuradio/block.h:305
float pc_output_buffers_full_var(int which)
Gets variance of fullness of which output buffer.
std::vector< float > pc_input_buffers_full_var()
Gets variance of fullness of all input buffers.
float pc_work_time_total()
Gets total clock cycles spent in work.
void set_inverse_relative_rate(double inverse_relative_rate)
Set the approximate output rate / input rate using its reciprocal.
std::vector< float > pc_input_buffers_full()
Gets instantaneous fullness of all input buffers.
float pc_work_time_avg()
Gets average clock cycles spent in work.
std::vector< int > processor_affinity() override
Get the current processor affinity.
Definition: gnuradio-runtime/include/gnuradio/block.h:728
unsigned int blkd_input_timer_value()
DEPRECATED Returns timer value set when input is blocked.
float pc_noutput_items_avg()
Gets average noutput_items performance counter.
void system_handler(pmt::pmt_t msg)
the system message handler
void allocate_detail(int ninputs, int noutputs, const std::vector< int > &downstream_max_nitems_vec, const std::vector< uint64_t > &downstream_lcm_nitems_vec, const std::vector< uint32_t > &downstream_max_out_mult_vec)
Allocate the block_detail and necessary output buffers for this block.
void get_tags_in_window(std::vector< tag_t > &v, unsigned int which_input, uint64_t rel_start, uint64_t rel_end, const pmt::pmt_t &key)
Operates like gr::block::get_tags_in_window with the ability to only return tags with the specified k...
void unset_max_noutput_items()
Clear the switch for using the max_noutput_items value of this block.
void remove_item_tag(unsigned int which_input, uint64_t abs_offset, const pmt::pmt_t &key, const pmt::pmt_t &value, const pmt::pmt_t &srcid=pmt::PMT_F)
DEPRECATED. Will be removed in 3.8.
Definition: gnuradio-runtime/include/gnuradio/block.h:857
void set_min_output_buffer(int port, long min_output_buffer)
Request limit on min buffer size on output port port.
void consume(int which_input, int how_many_items)
Tell the scheduler how_many_items of input stream which_input were consumed.
void set_tag_propagation_policy(tag_propagation_policy_t p)
Set the policy by the scheduler to determine how tags are moved downstream.
tag_propagation_policy_t tag_propagation_policy()
Asks for the policy used by the scheduler to moved tags downstream.
float pc_work_time_var()
Gets average clock cycles spent in work.
float pc_input_buffers_full(int which)
Gets instantaneous fullness of which input buffer.
void set_alignment(int multiple)
Constrains buffers to work on a set item alignment (for SIMD)
std::vector< long > d_min_output_buffer
Definition: gnuradio-runtime/include/gnuradio/block.h:975
void set_unaligned(int na)
bool is_set_max_noutput_items()
Ask the block if the flag is or is not set to use the internal value of max_noutput_items during a ca...
int thread_priority()
Get the current thread priority stored.
virtual void forecast(int noutput_items, gr_vector_int &ninput_items_required)
Estimate input requirements given output request.
long max_output_buffer(size_t i)
Returns max buffer size on output port i.
unsigned sample_delay(int which) const
block(void)
Definition: gnuradio-runtime/include/gnuradio/block.h:806
void set_output_multiple(int multiple)
Constrain the noutput_items argument passed to forecast and general_work.
void set_min_noutput_items(int m)
Set the minimum number of output items this block can produce during a call to work.
Definition: gnuradio-runtime/include/gnuradio/block.h:387
uint64_t relative_rate_d() const
return the denominator, or decimation rate, of the approximate output rate / input rate
Definition: gnuradio-runtime/include/gnuradio/block.h:320
std::vector< float > pc_output_buffers_full()
Gets instantaneous fullness of all output buffers.
void set_max_output_buffer(long max_output_buffer)
Request limit on max buffer size on all output ports.
void enable_update_rate(bool en)
buffer_sptr allocate_buffer(size_t port, int downstream_max_nitems, uint64_t downstream_lcm_nitems, uint32_t downstream_max_out_mult)
Allocate a buffer for the given output port of this block. Note that the downstream max number of ite...
uint64_t nitems_written(unsigned int which_output)
Return the number of items written on output stream which_output.
void no_pc_rpc()
If the block calls this in its constructor, it's perf. counters will not be exported.
Definition: gnuradio-runtime/include/gnuradio/block.h:707
std::string identifier() const
void set_detail(block_detail_sptr detail)
Definition: gnuradio-runtime/include/gnuradio/block.h:999
float pc_throughput_avg()
Gets average throughput.
std::string log_level() override
Get the logger's output level.
virtual bool start()
Called to enable drivers, etc for i/o devices.
void get_tags_in_range(std::vector< tag_t > &v, unsigned int which_input, uint64_t abs_start, uint64_t abs_end, const pmt::pmt_t &key)
Given a [start,end), returns a vector of all tags in the range with a given key.
int set_thread_priority(int priority)
Set the current thread priority.
void unset_processor_affinity() override
Remove processor affinity to a specific core.
float pc_nproduced()
Gets instantaneous num items produced performance counter.
bool finished()
returns true when execution has completed due to a message connection
void add_item_tag(unsigned int which_output, uint64_t abs_offset, const pmt::pmt_t &key, const pmt::pmt_t &value, const pmt::pmt_t &srcid=pmt::PMT_F)
Adds a new tag onto the given output buffer.
Definition: gnuradio-runtime/include/gnuradio/block.h:823
void add_item_tag(unsigned int which_output, const tag_t &tag)
Adds a new tag onto the given output buffer.
void setup_pc_rpc()
Sets up export of perf. counters to ControlPort. Only called by the scheduler.
void remove_item_tag(unsigned int which_input, const tag_t &tag)
DEPRECATED. Will be removed in 3.8.
virtual int fixed_rate_ninput_to_noutput(int ninput)
Given ninput samples, return number of output samples that will be produced. N.B. this is only define...
void set_max_output_buffer(int port, long max_output_buffer)
Request limit on max buffer size on output port port.
int alignment() const
Definition: gnuradio-runtime/include/gnuradio/block.h:231
int output_multiple() const
Definition: gnuradio-runtime/include/gnuradio/block.h:210
void expand_minmax_buffer(int port)
void set_min_output_buffer(long min_output_buffer)
Request limit on the minimum buffer size on all output ports.
void get_tags_in_range(std::vector< tag_t > &v, unsigned int which_input, uint64_t abs_start, uint64_t abs_end)
Given a [start,end), returns a vector of all tags in the range.
std::vector< float > pc_input_buffers_full_avg()
Gets average fullness of all input buffers.
void produce(int which_output, int how_many_items)
Tell the scheduler how_many_items were produced on output stream which_output.
bool is_unaligned() const
Definition: gnuradio-runtime/include/gnuradio/block.h:236
uint64_t relative_rate_i() const
return the numerator, or interpolation rate, of the approximate output rate / input rate
Definition: gnuradio-runtime/include/gnuradio/block.h:311
void declare_sample_delay(unsigned delay)
void set_fixed_rate(bool fixed_rate)
Definition: gnuradio-runtime/include/gnuradio/block.h:811
work_return_t
Magic return values from general_work.
Definition: gnuradio-runtime/include/gnuradio/block.h:66
gr::thread::mutex d_setlock
Definition: gnuradio-runtime/include/gnuradio/block.h:984
float pc_output_buffers_full(int which)
Gets instantaneous fullness of which output buffer.
std::vector< long > d_max_output_buffer
Definition: gnuradio-runtime/include/gnuradio/block.h:974
bool fixed_rate() const
Return true if this block has a fixed input to output rate.
Definition: gnuradio-runtime/include/gnuradio/block.h:138
int min_noutput_items() const
Return the minimum number of output items this block can produce during a call to work.
Definition: gnuradio-runtime/include/gnuradio/block.h:379
tag_propagation_policy_t
enum to represent different tag propagation policies.
Definition: gnuradio-runtime/include/gnuradio/block.h:71
void set_blkd_input_timer_value(unsigned int timer_value_ms)
DEPRECATED Configure the timer set when input is blocked port.
virtual int fixed_rate_noutput_to_ninput(int noutput)
Given noutput samples, return number of input samples required to produce noutput....
void get_tags_in_window(std::vector< tag_t > &v, unsigned int which_input, uint64_t rel_start, uint64_t rel_end)
Gets all tags within the relative window of the current call to work.
bool is_pc_rpc_set() const
Checks if this block is already exporting perf. counters to ControlPort.
Definition: gnuradio-runtime/include/gnuradio/block.h:701
long min_output_buffer(size_t i)
Returns min buffer size on output port i.
void set_history(unsigned history)
void declare_sample_delay(int which, unsigned delay)
block_detail_sptr detail() const
Definition: gnuradio-runtime/include/gnuradio/block.h:998
float pc_nproduced_avg()
Gets average num items produced performance counter.
bool output_multiple_set() const
Definition: gnuradio-runtime/include/gnuradio/block.h:211
const pmt::pmt_t d_pmt_done
Definition: gnuradio-runtime/include/gnuradio/block.h:991
void reset_perf_counters()
Resets the performance counters.
void notify_msg_neighbors()
Tell msg neighbors we are finished.
void set_relative_rate(uint64_t interpolation, uint64_t decimation)
Set the approximate output rate / input rate as an integer ratio.
float pc_noutput_items_var()
Gets variance of noutput_items performance counter.
void set_max_noutput_items(int m)
Set the maximum number of output items this block will handle during a call to work.
void set_log_level(const std::string &level) override
Set the logger's output level.
float pc_work_time()
Gets instantaneous clock cycles spent in work.
block(const std::string &name, gr::io_signature::sptr input_signature, gr::io_signature::sptr output_signature)
void clear_finished()
Make sure we don't think we are finished.
Definition: gnuradio-runtime/include/gnuradio/block.h:1007
float pc_noutput_items()
Gets instantaneous noutput_items performance counter.
int max_noutput_items()
Return the maximum number of output items this block will handle during a call to work.
void set_relative_rate(double relative_rate)
Set the approximate output rate / input rate.
std::vector< float > pc_output_buffers_full_var()
Gets variance of fullness of all output buffers.
std::shared_ptr< io_signature > sptr
Definition: io_signature.h:52
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:18
GR_RUNTIME_API const pmt::pmt_t msg()
boost::mutex mutex
Definition: thread.h:37
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::vector< block_sptr >::iterator block_viter_t
Definition: gnuradio-runtime/include/gnuradio/block.h:1013
std::vector< block_sptr > block_vector_t
Definition: gnuradio-runtime/include/gnuradio/block.h:1012
std::ostream & operator<<(std::ostream &os, basic_block_sptr basic_block)
Definition: basic_block.h:436
std::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting).
Definition: pmt.h:83
#define PMT_F
Definition: pmt.h:123
uint64_t offset
the item tag occurred at (as a uint64_t)
Definition: tags.h:21
pmt::pmt_t srcid
the source ID of tag (as a PMT)
Definition: tags.h:30
pmt::pmt_t value
the value of tag (as a PMT)
Definition: tags.h:27
pmt::pmt_t key
the key of tag (as a PMT symbol)
Definition: tags.h:24
Definition: cc_common.h:35
std::vector< const void * > gr_vector_const_void_star
Definition: types.h:28
std::vector< void * > gr_vector_void_star
Definition: types.h:27
std::vector< int > gr_vector_int
Definition: types.h:23