diff options
Diffstat (limited to 'gnuradio-core/src/lib/gengen')
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t | 42 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t | 16 |
2 files changed, 29 insertions, 29 deletions
diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t index 15e19edb0..75ed526ad 100644 --- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t +++ b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.cc.t @@ -32,13 +32,13 @@ #include <stdio.h> -@NAME@::@NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset) - : gr_block ("@BASE_NAME@", - gr_make_io_signature (1, 1, sizeof (@TYPE@)), - gr_make_io_signature (1, 1, sizeof (@TYPE@))), - d_data (data), - d_offset (offset), - d_periodicity (periodicity) +@NAME@::@NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset) + : gr_block("@BASE_NAME@", + gr_make_io_signature (1, 1, sizeof(@TYPE@)), + gr_make_io_signature (1, 1, sizeof(@TYPE@))), + d_data(data), + d_offset(offset), + d_periodicity(periodicity) { //printf("INITIAL: periodicity = %d, offset = %d\n", periodicity, offset); // some sanity checks @@ -48,22 +48,22 @@ } int -@NAME@::general_work (int noutput_items, +@NAME@::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - @TYPE@ *out = (@TYPE@ *) output_items[0]; - const @TYPE@ *in = (const @TYPE@ *) input_items[0]; + @TYPE@ *out = (@TYPE@ *)output_items[0]; + const @TYPE@ *in = (const @TYPE@ *)input_items[0]; int ii(0), oo(0); - while( (oo < noutput_items) && (ii < ninput_items[0]) ){ + while((oo < noutput_items) && (ii < ninput_items[0])) { //printf("oo = %d, ii = %d, d_offset = %d, noutput_items = %d, ninput_items[0] = %d", oo, ii, d_offset, noutput_items, ninput_items[0]); //printf(", d_periodicity = %d\n", d_periodicity); - if( d_offset >= ((int)d_data.size()) ){ // if we are in the copy region + if(d_offset >= ((int)d_data.size())) { // if we are in the copy region int max_copy = std::min( std::min( noutput_items - oo, ninput_items[0] - ii ), d_periodicity - d_offset ); //printf("copy %d from input\n", max_copy); memcpy( &out[oo], &in[ii], sizeof(@TYPE@)*max_copy ); @@ -72,24 +72,24 @@ int oo += max_copy; d_offset = (d_offset + max_copy)%d_periodicity; - } else { // if we are in the insertion region + } + else { // if we are in the insertion region int max_copy = std::min( noutput_items - oo, ((int)d_data.size()) - d_offset ); //printf("copy %d from d_data[%d] to out[%d]\n", max_copy, d_offset, oo); memcpy( &out[oo], &d_data[d_offset], sizeof(@TYPE@)*max_copy ); //printf(" * memcpy returned.\n"); - oo += max_copy; + oo += max_copy; d_offset = (d_offset + max_copy)%d_periodicity; //printf(" ## (inelse) oo = %d, d_offset = %d\n", oo, d_offset); - } + } //printf(" # exit else, on to next loop.\n"); - } - //printf(" # got out of loop\n"); - - //printf("consume = %d, produce = %d\n", ii, oo); - consume_each(ii); - return oo; + } + //printf(" # got out of loop\n"); + //printf("consume = %d, produce = %d\n", ii, oo); + consume_each(ii); + return oo; } @NAME@_sptr diff --git a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t index 76c6b7a5d..a7de7831b 100644 --- a/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t +++ b/gnuradio-core/src/lib/gengen/gr_vector_insert_X.h.t @@ -37,25 +37,25 @@ typedef boost::shared_ptr<@NAME@> @NAME@_sptr; */ class @NAME@ : public gr_block { - friend GR_CORE_API @NAME@_sptr - gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset); + friend GR_CORE_API @NAME@_sptr + gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset); std::vector<@TYPE@> d_data; int d_offset; int d_periodicity; - @NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset); + @NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset); public: void rewind() {d_offset=0;} - 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); + 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); void set_data(const std::vector<@TYPE@> &data){ d_data = data; rewind(); } }; GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (const std::vector<@TYPE@> &data, int periodicity, int offset=0); +gr_make_@BASE_NAME@(const std::vector<@TYPE@> &data, int periodicity, int offset=0); #endif |