GNU Radio 3.6.5 C++ API

gr_test Class Reference

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>

Inheritance diagram for gr_test:
gr_block gr_basic_block gr_msg_accepter gruel::msg_accepter

List of all members.

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)

Detailed Description

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.


Constructor & Destructor Documentation

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]

Member Function Documentation

bool gr_test::check_topology ( int  ninputs,
int  noutputs 
) [inline, virtual]

Confirm that ninputs and noutputs is an acceptable combination.

Parameters:
ninputsnumber of input streams connected
noutputsnumber of output streams connected
Returns:
true if this is a valid configuration for this block.

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.

Parameters:
noutput_itemsnumber of output items to produce
ninput_items_requirednumber 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

Parameters:
noutput_itemsnumber of output items to write on each output stream
ninput_itemsnumber of input items available on each input stream
input_itemsvector of pointers to the input items, one entry per input stream
output_itemsvector of pointers to the output items, one entry per output stream
Returns:
number of items actually written to each output stream, or -1 on EOF. It is OK to return a value less than noutput_items. -1 <= return value <= noutput_items

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.

Parameters:
check_topologyvalue 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.

Parameters:
limitmin 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.

Parameters:
cons_typewhich 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.

Parameters:
limitmin 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.

Parameters:
prod_typewhich produce pattern to use

Friends And Related Function Documentation

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]

Member Data Documentation

bool gr_test::d_check_topology [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]
unsigned int gr_test::d_sizeof_input_item [protected]
unsigned int gr_test::d_sizeof_output_item [protected]
char gr_test::d_temp [protected]

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