summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/test.h
diff options
context:
space:
mode:
authorMarcus Müller <mmueller@gnuradio.org>2019-08-07 21:45:12 +0200
committerMarcus Müller <marcus@hostalia.de>2019-08-09 23:04:28 +0200
commitf7bbf2c1d8d780294f3e016aff239ca35eb6516e (patch)
treee09ab6112e02b2215b2d59ac24d3d6ea2edac745 /gnuradio-runtime/lib/test.h
parent78431dc6941e3acc67c858277dfe4a0ed583643c (diff)
Tree: clang-format without the include sorting
Diffstat (limited to 'gnuradio-runtime/lib/test.h')
-rw-r--r--gnuradio-runtime/lib/test.h152
1 files changed, 82 insertions, 70 deletions
diff --git a/gnuradio-runtime/lib/test.h b/gnuradio-runtime/lib/test.h
index a8019bc3b7..51e17ac49a 100644
--- a/gnuradio-runtime/lib/test.h
+++ b/gnuradio-runtime/lib/test.h
@@ -30,41 +30,47 @@
namespace gr {
- class test;
- typedef boost::shared_ptr<test> test_sptr;
-
- // public constructor
- GR_RUNTIME_API test_sptr
- make_test(const std::string &name=std::string("test"),
- int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1,
- int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1,
- unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0,
- bool fixed_rate=true,consume_type_t cons_type=CONSUME_NOUTPUT_ITEMS,
- produce_type_t prod_type=PRODUCE_NOUTPUT_ITEMS);
-
- /*!
- * \brief Test class for testing runtime system (setting up buffers and such.)
- * \ingroup misc
- *
- * This block does not do any useful actual data processing. It
- * just exposes setting all standard block parameters using the
- * constructor or public methods.
- *
- * This block can be useful 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.
- */
- class GR_RUNTIME_API test : public block
- {
- public:
+class test;
+typedef boost::shared_ptr<test> test_sptr;
+
+// public constructor
+GR_RUNTIME_API test_sptr make_test(const std::string& name = std::string("test"),
+ int min_inputs = 1,
+ int max_inputs = 1,
+ unsigned int sizeof_input_item = 1,
+ int min_outputs = 1,
+ int max_outputs = 1,
+ unsigned int sizeof_output_item = 1,
+ unsigned int history = 1,
+ unsigned int output_multiple = 1,
+ double relative_rate = 1.0,
+ bool fixed_rate = true,
+ consume_type_t cons_type = CONSUME_NOUTPUT_ITEMS,
+ produce_type_t prod_type = PRODUCE_NOUTPUT_ITEMS);
+
+/*!
+ * \brief Test class for testing runtime system (setting up buffers and such.)
+ * \ingroup misc
+ *
+ * This block does not do any useful actual data processing. It
+ * just exposes setting all standard block parameters using the
+ * constructor or public methods.
+ *
+ * This block can be useful 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.
+ */
+class GR_RUNTIME_API test : public block
+{
+public:
~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);
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items);
// ----------------------------------------------------------------
// override these to define your behavior
@@ -80,12 +86,12 @@ namespace gr {
* number of data items required on each input stream. The
* estimate doesn't have to be exact, but should be close.
*/
- void forecast(int noutput_items,
- gr_vector_int &ninput_items_required)
+ void forecast(int noutput_items, gr_vector_int& ninput_items_required)
{
- unsigned ninputs = ninput_items_required.size();
- for(unsigned i = 0; i < ninputs; i++)
- ninput_items_required[i] = (int)((double)noutput_items / relative_rate()) + (int)history();
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] =
+ (int)((double)noutput_items / relative_rate()) + (int)history();
}
/*!
@@ -94,9 +100,7 @@ namespace gr {
* \param check_topology value to return when check_topology is
* called (true or false) default check_topology returns true
*/
- void set_check_topology(bool check_topology) {
- d_check_topology=check_topology;
- }
+ void set_check_topology(bool check_topology) { d_check_topology = check_topology; }
/*!
* \brief Confirm that ninputs and noutputs is an acceptable combination.
@@ -111,9 +115,7 @@ namespace gr {
* This check is in addition to the constraints specified by the
* input and output gr::io_signatures.
*/
- bool check_topology(int ninputs, int noutputs) {
- return d_check_topology;
- }
+ bool check_topology(int ninputs, int noutputs) { return d_check_topology; }
// ----------------------------------------------------------------
/*
@@ -129,8 +131,9 @@ namespace gr {
* returns true. Generally speaking, you don't need to override
* this.
*/
- int fixed_rate_ninput_to_noutput(int ninput) {
- return (int)((double)ninput/relative_rate());
+ int fixed_rate_ninput_to_noutput(int ninput)
+ {
+ return (int)((double)ninput / relative_rate());
}
/*!
@@ -138,26 +141,23 @@ namespace gr {
* required to produce noutput. N.B. this is only defined if
* fixed_rate returns true.
*/
- int fixed_rate_noutput_to_ninput(int noutput) {
- return (int)((double)noutput*relative_rate());
+ int fixed_rate_noutput_to_ninput(int noutput)
+ {
+ return (int)((double)noutput * relative_rate());
}
/*!
* \brief 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_fixed_rate_public(bool fixed_rate) {
- set_fixed_rate(fixed_rate);
- }
+ void set_fixed_rate_public(bool fixed_rate) { set_fixed_rate(fixed_rate); }
/*!
* \brief Set the consume pattern.
*
* \param cons_type which consume pattern to use
*/
- void set_consume_type(consume_type_t cons_type) {
- d_consume_type=cons_type;
- }
+ void set_consume_type(consume_type_t cons_type) { d_consume_type = cons_type; }
/*!
* \brief Set the consume limit.
@@ -165,8 +165,10 @@ namespace gr {
* \param limit min or maximum items to consume (depending on
* consume_type)
*/
- void set_consume_limit(unsigned int limit) {
- d_min_consume=limit; d_max_consume=limit;
+ void set_consume_limit(unsigned int limit)
+ {
+ d_min_consume = limit;
+ d_max_consume = limit;
}
/*!
@@ -174,9 +176,7 @@ namespace gr {
*
* \param prod_type which produce pattern to use
*/
- void set_produce_type(produce_type_t prod_type) {
- d_produce_type=prod_type;
- }
+ void set_produce_type(produce_type_t prod_type) { d_produce_type = prod_type; }
/*!
* \brief Set the produce limit.
@@ -184,13 +184,15 @@ namespace gr {
* \param limit min or maximum items to produce (depending on
* produce_type)
*/
- void set_produce_limit(unsigned int limit) {
- d_min_produce=limit; d_max_produce=limit;
+ void set_produce_limit(unsigned int limit)
+ {
+ d_min_produce = limit;
+ d_max_produce = limit;
}
// ----------------------------------------------------------------------------
- protected:
+protected:
unsigned int d_sizeof_input_item;
unsigned int d_sizeof_output_item;
bool d_check_topology;
@@ -201,16 +203,26 @@ namespace gr {
produce_type_t d_produce_type;
int d_min_produce;
int d_max_produce;
- test(const std::string &name,int min_inputs, int max_inputs,
+ 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, consume_type_t cons_type, produce_type_t prod_type);
-
- friend GR_RUNTIME_API test_sptr make_test(const std::string &name,
- int min_inputs, int max_inputs,
+ int min_outputs,
+ int max_outputs,
+ unsigned int sizeof_output_item,
+ unsigned int history,
+ unsigned int output_multiple,
+ double relative_rate,
+ bool fixed_rate,
+ consume_type_t cons_type,
+ produce_type_t prod_type);
+
+ friend GR_RUNTIME_API test_sptr make_test(const std::string& name,
+ int min_inputs,
+ int max_inputs,
unsigned int sizeof_input_item,
- int min_outputs, int max_outputs,
+ int min_outputs,
+ int max_outputs,
unsigned int sizeof_output_item,
unsigned int history,
unsigned int output_multiple,
@@ -218,7 +230,7 @@ namespace gr {
bool fixed_rate,
consume_type_t cons_type,
produce_type_t prod_type);
- };
+};
} /* namespace gr */