mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-18 21:23:02 +00:00
Prefer initialization to assignment in constructors
This commit is contained in:
parent
fdc378c04b
commit
8d9875e881
@ -27,7 +27,10 @@ using namespace std::string_literals;
|
||||
CustomUDPSignalSource::CustomUDPSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue __attribute__((unused)))
|
||||
: SignalSourceBase(configuration, role, "Custom_UDP_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
: SignalSourceBase(configuration, role, "Custom_UDP_Signal_Source"s),
|
||||
item_size_(sizeof(gr_complex)),
|
||||
in_stream_(in_stream),
|
||||
out_stream_(out_stream)
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
const std::string default_dump_file("./data/signal_source.dat");
|
||||
@ -51,8 +54,6 @@ CustomUDPSignalSource::CustomUDPSignalSource(const ConfigurationInterface* confi
|
||||
const std::string default_sample_type("cbyte");
|
||||
const std::string sample_type = configuration->property(role + ".sample_type", default_sample_type);
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
// output item size is always gr_complex
|
||||
item_size_ = sizeof(gr_complex);
|
||||
|
||||
udp_gnss_rx_source_ = Gr_Complex_Ip_Packet_Source::make(capture_device,
|
||||
address,
|
||||
|
@ -29,11 +29,12 @@
|
||||
GenSignalSource::GenSignalSource(std::shared_ptr<GNSSBlockInterface> signal_generator,
|
||||
std::shared_ptr<GNSSBlockInterface> filter,
|
||||
std::string role,
|
||||
Concurrent_Queue<pmt::pmt_t> *queue __attribute__((unused))) : signal_generator_(std::move(signal_generator)),
|
||||
filter_(std::move(filter)),
|
||||
role_(std::move(role))
|
||||
Concurrent_Queue<pmt::pmt_t> *queue __attribute__((unused)))
|
||||
: signal_generator_(std::move(signal_generator)),
|
||||
filter_(std::move(filter)),
|
||||
role_(std::move(role)),
|
||||
connected_(false)
|
||||
{
|
||||
connected_ = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,11 +30,14 @@ using namespace std::string_literals;
|
||||
|
||||
SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, uint32_t in_streams, uint32_t out_streams, Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Spir_GSS6450_File_Signal_Source"s), in_streams_(in_streams), out_streams_(out_streams)
|
||||
: SignalSourceBase(configuration, role, "Spir_GSS6450_File_Signal_Source"s),
|
||||
item_type_("int"),
|
||||
item_size_(sizeof(int32_t)),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
const std::string default_filename("../data/my_capture.dat");
|
||||
const std::string default_dump_filename("../data/my_capture_dump.dat");
|
||||
item_type_ = "int";
|
||||
|
||||
samples_ = configuration->property(role + ".samples", static_cast<uint64_t>(0));
|
||||
sampling_frequency_ = configuration->property(role + ".sampling_frequency", static_cast<int64_t>(0));
|
||||
@ -47,7 +50,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(const ConfigurationInte
|
||||
adc_bits_ = configuration->property(role + ".adc_bits", 4);
|
||||
n_channels_ = configuration->property(role + ".total_channels", 1);
|
||||
sel_ch_ = configuration->property(role + ".sel_ch", 1);
|
||||
item_size_ = sizeof(int32_t);
|
||||
|
||||
const int64_t bytes_seek = configuration->property(role + ".bytes_to_skip", static_cast<int64_t>(65536));
|
||||
const double sample_size_byte = static_cast<double>(adc_bits_) / 4.0;
|
||||
|
||||
|
@ -94,19 +94,27 @@ Gr_Complex_Ip_Packet_Source::make(std::string src_device,
|
||||
Gr_Complex_Ip_Packet_Source::Gr_Complex_Ip_Packet_Source(std::string src_device,
|
||||
__attribute__((unused)) const std::string &origin_address,
|
||||
int udp_port,
|
||||
int udp_packet_size,
|
||||
int udp_packet_size __attribute__((unused)),
|
||||
int n_baseband_channels,
|
||||
const std::string &wire_sample_type,
|
||||
size_t item_size,
|
||||
bool IQ_swap_)
|
||||
: gr::sync_block("gr_complex_ip_packet_source",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
gr::io_signature::make(1, 4, item_size)) // 1 to 4 baseband complex channels
|
||||
gr::io_signature::make(1, 4, item_size)), // 1 to 4 baseband complex channels
|
||||
d_pcap_thread(nullptr),
|
||||
d_src_device(std::move(src_device)),
|
||||
descr(nullptr),
|
||||
fifo_buff(new char[FIFO_SIZE]),
|
||||
fifo_read_ptr(0),
|
||||
fifo_write_ptr(0),
|
||||
fifo_items(0),
|
||||
d_sock_raw(0),
|
||||
d_udp_port(udp_port),
|
||||
d_n_baseband_channels(n_baseband_channels),
|
||||
d_IQ_swap(IQ_swap_)
|
||||
{
|
||||
std::cout << "Start Ethernet packet capture\n";
|
||||
std::cout << "Overflow events will be indicated by o's\n";
|
||||
|
||||
d_n_baseband_channels = n_baseband_channels;
|
||||
memset(reinterpret_cast<char *>(&si_me), 0, sizeof(si_me));
|
||||
if (wire_sample_type == "cbyte")
|
||||
{
|
||||
d_wire_sample_type = 1;
|
||||
@ -132,24 +140,9 @@ Gr_Complex_Ip_Packet_Source::Gr_Complex_Ip_Packet_Source(std::string src_device,
|
||||
std::cout << "Unknown wire sample type\n";
|
||||
exit(0);
|
||||
}
|
||||
std::cout << "Start Ethernet packet capture\n";
|
||||
std::cout << "Overflow events will be indicated by o's\n";
|
||||
std::cout << "d_wire_sample_type:" << d_wire_sample_type << '\n';
|
||||
d_src_device = std::move(src_device);
|
||||
d_udp_port = udp_port;
|
||||
d_udp_payload_size = udp_packet_size;
|
||||
d_fifo_full = false;
|
||||
|
||||
// allocate signal samples buffer
|
||||
fifo_buff = new char[FIFO_SIZE];
|
||||
fifo_read_ptr = 0;
|
||||
fifo_write_ptr = 0;
|
||||
fifo_items = 0;
|
||||
d_item_size = item_size;
|
||||
d_IQ_swap = IQ_swap_;
|
||||
d_sock_raw = 0;
|
||||
d_pcap_thread = nullptr;
|
||||
descr = nullptr;
|
||||
|
||||
memset(reinterpret_cast<char *>(&si_me), 0, sizeof(si_me));
|
||||
}
|
||||
|
||||
|
||||
@ -230,7 +223,7 @@ Gr_Complex_Ip_Packet_Source::~Gr_Complex_Ip_Packet_Source()
|
||||
{
|
||||
delete d_pcap_thread;
|
||||
}
|
||||
delete fifo_buff;
|
||||
delete[] fifo_buff;
|
||||
std::cout << "Stop Ethernet packet capture\n";
|
||||
}
|
||||
|
||||
|
@ -90,19 +90,16 @@ private:
|
||||
std::string d_src_device;
|
||||
std::string d_origin_address;
|
||||
pcap_t *descr; // ethernet pcap device descriptor
|
||||
size_t d_item_size;
|
||||
char *fifo_buff;
|
||||
int fifo_read_ptr;
|
||||
int fifo_write_ptr;
|
||||
int fifo_items;
|
||||
int d_sock_raw;
|
||||
int d_udp_port;
|
||||
int d_udp_payload_size;
|
||||
int d_n_baseband_channels;
|
||||
int d_wire_sample_type;
|
||||
int d_bytes_per_sample;
|
||||
bool d_IQ_swap;
|
||||
bool d_fifo_full;
|
||||
};
|
||||
|
||||
|
||||
|
@ -45,18 +45,17 @@ labsat23_source::labsat23_source(const char *signal_file_basename,
|
||||
bool digital_io_enabled) : gr::block("labsat23_source",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
gr::io_signature::make(1, 3, sizeof(gr_complex))),
|
||||
d_queue(queue)
|
||||
d_queue(queue),
|
||||
d_channel_selector_config(channel_selector),
|
||||
d_current_file_number(0),
|
||||
d_labsat_version(0),
|
||||
d_channel_selector(0),
|
||||
d_ref_clock(0),
|
||||
d_bits_per_sample(0),
|
||||
d_header_parsed(false),
|
||||
d_ls3w_digital_io_enabled(digital_io_enabled)
|
||||
{
|
||||
d_channel_selector_config = channel_selector;
|
||||
d_header_parsed = false;
|
||||
d_bits_per_sample = 0;
|
||||
d_current_file_number = 0;
|
||||
d_labsat_version = 0;
|
||||
d_ref_clock = 0;
|
||||
d_channel_selector = 0;
|
||||
d_signal_file_basename = std::string(signal_file_basename);
|
||||
d_ls3w_digital_io_enabled = digital_io_enabled;
|
||||
|
||||
std::string signal_file;
|
||||
this->set_output_multiple(8);
|
||||
signal_file = generate_filename();
|
||||
|
@ -26,12 +26,13 @@ unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples(int adc_nbit_)
|
||||
}
|
||||
|
||||
|
||||
unpack_spir_gss6450_samples::unpack_spir_gss6450_samples(int adc_nbit) : gr::sync_interpolator("unpack_spir_gss6450_samples",
|
||||
gr::io_signature::make(1, 1, sizeof(int32_t)),
|
||||
gr::io_signature::make(1, 1, sizeof(gr_complex)), 16 / adc_nbit)
|
||||
unpack_spir_gss6450_samples::unpack_spir_gss6450_samples(int adc_nbit)
|
||||
: gr::sync_interpolator("unpack_spir_gss6450_samples",
|
||||
gr::io_signature::make(1, 1, sizeof(int32_t)),
|
||||
gr::io_signature::make(1, 1, sizeof(gr_complex)), 16 / adc_nbit),
|
||||
adc_bits(adc_nbit),
|
||||
samples_per_int(16 / adc_bits)
|
||||
{
|
||||
adc_bits = adc_nbit;
|
||||
samples_per_int = 16 / adc_bits;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user