2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2017-01-03 14:40:31 -08:00
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "frc/smartdashboard/SendableChooserBase.h"
|
2017-01-03 14:40:31 -08:00
|
|
|
|
2019-09-14 15:22:54 -05:00
|
|
|
#include "frc/smartdashboard/SendableRegistry.h"
|
|
|
|
|
|
2017-01-03 14:40:31 -08:00
|
|
|
using namespace frc;
|
|
|
|
|
|
2018-07-28 10:43:47 -07:00
|
|
|
std::atomic_int SendableChooserBase::s_instances{0};
|
|
|
|
|
|
2019-09-14 15:22:54 -05:00
|
|
|
SendableChooserBase::SendableChooserBase() : m_instance{s_instances++} {
|
|
|
|
|
SendableRegistry::GetInstance().Add(this, "SendableChooser", m_instance);
|
|
|
|
|
}
|
2019-10-19 11:36:44 -07:00
|
|
|
|
|
|
|
|
SendableChooserBase::SendableChooserBase(SendableChooserBase&& oth)
|
|
|
|
|
: SendableHelper(std::move(oth)),
|
|
|
|
|
m_defaultChoice(std::move(oth.m_defaultChoice)),
|
|
|
|
|
m_selected(std::move(oth.m_selected)),
|
|
|
|
|
m_haveSelected(std::move(oth.m_haveSelected)),
|
|
|
|
|
m_activeEntries(std::move(oth.m_activeEntries)),
|
|
|
|
|
m_instance(std::move(oth.m_instance)) {}
|
|
|
|
|
|
|
|
|
|
SendableChooserBase& SendableChooserBase::operator=(SendableChooserBase&& oth) {
|
|
|
|
|
SendableHelper::operator=(oth);
|
|
|
|
|
std::scoped_lock lock(m_mutex, oth.m_mutex);
|
|
|
|
|
m_defaultChoice = std::move(oth.m_defaultChoice);
|
|
|
|
|
m_selected = std::move(oth.m_selected);
|
|
|
|
|
m_haveSelected = std::move(oth.m_haveSelected);
|
|
|
|
|
m_activeEntries = std::move(oth.m_activeEntries);
|
|
|
|
|
m_instance = std::move(oth.m_instance);
|
|
|
|
|
return *this;
|
|
|
|
|
}
|