From 595733bf67ad17f9c0a737f6cff3ea4a97e1b7f8 Mon Sep 17 00:00:00 2001 From: Lenhart Date: Mon, 19 Apr 2021 16:05:53 +0200 Subject: [PATCH] moved logging output from template fct in header to source file to not have to include logging in header. Added maybe_unused to constructor argument which is unused to fix warning --- .../signal_source/adapters/fifo_signal_source.cc | 2 +- .../signal_source/gnuradio_blocks/fifo_reader.cc | 7 ++++++- src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h | 7 +++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc index 27b96a0e6..9ab222ebf 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -28,7 +28,7 @@ using namespace std::string_literals; FifoSignalSource::FifoSignalSource(ConfigurationInterface const* configuration, std::string const& role, unsigned int in_streams, unsigned int out_streams, - Concurrent_Queue* queue) + [[maybe_unused]] Concurrent_Queue* queue) : SignalSourceBase(configuration, role, "Fifo_Signal_Source"s), item_size_(sizeof(gr_complex)), // currenty output item size is always gr_complex fifo_reader_(FifoReader::make(configuration->property(role + ".filename"s, "../data/example_capture.dat"s), diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc index 092d6dcd3..4eb7d53cf 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc @@ -101,9 +101,14 @@ size_t FifoReader::read_gr_complex(int noutput_items, gr_vector_void_star &outpu } else { - LOG(ERROR) << "unhandled FIFO event"; + fifo_error_output(); break; } } return items_retrieved; } + +void FifoReader::fifo_error_output() const +{ + LOG(ERROR) << "unhandled FIFO event"; +} diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h index a955bd474..4ddf281cd 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h @@ -26,7 +26,6 @@ * \{ */ /** \addtogroup Signal_Source_gnuradio_blocks * \{ */ - class FifoReader : virtual public gr::sync_block { public: @@ -80,13 +79,17 @@ private: } else { - LOG(ERROR) << "unhandled FIFO event"; + fifo_error_output(); break; } } return items_retrieved; } + //! this function moves logging output from this header into the source file + //! thereby eliminating the need to include glog/logging.h in this header + void fifo_error_output() const; + const std::string file_name_; const std::string sample_type_; std::ifstream fifo_;