mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-29 06:27:44 +00:00 
			
		
		
		
	Cleaner exit if the data file is not found
This commit is contained in:
		| @@ -18,6 +18,8 @@ | |||||||
| #include "gnuradio/block.h" | #include "gnuradio/block.h" | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
| #include <cmath> | #include <cmath> | ||||||
|  | #include <cstdlib> | ||||||
|  | #include <iostream> | ||||||
|  |  | ||||||
| #if USE_GLOG_AND_GFLAGS | #if USE_GLOG_AND_GFLAGS | ||||||
| #include <glog/logging.h> | #include <glog/logging.h> | ||||||
| @@ -25,8 +27,6 @@ | |||||||
| #include <absl/log/log.h> | #include <absl/log/log.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| using namespace std::string_literals; |  | ||||||
|  |  | ||||||
| IONGSMSFileSource::IONGSMSFileSource( | IONGSMSFileSource::IONGSMSFileSource( | ||||||
|     const fs::path& metadata_filepath, |     const fs::path& metadata_filepath, | ||||||
|     const GnssMetadata::File& file, |     const GnssMetadata::File& file, | ||||||
| @@ -46,7 +46,10 @@ IONGSMSFileSource::IONGSMSFileSource( | |||||||
|  |  | ||||||
|     if (!file_stream_.is_open()) |     if (!file_stream_.is_open()) | ||||||
|         { |         { | ||||||
|             LOG(ERROR) << "ion_gsms_file_source: Unable to open the samples file: " << (data_filepath).c_str(); |             LOG(WARNING) << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str(); | ||||||
|  |             std::cerr << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str() << std::endl; | ||||||
|  |             std::cout << "GNSS-SDR program ended.\n"; | ||||||
|  |             exit(1); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|     // Skip offset and block header |     // Skip offset and block header | ||||||
| @@ -96,11 +99,13 @@ std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) | |||||||
|     return output_stream_item_sizes_[stream_index]; |     return output_stream_item_sizes_[stream_index]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| std::size_t IONGSMSFileSource::output_stream_total_sample_count(std::size_t stream_index) const | std::size_t IONGSMSFileSource::output_stream_total_sample_count(std::size_t stream_index) const | ||||||
| { | { | ||||||
|     return output_stream_total_sample_counts_[stream_index]; |     return output_stream_total_sample_counts_[stream_index]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector<std::string>& stream_ids) | gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector<std::string>& stream_ids) | ||||||
| { | { | ||||||
|     int nstreams = 0; |     int nstreams = 0; | ||||||
| @@ -142,6 +147,7 @@ gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetada | |||||||
|         item_sizes); |         item_sizes); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| int IONGSMSFileSource::work( | int IONGSMSFileSource::work( | ||||||
|     int noutput_items, |     int noutput_items, | ||||||
|     gr_vector_const_void_star& input_items __attribute__((unused)), |     gr_vector_const_void_star& input_items __attribute__((unused)), | ||||||
|   | |||||||
| @@ -23,7 +23,6 @@ | |||||||
| #include <gnuradio/block.h> | #include <gnuradio/block.h> | ||||||
| #include <gnuradio/sync_block.h> | #include <gnuradio/sync_block.h> | ||||||
| #include <cstddef> | #include <cstddef> | ||||||
| #include <cstdio> |  | ||||||
| #include <fstream> | #include <fstream> | ||||||
| #include <memory> | #include <memory> | ||||||
| #include <string> | #include <string> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez