mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-30 14:53:03 +00:00
Replace some C-style cast by static_cast<>()
See https://stackoverflow.com/questions/1609163/what-is-the-difference-between-static-cast-and-c-style-casting
This commit is contained in:
@@ -122,7 +122,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
|
||||
if (file.is_open())
|
||||
{
|
||||
size = file.tellg();
|
||||
LOG(INFO) << "Total samples in the file= " << floor((double)size / (double)item_size());
|
||||
LOG(INFO) << "Total samples in the file= " << floor(static_cast<double>(size) / static_cast<double>(item_size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -131,20 +131,20 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
std::streamsize ss = std::cout.precision();
|
||||
std::cout << std::setprecision(16);
|
||||
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl;
|
||||
std::cout << "Processing file " << filename_ << ", which contains " << size << " [bytes]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
int sample_packet_factor = 4; // 1 byte -> 4 samples
|
||||
samples_ = floor((double)size / (double)item_size())*sample_packet_factor;
|
||||
samples_ = samples_- ceil(0.002 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 2 ms
|
||||
samples_ = floor(static_cast<double>(size) / static_cast<double>(item_size())) * sample_packet_factor;
|
||||
samples_ = samples_- ceil(0.002 * static_cast<double>(sampling_frequency_)); //process all the samples available in the file excluding the last 2 ms
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(samples_ > 0) << "File does not contain enough samples to process.";
|
||||
double signal_duration_s;
|
||||
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_);
|
||||
signal_duration_s = static_cast<double>(samples_) * ( 1 /static_cast<double>(sampling_frequency_));
|
||||
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
|
||||
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
|
||||
|
||||
|
||||
@@ -60,10 +60,10 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
// OSMOSDR Driver parameters
|
||||
AGC_enabled_ = configuration->property(role + ".AGC_enabled", true);
|
||||
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
|
||||
gain_ = configuration->property(role + ".gain", (double)40.0);
|
||||
rf_gain_ = configuration->property(role + ".rf_gain", (double)40.0);
|
||||
if_gain_ = configuration->property(role + ".if_gain", (double)40.0);
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", (double)2.0e6);
|
||||
gain_ = configuration->property(role + ".gain", 40.0);
|
||||
rf_gain_ = configuration->property(role + ".rf_gain", 40.0);
|
||||
if_gain_ = configuration->property(role + ".if_gain", 40.0);
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", 2.0e6);
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string( ));
|
||||
|
||||
|
||||
@@ -61,10 +61,10 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
||||
short default_port = 1234;
|
||||
AGC_enabled_ = configuration->property(role + ".AGC_enabled", true);
|
||||
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
|
||||
gain_ = configuration->property(role + ".gain", (double)40.0);
|
||||
rf_gain_ = configuration->property(role + ".rf_gain", (double)40.0);
|
||||
if_gain_ = configuration->property(role + ".if_gain", (double)40.0);
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", (double)2.0e6);
|
||||
gain_ = configuration->property(role + ".gain", 40.0);
|
||||
rf_gain_ = configuration->property(role + ".rf_gain", 40.0);
|
||||
if_gain_ = configuration->property(role + ".if_gain", 40.0);
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", 2.0e6);
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
address_ = configuration->property(role + ".address", default_address);
|
||||
port_ = configuration->property(role + ".port", default_port);
|
||||
|
||||
@@ -121,7 +121,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
|
||||
if (file.is_open())
|
||||
{
|
||||
size = file.tellg();
|
||||
LOG(INFO) << "Total samples in the file= " << floor((double)size / (double)item_size());
|
||||
LOG(INFO) << "Total samples in the file= " << floor(static_cast<double>(size) / static_cast<double>(item_size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -130,20 +130,20 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
|
||||
}
|
||||
std::streamsize ss = std::cout.precision();
|
||||
std::cout << std::setprecision(16);
|
||||
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl;
|
||||
std::cout << "Processing file " << filename_ << ", which contains " << size << " [bytes]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
int sample_packet_factor = 1; // 1 int -> 1 complex sample (I&Q from 1 channel)
|
||||
samples_ = floor((double)size / (double)item_size())*sample_packet_factor;
|
||||
samples_ = samples_- ceil(0.002 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 2 ms
|
||||
samples_ = floor(static_cast<double>(size) / static_cast<double>(item_size())) * sample_packet_factor;
|
||||
samples_ = samples_- ceil(0.002 * static_cast<double>(sampling_frequency_)); //process all the samples available in the file excluding the last 2 ms
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(samples_ > 0) << "File does not contain enough samples to process.";
|
||||
double signal_duration_s;
|
||||
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_);
|
||||
signal_duration_s = static_cast<double>(samples_) * ( 1 /static_cast<double>(sampling_frequency_));
|
||||
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
|
||||
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
|
||||
if (file.is_open())
|
||||
{
|
||||
size = file.tellg();
|
||||
LOG(INFO) << "Total samples in the file= " << floor((double)size / (double)item_size());
|
||||
LOG(INFO) << "Total samples in the file= " << floor(static_cast<double>(size) / static_cast<double>(item_size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -128,20 +128,20 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
|
||||
}
|
||||
std::streamsize ss = std::cout.precision();
|
||||
std::cout << std::setprecision(16);
|
||||
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl;
|
||||
std::cout << "Processing file " << filename_ << ", which contains " << size << " [bytes]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
int sample_packet_factor = 2; // 1 byte -> 2 samples
|
||||
samples_ = floor((double)size / (double)item_size())*sample_packet_factor;
|
||||
samples_ = samples_- ceil(0.002 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 2 ms
|
||||
samples_ = floor(static_cast<double>(size) / static_cast<double>(item_size())) * sample_packet_factor;
|
||||
samples_ = samples_- ceil(0.002 * static_cast<double>(sampling_frequency_)); //process all the samples available in the file excluding the last 2 ms
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(samples_ > 0) << "File does not contain enough samples to process.";
|
||||
double signal_duration_s;
|
||||
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_);
|
||||
signal_duration_s = static_cast<double>(samples_) * ( 1 /static_cast<double>(sampling_frequency_));
|
||||
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
|
||||
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
|
||||
if (file.is_open())
|
||||
{
|
||||
size = file.tellg();
|
||||
samples_ = floor((double)size * ( is_complex_ ? 2.0 : 4.0 ) );
|
||||
samples_ = floor(static_cast<double>(size) * ( is_complex_ ? 2.0 : 4.0 ) );
|
||||
LOG(INFO) << "Total samples in the file= " << samples_; // 4 samples per byte
|
||||
samples_ -= bytes_to_skip;
|
||||
|
||||
@@ -199,13 +199,13 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
|
||||
}
|
||||
std::streamsize ss = std::cout.precision();
|
||||
std::cout << std::setprecision(16);
|
||||
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl;
|
||||
std::cout << "Processing file " << filename_ << ", which contains " << size << " [bytes]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
}
|
||||
|
||||
CHECK(samples_ > 0) << "File does not contain enough samples to process.";
|
||||
double signal_duration_s;
|
||||
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_);
|
||||
signal_duration_s = static_cast<double>(samples_) * ( 1 /static_cast<double>(sampling_frequency_));
|
||||
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
|
||||
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
subdevice_ = configuration->property(role + ".subdevice", empty);
|
||||
clock_source_ = configuration->property(role + ".clock_source", std::string("internal"));
|
||||
RF_channels_ = configuration->property(role + ".RF_channels", 1);
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", (double)4.0e6);
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", 4.0e6);
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
|
||||
if (RF_channels_ == 1)
|
||||
@@ -82,7 +82,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
dump_filename_.push_back(configuration->property(role + ".dump_filename", default_dump_file));
|
||||
|
||||
freq_.push_back(configuration->property(role + ".freq", GPS_L1_FREQ_HZ));
|
||||
gain_.push_back(configuration->property(role + ".gain", (double)50.0));
|
||||
gain_.push_back(configuration->property(role + ".gain", 50.0));
|
||||
|
||||
IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz", sample_rate_/2));
|
||||
|
||||
@@ -98,7 +98,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
dump_filename_.push_back(configuration->property(role + ".dump_filename" + boost::lexical_cast<std::string>(i), default_dump_file));
|
||||
|
||||
freq_.push_back(configuration->property(role + ".freq" + boost::lexical_cast<std::string>(i), GPS_L1_FREQ_HZ));
|
||||
gain_.push_back(configuration->property(role + ".gain" + boost::lexical_cast<std::string>(i), (double)50.0));
|
||||
gain_.push_back(configuration->property(role + ".gain" + boost::lexical_cast<std::string>(i), 50.0));
|
||||
|
||||
IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz" + boost::lexical_cast<std::string>(i), sample_rate_/2));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user