mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-09-25 02:11:51 +00:00
Improve memory management
The blocks are now always managed by smart pointers instead of raw pointers
This commit is contained in:
@@ -43,11 +43,10 @@ using google::LogMessage;
|
||||
|
||||
// Constructor
|
||||
Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
|
||||
GNSSBlockInterface *pass_through, AcquisitionInterface *acq,
|
||||
TrackingInterface *trk, TelemetryDecoderInterface *nav,
|
||||
std::shared_ptr<GNSSBlockInterface> pass_through, std::shared_ptr<AcquisitionInterface> acq,
|
||||
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
|
||||
std::string role, std::string implementation, boost::shared_ptr<gr::msg_queue> queue)
|
||||
{
|
||||
|
||||
pass_through_ = pass_through;
|
||||
acq_ = acq;
|
||||
trk_ = trk;
|
||||
@@ -187,3 +186,4 @@ void Channel::start_acquisition()
|
||||
{
|
||||
channel_fsm_.Event_start_acquisition();
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ class Channel: public ChannelInterface
|
||||
public:
|
||||
//! Constructor
|
||||
Channel(ConfigurationInterface *configuration, unsigned int channel,
|
||||
GNSSBlockInterface *pass_through, AcquisitionInterface *acq,
|
||||
TrackingInterface *trk, TelemetryDecoderInterface *nav,
|
||||
std::shared_ptr<GNSSBlockInterface> pass_through, std::shared_ptr<AcquisitionInterface> acq,
|
||||
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
|
||||
std::string role, std::string implementation,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
//! Virtual destructor
|
||||
@@ -77,9 +77,9 @@ public:
|
||||
std::string implementation(){ return implementation_; }
|
||||
size_t item_size(){ return 0; }
|
||||
Gnss_Signal get_signal() const { return gnss_signal_; }
|
||||
AcquisitionInterface* acquisition(){ return acq_; }
|
||||
TrackingInterface* tracking(){ return trk_; }
|
||||
TelemetryDecoderInterface* telemetry(){ return nav_; }
|
||||
std::shared_ptr<AcquisitionInterface> acquisition(){ return acq_; }
|
||||
std::shared_ptr<TrackingInterface> tracking(){ return trk_; }
|
||||
std::shared_ptr<TelemetryDecoderInterface> telemetry(){ return nav_; }
|
||||
void start_acquisition(); //!< Start the State Machine
|
||||
void set_signal(const Gnss_Signal& gnss_signal_); //!< Sets the channel GNSS signal
|
||||
|
||||
@@ -88,10 +88,10 @@ public:
|
||||
|
||||
private:
|
||||
channel_msg_receiver_cc_sptr channel_msg_rx;
|
||||
GNSSBlockInterface *pass_through_;
|
||||
AcquisitionInterface *acq_;
|
||||
TrackingInterface *trk_;
|
||||
TelemetryDecoderInterface *nav_;
|
||||
std::shared_ptr<GNSSBlockInterface> pass_through_;
|
||||
std::shared_ptr<AcquisitionInterface> acq_;
|
||||
std::shared_ptr<TrackingInterface> trk_;
|
||||
std::shared_ptr<TelemetryDecoderInterface> nav_;
|
||||
std::string role_;
|
||||
std::string implementation_;
|
||||
unsigned int channel_;
|
||||
|
||||
@@ -136,7 +136,7 @@ ChannelFsm::ChannelFsm()
|
||||
|
||||
|
||||
|
||||
ChannelFsm::ChannelFsm(AcquisitionInterface *acquisition) :
|
||||
ChannelFsm::ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition) :
|
||||
acq_(acquisition)
|
||||
{
|
||||
trk_ = nullptr;
|
||||
@@ -180,12 +180,12 @@ void ChannelFsm::Event_failed_tracking_standby()
|
||||
// this->process_event(Ev_channel_failed_tracking_reacq());
|
||||
//}
|
||||
|
||||
void ChannelFsm::set_acquisition(AcquisitionInterface *acquisition)
|
||||
void ChannelFsm::set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition)
|
||||
{
|
||||
acq_ = acquisition;
|
||||
}
|
||||
|
||||
void ChannelFsm::set_tracking(TrackingInterface *tracking)
|
||||
void ChannelFsm::set_tracking(std::shared_ptr<TrackingInterface> tracking)
|
||||
{
|
||||
trk_ = tracking;
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ class ChannelFsm: public sc::state_machine<ChannelFsm, channel_idle_fsm_S0>
|
||||
{
|
||||
public:
|
||||
ChannelFsm();
|
||||
ChannelFsm(AcquisitionInterface *acquisition);
|
||||
ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition);
|
||||
|
||||
void set_acquisition(AcquisitionInterface *acquisition);
|
||||
void set_tracking(TrackingInterface *tracking);
|
||||
void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
|
||||
void set_tracking(std::shared_ptr<TrackingInterface> tracking);
|
||||
void set_queue(boost::shared_ptr<gr::msg_queue> queue);
|
||||
void set_channel(unsigned int channel);
|
||||
void start_acquisition();
|
||||
@@ -75,8 +75,8 @@ public:
|
||||
void Event_failed_tracking_standby();
|
||||
|
||||
private:
|
||||
AcquisitionInterface *acq_;
|
||||
TrackingInterface *trk_;
|
||||
std::shared_ptr<AcquisitionInterface> acq_;
|
||||
std::shared_ptr<TrackingInterface> trk_;
|
||||
boost::shared_ptr<gr::msg_queue> queue_;
|
||||
unsigned int channel_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user