mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Use std::move() to avoid unnecessary copies
This commit is contained in:
parent
da069c5968
commit
482558aa27
@ -44,7 +44,7 @@ ChannelFsm::ChannelFsm()
|
||||
}
|
||||
|
||||
|
||||
ChannelFsm::ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition) : acq_(acquisition)
|
||||
ChannelFsm::ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition) : acq_(std::move(acquisition))
|
||||
{
|
||||
trk_ = nullptr;
|
||||
channel_ = 0U;
|
||||
@ -162,21 +162,21 @@ bool ChannelFsm::Event_failed_tracking_standby()
|
||||
void ChannelFsm::set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(mx);
|
||||
acq_ = acquisition;
|
||||
acq_ = std::move(acquisition);
|
||||
}
|
||||
|
||||
|
||||
void ChannelFsm::set_tracking(std::shared_ptr<TrackingInterface> tracking)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(mx);
|
||||
trk_ = tracking;
|
||||
trk_ = std::move(tracking);
|
||||
}
|
||||
|
||||
|
||||
void ChannelFsm::set_queue(gr::msg_queue::sptr queue)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(mx);
|
||||
queue_ = queue;
|
||||
queue_ = std::move(queue);
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ using google::LogMessage;
|
||||
|
||||
channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(std::shared_ptr<ChannelFsm> channel_fsm, bool repeat)
|
||||
{
|
||||
return channel_msg_receiver_cc_sptr(new channel_msg_receiver_cc(channel_fsm, repeat));
|
||||
return channel_msg_receiver_cc_sptr(new channel_msg_receiver_cc(std::move(channel_fsm), repeat));
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ void channel_msg_receiver_cc::msg_handler_events(pmt::pmt_t msg)
|
||||
bool result = false;
|
||||
try
|
||||
{
|
||||
int64_t message = pmt::to_long(msg);
|
||||
int64_t message = pmt::to_long(std::move(msg));
|
||||
switch (message)
|
||||
{
|
||||
case 1: // positive acquisition
|
||||
@ -89,9 +89,9 @@ channel_msg_receiver_cc::channel_msg_receiver_cc(std::shared_ptr<ChannelFsm> cha
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&channel_msg_receiver_cc::msg_handler_events, this, _1));
|
||||
|
||||
d_channel_fsm = channel_fsm;
|
||||
d_channel_fsm = std::move(channel_fsm);
|
||||
d_repeat = repeat;
|
||||
}
|
||||
|
||||
|
||||
channel_msg_receiver_cc::~channel_msg_receiver_cc() {}
|
||||
channel_msg_receiver_cc::~channel_msg_receiver_cc() = default;
|
||||
|
Loading…
Reference in New Issue
Block a user