1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-15 19:55:47 +00:00

Restore old behavior to gnss_valve if the same constructor is used (Fix tests)

This commit is contained in:
Carles Fernandez 2018-11-18 13:29:54 +01:00
parent 4ee36cd2cc
commit e0fb3518db
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 16 additions and 10 deletions

View File

@ -40,7 +40,8 @@
gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item, gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item,
unsigned long long nitems, unsigned long long nitems,
gr::msg_queue::sptr queue, bool stop_flowgraph) : gr::sync_block("valve", gr::msg_queue::sptr queue,
bool stop_flowgraph) : gr::sync_block("valve",
gr::io_signature::make(1, 1, sizeof_stream_item), gr::io_signature::make(1, 1, sizeof_stream_item),
gr::io_signature::make(1, 1, sizeof_stream_item)), gr::io_signature::make(1, 1, sizeof_stream_item)),
d_nitems(nitems), d_nitems(nitems),
@ -58,16 +59,20 @@ boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, unsi
return valve_; return valve_;
} }
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue) boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue)
{ {
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, queue, false)); boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, queue, true));
return valve_; return valve_;
} }
void gnss_sdr_valve::open_valve() void gnss_sdr_valve::open_valve()
{ {
d_open_valve = true; d_open_valve = true;
} }
int gnss_sdr_valve::work(int noutput_items, int gnss_sdr_valve::work(int noutput_items,
gr_vector_const_void_star &input_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items) gr_vector_void_star &output_items)
@ -87,7 +92,7 @@ int gnss_sdr_valve::work(int noutput_items,
else else
{ {
usleep(1000000); usleep(1000000);
return 0; //do not produce or consume return 0; // do not produce or consume
} }
} }
unsigned long long n = std::min(d_nitems - d_ncopied_items, static_cast<long long unsigned int>(noutput_items)); unsigned long long n = std::min(d_nitems - d_ncopied_items, static_cast<long long unsigned int>(noutput_items));

View File

@ -41,10 +41,12 @@
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
unsigned long long nitems, unsigned long long nitems,
gr::msg_queue::sptr queue); gr::msg_queue::sptr queue);
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
unsigned long long nitems, unsigned long long nitems,
gr::msg_queue::sptr queue, gr::msg_queue::sptr queue,
bool stop_flowgraph); bool stop_flowgraph);
/*! /*!
* \brief Implementation of a GNU Radio block that sends a STOP message to the * \brief Implementation of a GNU Radio block that sends a STOP message to the
* control queue right after a specific number of samples have passed through it. * control queue right after a specific number of samples have passed through it.
@ -59,7 +61,6 @@ class gnss_sdr_valve : public gr::sync_block
gr::msg_queue::sptr queue, gr::msg_queue::sptr queue,
bool stop_flowgraph); bool stop_flowgraph);
unsigned long long d_nitems; unsigned long long d_nitems;
unsigned long long d_ncopied_items; unsigned long long d_ncopied_items;
gr::msg_queue::sptr d_queue; gr::msg_queue::sptr d_queue;