I am trying to create a block similar to Vector Source.
My objective is to stop the flow graph when the vector has sent out all its elements.
But the function stop() fails to work. The flow graph continue executing infinitely...
#include <gr_io_signature.h>
#include "integer_source_impl.h"
integer_source::make(const std::vector <int> &data, bool repeat)
{ return gnuradio::get_initial_sptr (new integer_source_impl( data, repeat )); }
integer_source_impl::integer_source_impl( const std::vector <int> &data, bool repeat)
: gr_sync_block("integer_source",
gr_make_io_signature( 0, 0, 0 ),
gr_make_io_signature( 1, 1, sizeof(int))),
integer_source_impl::~integer_source_impl()
integer_source_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
std::cout << "Have completed one cycle!" << std::endl;
int *out = (int *) output_items[0];
int size = d_data.size();
for (int i=0; i < noutput_items; i++)
out[i] = d_data[ d_count ];
// Tell runtime system how many output items we produced.