GNU Radio 3.6.5 C++ API
|
Test class for testing runtime system (setting up buffers and such.)This block does not do any usefull actual data processing. It just exposes setting all standard block parameters using the contructor or public methods. More...
#include <gr_test.h>
Public Member Functions | |
~gr_test () | |
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 | forecast (int noutput_items, gr_vector_int &ninput_items_required) |
Estimate input requirements given output request. | |
void | set_check_topology (bool check_topology) |
Force check topology to return true or false. | |
bool | check_topology (int ninputs, int noutputs) |
Confirm that ninputs and noutputs is an acceptable combination. | |
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 defined if fixed_rate returns true. Generally speaking, you don't need to override this. | |
int | fixed_rate_noutput_to_ninput (int noutput) |
Given noutput samples, return number of input samples required to produce noutput. N.B. this is only defined if fixed_rate returns true. | |
void | set_fixed_rate_public (bool fixed_rate) |
Set if fixed rate should return true. N.B. This is normally a private method but we make it available here as public. | |
void | set_consume_type (gr_consume_type_t cons_type) |
Set the consume pattern. | |
void | set_consume_limit (unsigned int limit) |
Set the consume limit. | |
void | set_produce_type (gr_produce_type_t prod_type) |
Set the produce pattern. | |
void | set_produce_limit (unsigned int limit) |
Set the produce limit. | |
Protected Member Functions | |
gr_test (const std::string &name, int min_inputs, int max_inputs, unsigned int sizeof_input_item, int min_outputs, int max_outputs, unsigned int sizeof_output_item, unsigned int history, unsigned int output_multiple, double relative_rate, bool fixed_rate, gr_consume_type_t cons_type, gr_produce_type_t prod_type) | |
Protected Attributes | |
unsigned int | d_sizeof_input_item |
unsigned int | d_sizeof_output_item |
bool | d_check_topology |
char | d_temp |
gr_consume_type_t | d_consume_type |
int | d_min_consume |
int | d_max_consume |
gr_produce_type_t | d_produce_type |
int | d_min_produce |
int | d_max_produce |
Friends | |
GR_CORE_API gr_test_sptr | gr_make_test (const std::string &name, int min_inputs, int max_inputs, unsigned int sizeof_input_item, int min_outputs, int max_outputs, unsigned int sizeof_output_item, unsigned int history, unsigned int output_multiple, double relative_rate, bool fixed_rate, gr_consume_type_t cons_type, gr_produce_type_t prod_type) |
Test class for testing runtime system (setting up buffers and such.)
This block does not do any usefull actual data processing. It just exposes setting all standard block parameters using the contructor or public methods.
This block can be usefull when testing the runtime system. You can force this block to have a large history, decimation factor and/or large output_multiple. The runtime system should detect this and create large enough buffers all through the signal chain.
gr_test::~gr_test | ( | ) | [inline] |
gr_test::gr_test | ( | const std::string & | name, |
int | min_inputs, | ||
int | max_inputs, | ||
unsigned int | sizeof_input_item, | ||
int | min_outputs, | ||
int | max_outputs, | ||
unsigned int | sizeof_output_item, | ||
unsigned int | history, | ||
unsigned int | output_multiple, | ||
double | relative_rate, | ||
bool | fixed_rate, | ||
gr_consume_type_t | cons_type, | ||
gr_produce_type_t | prod_type | ||
) | [protected] |
bool gr_test::check_topology | ( | int | ninputs, |
int | noutputs | ||
) | [inline, virtual] |
Confirm that ninputs and noutputs is an acceptable combination.
ninputs | number of input streams connected |
noutputs | number of output streams connected |
This function is called by the runtime system whenever the topology changes. Most classes do not need to override this. This check is in addition to the constraints specified by the input and output gr_io_signatures.
Reimplemented from gr_basic_block.
int gr_test::fixed_rate_ninput_to_noutput | ( | int | ninput | ) | [inline, virtual] |
Given ninput samples, return number of output samples that will be produced. N.B. this is only defined if fixed_rate returns true. Generally speaking, you don't need to override this.
Reimplemented from gr_block.
References gr_block::relative_rate().
int gr_test::fixed_rate_noutput_to_ninput | ( | int | noutput | ) | [inline, virtual] |
Given noutput samples, return number of input samples required to produce noutput. N.B. this is only defined if fixed_rate returns true.
Reimplemented from gr_block.
References gr_block::relative_rate().
void gr_test::forecast | ( | int | noutput_items, |
gr_vector_int & | ninput_items_required | ||
) | [inline, virtual] |
Estimate input requirements given output request.
noutput_items | number of output items to produce |
ninput_items_required | number of input items required on each input stream |
Given a request to product noutput_items
, estimate the number of data items required on each input stream. The estimate doesn't have to be exact, but should be close.
Reimplemented from gr_block.
References gr_block::history(), and gr_block::relative_rate().
int gr_test::general_work | ( | int | noutput_items, |
gr_vector_int & | ninput_items, | ||
gr_vector_const_void_star & | input_items, | ||
gr_vector_void_star & | output_items | ||
) | [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 from gr_block.
void gr_test::set_check_topology | ( | bool | check_topology | ) | [inline] |
Force check topology to return true or false.
check_topology | value to return when check_topology is called (true or false) default check_topology returns true |
References gr_basic_block::check_topology().
void gr_test::set_consume_limit | ( | unsigned int | limit | ) | [inline] |
Set the consume limit.
limit | min or maximum items to consume (depending on consume_type) |
void gr_test::set_consume_type | ( | gr_consume_type_t | cons_type | ) | [inline] |
Set the consume pattern.
cons_type | which consume pattern to use |
void gr_test::set_fixed_rate_public | ( | bool | fixed_rate | ) | [inline] |
Set if fixed rate should return true. N.B. This is normally a private method but we make it available here as public.
References gr_block::set_fixed_rate().
void gr_test::set_produce_limit | ( | unsigned int | limit | ) | [inline] |
Set the produce limit.
limit | min or maximum items to produce (depending on produce_type) |
void gr_test::set_produce_type | ( | gr_produce_type_t | prod_type | ) | [inline] |
Set the produce pattern.
prod_type | which produce pattern to use |
GR_CORE_API gr_test_sptr gr_make_test | ( | const std::string & | name, |
int | min_inputs, | ||
int | max_inputs, | ||
unsigned int | sizeof_input_item, | ||
int | min_outputs, | ||
int | max_outputs, | ||
unsigned int | sizeof_output_item, | ||
unsigned int | history, | ||
unsigned int | output_multiple, | ||
double | relative_rate, | ||
bool | fixed_rate, | ||
gr_consume_type_t | cons_type, | ||
gr_produce_type_t | prod_type | ||
) | [friend] |
bool gr_test::d_check_topology [protected] |
gr_consume_type_t gr_test::d_consume_type [protected] |
int gr_test::d_max_consume [protected] |
int gr_test::d_max_produce [protected] |
int gr_test::d_min_consume [protected] |
int gr_test::d_min_produce [protected] |
gr_produce_type_t gr_test::d_produce_type [protected] |
unsigned int gr_test::d_sizeof_input_item [protected] |
unsigned int gr_test::d_sizeof_output_item [protected] |
char gr_test::d_temp [protected] |