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

Use std::move() to avoid unnecessary copies

This commit is contained in:
Carles Fernandez 2018-12-03 00:46:38 +01:00
parent da069c5968
commit 482558aa27
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 8 additions and 8 deletions

View File

@ -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);
}

View File

@ -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;