1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Hide direct constructor as private member

This commit is contained in:
Carles Fernandez 2019-07-02 17:24:54 +02:00
parent 173361f89f
commit da7ca482a8
9 changed files with 41 additions and 27 deletions

View File

@ -49,7 +49,7 @@ BeamformerFilter::BeamformerFilter(
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
beamformer_ = make_beamformer();
beamformer_ = make_beamformer_sptr();
DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "resampler(" << beamformer_->unique_id() << ")";
}

View File

@ -36,7 +36,7 @@
#define GNSS_SDR_BEAMFORMER_CHANNELS 8
beamformer_sptr make_beamformer()
beamformer_sptr make_beamformer_sptr()
{
return beamformer_sptr(new beamformer());
}

View File

@ -36,7 +36,7 @@
class beamformer;
using beamformer_sptr = boost::shared_ptr<beamformer>;
beamformer_sptr make_beamformer();
beamformer_sptr make_beamformer_sptr();
/*!
* \brief This class implements a real-time software-defined spatial filter using the CTTC GNSS experimental antenna array input and a set of dynamically reloadable weights
@ -44,13 +44,13 @@ beamformer_sptr make_beamformer();
class beamformer : public gr::sync_block
{
public:
beamformer();
~beamformer();
int work(int noutput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
friend beamformer_sptr make_beamformer_sptr();
beamformer();
gr_complex *weight_vector;
};

View File

@ -41,8 +41,12 @@ class Notch;
using notch_sptr = boost::shared_ptr<Notch>;
notch_sptr make_notch_filter(float pfa, float p_c_factor,
int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
notch_sptr make_notch_filter(
float pfa,
float p_c_factor,
int32_t length_,
int32_t n_segments_est,
int32_t n_segments_reset);
/*!
* \brief This class implements a real-time software-defined multi state notch filter
@ -50,8 +54,6 @@ notch_sptr make_notch_filter(float pfa, float p_c_factor,
class Notch : public gr::block
{
public:
Notch(float pfa, float p_c_factor, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
~Notch();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
@ -61,6 +63,8 @@ public:
gr_vector_void_star &output_items);
private:
friend notch_sptr make_notch_filter(float pfa, float p_c_factor, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
Notch(float pfa, float p_c_factor, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
float pfa;
float noise_pow_est;
float thres_;

View File

@ -41,7 +41,13 @@ class NotchLite;
using notch_lite_sptr = boost::shared_ptr<NotchLite>;
notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
notch_lite_sptr make_notch_filter_lite(
float p_c_factor,
float pfa,
int32_t length_,
int32_t n_segments_est,
int32_t n_segments_reset,
int32_t n_segments_coeff);
/*!
* \brief This class implements a real-time software-defined multi state notch filter light version
@ -49,8 +55,6 @@ notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int32_t leng
class NotchLite : public gr::block
{
public:
NotchLite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
~NotchLite();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
@ -60,6 +64,8 @@ public:
gr_vector_void_star &output_items);
private:
friend notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
NotchLite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
int32_t length_;
int32_t n_segments;
int32_t n_segments_est;

View File

@ -39,14 +39,15 @@ class pulse_blanking_cc;
using pulse_blanking_cc_sptr = boost::shared_ptr<pulse_blanking_cc>;
pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
pulse_blanking_cc_sptr make_pulse_blanking_cc(
float pfa,
int32_t length_,
int32_t n_segments_est,
int32_t n_segments_reset);
class pulse_blanking_cc : public gr::block
{
public:
pulse_blanking_cc(float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
~pulse_blanking_cc();
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
@ -55,6 +56,8 @@ public:
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
private:
friend pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
pulse_blanking_cc(float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
int32_t length_;
int32_t n_segments;
int32_t n_segments_est;

View File

@ -55,14 +55,14 @@ Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item,
}
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, gr::msg_queue::sptr queue, bool stop_flowgraph)
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, gr::msg_queue::sptr queue, bool stop_flowgraph)
{
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
return valve_;
}
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, gr::msg_queue::sptr queue)
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, gr::msg_queue::sptr queue)
{
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true));
return valve_;

View File

@ -41,12 +41,14 @@
#include <cstddef> // for size_t
#include <cstdint>
boost::shared_ptr<gr::block> gnss_sdr_make_valve(
class Gnss_Sdr_Valve;
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue);
boost::shared_ptr<gr::block> gnss_sdr_make_valve(
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue,
@ -65,22 +67,22 @@ public:
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue, bool stop_flowgraph);
private:
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(
friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue);
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(
friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue,
bool stop_flowgraph);
Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems,
gr::msg_queue::sptr queue, bool stop_flowgraph);
uint64_t d_nitems;
uint64_t d_ncopied_items;
gr::msg_queue::sptr d_queue;

View File

@ -796,9 +796,8 @@ TEST_F(TrackingPullInTest, ValidationOfResults)
// create the msg queue for valve
queue = gr::msg_queue::make(0);
boost::shared_ptr<Gnss_Sdr_Valve> reseteable_valve;
long long int acq_to_trk_delay_samples = ceil(static_cast<double>(FLAGS_fs_gen_sps) * FLAGS_acq_to_trk_delay_s);
boost::shared_ptr<Gnss_Sdr_Valve> resetable_valve_(new Gnss_Sdr_Valve(sizeof(gr_complex), acq_to_trk_delay_samples, queue, false));
auto resetable_valve_ = gnss_sdr_make_valve(sizeof(gr_complex), acq_to_trk_delay_samples, queue, false);
std::shared_ptr<ControlMessageFactory> control_message_factory_;
std::shared_ptr<std::vector<std::shared_ptr<ControlMessage>>> control_messages_;