diff --git a/wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp b/wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp index 10c7a2b180..3dde23425e 100644 --- a/wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp +++ b/wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp @@ -19,15 +19,15 @@ static constexpr auto kSamplePeriod = 0.0005_s; static constexpr double kCalibrationSampleTime = 5.0; static constexpr double kDegreePerSecondPerLSB = 0.0125; -static constexpr int kRateRegister = 0x00; -static constexpr int kTemRegister = 0x02; -static constexpr int kLoCSTRegister = 0x04; -static constexpr int kHiCSTRegister = 0x06; -static constexpr int kQuadRegister = 0x08; -static constexpr int kFaultRegister = 0x0A; +// static constexpr int kRateRegister = 0x00; +// static constexpr int kTemRegister = 0x02; +// static constexpr int kLoCSTRegister = 0x04; +// static constexpr int kHiCSTRegister = 0x06; +// static constexpr int kQuadRegister = 0x08; +// static constexpr int kFaultRegister = 0x0A; static constexpr int kPIDRegister = 0x0C; -static constexpr int kSNHighRegister = 0x0E; -static constexpr int kSNLowRegister = 0x10; +// static constexpr int kSNHighRegister = 0x0E; +// static constexpr int kSNLowRegister = 0x10; ADXRS450_Gyro::ADXRS450_Gyro() : ADXRS450_Gyro(SPI::kOnboardCS0) {} diff --git a/wpilibc/src/main/native/cpp/GenericHID.cpp b/wpilibc/src/main/native/cpp/GenericHID.cpp index d1a3112978..504d6691f1 100644 --- a/wpilibc/src/main/native/cpp/GenericHID.cpp +++ b/wpilibc/src/main/native/cpp/GenericHID.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -14,7 +14,7 @@ using namespace frc; -GenericHID::GenericHID(int port) : m_ds(DriverStation::GetInstance()) { +GenericHID::GenericHID(int port) : m_ds(&DriverStation::GetInstance()) { if (port >= DriverStation::kJoystickPorts) { wpi_setWPIError(BadJoystickIndex); } @@ -22,39 +22,41 @@ GenericHID::GenericHID(int port) : m_ds(DriverStation::GetInstance()) { } bool GenericHID::GetRawButton(int button) const { - return m_ds.GetStickButton(m_port, button); + return m_ds->GetStickButton(m_port, button); } bool GenericHID::GetRawButtonPressed(int button) { - return m_ds.GetStickButtonPressed(m_port, button); + return m_ds->GetStickButtonPressed(m_port, button); } bool GenericHID::GetRawButtonReleased(int button) { - return m_ds.GetStickButtonReleased(m_port, button); + return m_ds->GetStickButtonReleased(m_port, button); } double GenericHID::GetRawAxis(int axis) const { - return m_ds.GetStickAxis(m_port, axis); + return m_ds->GetStickAxis(m_port, axis); } -int GenericHID::GetPOV(int pov) const { return m_ds.GetStickPOV(m_port, pov); } +int GenericHID::GetPOV(int pov) const { return m_ds->GetStickPOV(m_port, pov); } -int GenericHID::GetAxisCount() const { return m_ds.GetStickAxisCount(m_port); } +int GenericHID::GetAxisCount() const { return m_ds->GetStickAxisCount(m_port); } -int GenericHID::GetPOVCount() const { return m_ds.GetStickPOVCount(m_port); } +int GenericHID::GetPOVCount() const { return m_ds->GetStickPOVCount(m_port); } int GenericHID::GetButtonCount() const { - return m_ds.GetStickButtonCount(m_port); + return m_ds->GetStickButtonCount(m_port); } GenericHID::HIDType GenericHID::GetType() const { - return static_cast(m_ds.GetJoystickType(m_port)); + return static_cast(m_ds->GetJoystickType(m_port)); } -std::string GenericHID::GetName() const { return m_ds.GetJoystickName(m_port); } +std::string GenericHID::GetName() const { + return m_ds->GetJoystickName(m_port); +} int GenericHID::GetAxisType(int axis) const { - return m_ds.GetJoystickAxisType(m_port, axis); + return m_ds->GetJoystickAxisType(m_port, axis); } int GenericHID::GetPort() const { return m_port; } diff --git a/wpilibc/src/main/native/cpp/Timer.cpp b/wpilibc/src/main/native/cpp/Timer.cpp index 9eec5327b5..1bb10efd3b 100644 --- a/wpilibc/src/main/native/cpp/Timer.cpp +++ b/wpilibc/src/main/native/cpp/Timer.cpp @@ -39,6 +39,21 @@ const double Timer::kRolloverTime = (1ll << 32) / 1e6; Timer::Timer() { Reset(); } +Timer::Timer(const Timer& rhs) + : m_startTime(rhs.m_startTime), + m_accumulatedTime(rhs.m_accumulatedTime), + m_running(rhs.m_running) {} + +Timer& Timer::operator=(const Timer& rhs) { + std::scoped_lock lock(m_mutex, rhs.m_mutex); + + m_startTime = rhs.m_startTime; + m_accumulatedTime = rhs.m_accumulatedTime; + m_running = rhs.m_running; + + return *this; +} + Timer::Timer(Timer&& rhs) : m_startTime(std::move(rhs.m_startTime)), m_accumulatedTime(std::move(rhs.m_accumulatedTime)), diff --git a/wpilibc/src/main/native/cpp/buttons/Trigger.cpp b/wpilibc/src/main/native/cpp/buttons/Trigger.cpp index 2ccaaf22a1..f215083937 100644 --- a/wpilibc/src/main/native/cpp/buttons/Trigger.cpp +++ b/wpilibc/src/main/native/cpp/buttons/Trigger.cpp @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2011-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2011-2019 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -15,6 +15,27 @@ using namespace frc; +Trigger::Trigger(const Trigger& rhs) : SendableHelper(rhs) {} + +Trigger& Trigger::operator=(const Trigger& rhs) { + SendableHelper::operator=(rhs); + m_sendablePressed = false; + return *this; +} + +Trigger::Trigger(Trigger&& rhs) + : SendableHelper(std::move(rhs)), + m_sendablePressed(rhs.m_sendablePressed.load()) { + rhs.m_sendablePressed = false; +} + +Trigger& Trigger::operator=(Trigger&& rhs) { + SendableHelper::operator=(std::move(rhs)); + m_sendablePressed = rhs.m_sendablePressed.load(); + rhs.m_sendablePressed = false; + return *this; +} + bool Trigger::Grab() { return Get() || m_sendablePressed; } void Trigger::WhenActive(Command* command) { diff --git a/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp b/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp index 2880807fbf..ee23a5e10c 100644 --- a/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp +++ b/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp @@ -20,10 +20,10 @@ using namespace frc; DifferentialDrive::DifferentialDrive(SpeedController& leftMotor, SpeedController& rightMotor) - : m_leftMotor(leftMotor), m_rightMotor(rightMotor) { + : m_leftMotor(&leftMotor), m_rightMotor(&rightMotor) { auto& registry = SendableRegistry::GetInstance(); - registry.AddChild(this, &m_leftMotor); - registry.AddChild(this, &m_rightMotor); + registry.AddChild(this, m_leftMotor); + registry.AddChild(this, m_rightMotor); static int instances = 0; ++instances; registry.AddLW(this, "DifferentialDrive", instances); @@ -77,9 +77,9 @@ void DifferentialDrive::ArcadeDrive(double xSpeed, double zRotation, } } - m_leftMotor.Set(std::clamp(leftMotorOutput, -1.0, 1.0) * m_maxOutput); + m_leftMotor->Set(std::clamp(leftMotorOutput, -1.0, 1.0) * m_maxOutput); double maxOutput = m_maxOutput * m_rightSideInvertMultiplier; - m_rightMotor.Set(std::clamp(rightMotorOutput, -1.0, 1.0) * maxOutput); + m_rightMotor->Set(std::clamp(rightMotorOutput, -1.0, 1.0) * maxOutput); Feed(); } @@ -151,9 +151,9 @@ void DifferentialDrive::CurvatureDrive(double xSpeed, double zRotation, rightMotorOutput /= maxMagnitude; } - m_leftMotor.Set(leftMotorOutput * m_maxOutput); - m_rightMotor.Set(rightMotorOutput * m_maxOutput * - m_rightSideInvertMultiplier); + m_leftMotor->Set(leftMotorOutput * m_maxOutput); + m_rightMotor->Set(rightMotorOutput * m_maxOutput * + m_rightSideInvertMultiplier); Feed(); } @@ -180,8 +180,8 @@ void DifferentialDrive::TankDrive(double leftSpeed, double rightSpeed, rightSpeed = std::copysign(rightSpeed * rightSpeed, rightSpeed); } - m_leftMotor.Set(leftSpeed * m_maxOutput); - m_rightMotor.Set(rightSpeed * m_maxOutput * m_rightSideInvertMultiplier); + m_leftMotor->Set(leftSpeed * m_maxOutput); + m_rightMotor->Set(rightSpeed * m_maxOutput * m_rightSideInvertMultiplier); Feed(); } @@ -203,8 +203,8 @@ void DifferentialDrive::SetRightSideInverted(bool rightSideInverted) { } void DifferentialDrive::StopMotor() { - m_leftMotor.StopMotor(); - m_rightMotor.StopMotor(); + m_leftMotor->StopMotor(); + m_rightMotor->StopMotor(); Feed(); } @@ -217,12 +217,12 @@ void DifferentialDrive::InitSendable(SendableBuilder& builder) { builder.SetActuator(true); builder.SetSafeState([=] { StopMotor(); }); builder.AddDoubleProperty("Left Motor Speed", - [=]() { return m_leftMotor.Get(); }, - [=](double value) { m_leftMotor.Set(value); }); + [=]() { return m_leftMotor->Get(); }, + [=](double value) { m_leftMotor->Set(value); }); builder.AddDoubleProperty( "Right Motor Speed", - [=]() { return m_rightMotor.Get() * m_rightSideInvertMultiplier; }, + [=]() { return m_rightMotor->Get() * m_rightSideInvertMultiplier; }, [=](double value) { - m_rightMotor.Set(value * m_rightSideInvertMultiplier); + m_rightMotor->Set(value * m_rightSideInvertMultiplier); }); } diff --git a/wpilibc/src/main/native/cpp/drive/KilloughDrive.cpp b/wpilibc/src/main/native/cpp/drive/KilloughDrive.cpp index 2a71f618fc..4c15de850a 100644 --- a/wpilibc/src/main/native/cpp/drive/KilloughDrive.cpp +++ b/wpilibc/src/main/native/cpp/drive/KilloughDrive.cpp @@ -29,7 +29,9 @@ KilloughDrive::KilloughDrive(SpeedController& leftMotor, SpeedController& rightMotor, SpeedController& backMotor, double leftMotorAngle, double rightMotorAngle, double backMotorAngle) - : m_leftMotor(leftMotor), m_rightMotor(rightMotor), m_backMotor(backMotor) { + : m_leftMotor(&leftMotor), + m_rightMotor(&rightMotor), + m_backMotor(&backMotor) { m_leftVec = {std::cos(leftMotorAngle * (wpi::math::pi / 180.0)), std::sin(leftMotorAngle * (wpi::math::pi / 180.0))}; m_rightVec = {std::cos(rightMotorAngle * (wpi::math::pi / 180.0)), @@ -37,9 +39,9 @@ KilloughDrive::KilloughDrive(SpeedController& leftMotor, m_backVec = {std::cos(backMotorAngle * (wpi::math::pi / 180.0)), std::sin(backMotorAngle * (wpi::math::pi / 180.0))}; auto& registry = SendableRegistry::GetInstance(); - registry.AddChild(this, &m_leftMotor); - registry.AddChild(this, &m_rightMotor); - registry.AddChild(this, &m_backMotor); + registry.AddChild(this, m_leftMotor); + registry.AddChild(this, m_rightMotor); + registry.AddChild(this, m_backMotor); static int instances = 0; ++instances; registry.AddLW(this, "KilloughDrive", instances); @@ -70,9 +72,9 @@ void KilloughDrive::DriveCartesian(double ySpeed, double xSpeed, Normalize(wheelSpeeds); - m_leftMotor.Set(wheelSpeeds[kLeft] * m_maxOutput); - m_rightMotor.Set(wheelSpeeds[kRight] * m_maxOutput); - m_backMotor.Set(wheelSpeeds[kBack] * m_maxOutput); + m_leftMotor->Set(wheelSpeeds[kLeft] * m_maxOutput); + m_rightMotor->Set(wheelSpeeds[kRight] * m_maxOutput); + m_backMotor->Set(wheelSpeeds[kBack] * m_maxOutput); Feed(); } @@ -91,9 +93,9 @@ void KilloughDrive::DrivePolar(double magnitude, double angle, } void KilloughDrive::StopMotor() { - m_leftMotor.StopMotor(); - m_rightMotor.StopMotor(); - m_backMotor.StopMotor(); + m_leftMotor->StopMotor(); + m_rightMotor->StopMotor(); + m_backMotor->StopMotor(); Feed(); } @@ -106,12 +108,12 @@ void KilloughDrive::InitSendable(SendableBuilder& builder) { builder.SetActuator(true); builder.SetSafeState([=] { StopMotor(); }); builder.AddDoubleProperty("Left Motor Speed", - [=]() { return m_leftMotor.Get(); }, - [=](double value) { m_leftMotor.Set(value); }); + [=]() { return m_leftMotor->Get(); }, + [=](double value) { m_leftMotor->Set(value); }); builder.AddDoubleProperty("Right Motor Speed", - [=]() { return m_rightMotor.Get(); }, - [=](double value) { m_rightMotor.Set(value); }); + [=]() { return m_rightMotor->Get(); }, + [=](double value) { m_rightMotor->Set(value); }); builder.AddDoubleProperty("Back Motor Speed", - [=]() { return m_backMotor.Get(); }, - [=](double value) { m_backMotor.Set(value); }); + [=]() { return m_backMotor->Get(); }, + [=](double value) { m_backMotor->Set(value); }); } diff --git a/wpilibc/src/main/native/cpp/drive/MecanumDrive.cpp b/wpilibc/src/main/native/cpp/drive/MecanumDrive.cpp index c3256b962b..473e0338a4 100644 --- a/wpilibc/src/main/native/cpp/drive/MecanumDrive.cpp +++ b/wpilibc/src/main/native/cpp/drive/MecanumDrive.cpp @@ -24,15 +24,15 @@ MecanumDrive::MecanumDrive(SpeedController& frontLeftMotor, SpeedController& rearLeftMotor, SpeedController& frontRightMotor, SpeedController& rearRightMotor) - : m_frontLeftMotor(frontLeftMotor), - m_rearLeftMotor(rearLeftMotor), - m_frontRightMotor(frontRightMotor), - m_rearRightMotor(rearRightMotor) { + : m_frontLeftMotor(&frontLeftMotor), + m_rearLeftMotor(&rearLeftMotor), + m_frontRightMotor(&frontRightMotor), + m_rearRightMotor(&rearRightMotor) { auto& registry = SendableRegistry::GetInstance(); - registry.AddChild(this, &m_frontLeftMotor); - registry.AddChild(this, &m_rearLeftMotor); - registry.AddChild(this, &m_frontRightMotor); - registry.AddChild(this, &m_rearRightMotor); + registry.AddChild(this, m_frontLeftMotor); + registry.AddChild(this, m_rearLeftMotor); + registry.AddChild(this, m_frontRightMotor); + registry.AddChild(this, m_rearRightMotor); static int instances = 0; ++instances; registry.AddLW(this, "MecanumDrive", instances); @@ -64,12 +64,12 @@ void MecanumDrive::DriveCartesian(double ySpeed, double xSpeed, Normalize(wheelSpeeds); - m_frontLeftMotor.Set(wheelSpeeds[kFrontLeft] * m_maxOutput); - m_frontRightMotor.Set(wheelSpeeds[kFrontRight] * m_maxOutput * + m_frontLeftMotor->Set(wheelSpeeds[kFrontLeft] * m_maxOutput); + m_frontRightMotor->Set(wheelSpeeds[kFrontRight] * m_maxOutput * + m_rightSideInvertMultiplier); + m_rearLeftMotor->Set(wheelSpeeds[kRearLeft] * m_maxOutput); + m_rearRightMotor->Set(wheelSpeeds[kRearRight] * m_maxOutput * m_rightSideInvertMultiplier); - m_rearLeftMotor.Set(wheelSpeeds[kRearLeft] * m_maxOutput); - m_rearRightMotor.Set(wheelSpeeds[kRearRight] * m_maxOutput * - m_rightSideInvertMultiplier); Feed(); } @@ -96,10 +96,10 @@ void MecanumDrive::SetRightSideInverted(bool rightSideInverted) { } void MecanumDrive::StopMotor() { - m_frontLeftMotor.StopMotor(); - m_frontRightMotor.StopMotor(); - m_rearLeftMotor.StopMotor(); - m_rearRightMotor.StopMotor(); + m_frontLeftMotor->StopMotor(); + m_frontRightMotor->StopMotor(); + m_rearLeftMotor->StopMotor(); + m_rearRightMotor->StopMotor(); Feed(); } @@ -111,22 +111,22 @@ void MecanumDrive::InitSendable(SendableBuilder& builder) { builder.SetSmartDashboardType("MecanumDrive"); builder.SetActuator(true); builder.SetSafeState([=] { StopMotor(); }); - builder.AddDoubleProperty("Front Left Motor Speed", - [=]() { return m_frontLeftMotor.Get(); }, - [=](double value) { m_frontLeftMotor.Set(value); }); + builder.AddDoubleProperty( + "Front Left Motor Speed", [=]() { return m_frontLeftMotor->Get(); }, + [=](double value) { m_frontLeftMotor->Set(value); }); builder.AddDoubleProperty( "Front Right Motor Speed", - [=]() { return m_frontRightMotor.Get() * m_rightSideInvertMultiplier; }, + [=]() { return m_frontRightMotor->Get() * m_rightSideInvertMultiplier; }, [=](double value) { - m_frontRightMotor.Set(value * m_rightSideInvertMultiplier); + m_frontRightMotor->Set(value * m_rightSideInvertMultiplier); }); builder.AddDoubleProperty("Rear Left Motor Speed", - [=]() { return m_rearLeftMotor.Get(); }, - [=](double value) { m_rearLeftMotor.Set(value); }); + [=]() { return m_rearLeftMotor->Get(); }, + [=](double value) { m_rearLeftMotor->Set(value); }); builder.AddDoubleProperty( "Rear Right Motor Speed", - [=]() { return m_rearRightMotor.Get() * m_rightSideInvertMultiplier; }, + [=]() { return m_rearRightMotor->Get() * m_rightSideInvertMultiplier; }, [=](double value) { - m_rearRightMotor.Set(value * m_rightSideInvertMultiplier); + m_rearRightMotor->Set(value * m_rightSideInvertMultiplier); }); } diff --git a/wpilibc/src/main/native/cpp/smartdashboard/SendableChooserBase.cpp b/wpilibc/src/main/native/cpp/smartdashboard/SendableChooserBase.cpp index 419b8d6acf..2f7af9cf54 100644 --- a/wpilibc/src/main/native/cpp/smartdashboard/SendableChooserBase.cpp +++ b/wpilibc/src/main/native/cpp/smartdashboard/SendableChooserBase.cpp @@ -16,3 +16,22 @@ std::atomic_int SendableChooserBase::s_instances{0}; SendableChooserBase::SendableChooserBase() : m_instance{s_instances++} { SendableRegistry::GetInstance().Add(this, "SendableChooser", m_instance); } + +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; +} diff --git a/wpilibc/src/main/native/include/frc/GenericHID.h b/wpilibc/src/main/native/include/frc/GenericHID.h index 74e5271fa1..aae10cf217 100644 --- a/wpilibc/src/main/native/include/frc/GenericHID.h +++ b/wpilibc/src/main/native/include/frc/GenericHID.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -179,7 +179,7 @@ class GenericHID : public ErrorBase { void SetRumble(RumbleType type, double value); private: - DriverStation& m_ds; + DriverStation* m_ds; int m_port; int m_outputs = 0; uint16_t m_leftRumble = 0; diff --git a/wpilibc/src/main/native/include/frc/NidecBrushless.h b/wpilibc/src/main/native/include/frc/NidecBrushless.h index ec0032b0ca..fa77e28636 100644 --- a/wpilibc/src/main/native/include/frc/NidecBrushless.h +++ b/wpilibc/src/main/native/include/frc/NidecBrushless.h @@ -7,8 +7,6 @@ #pragma once -#include - #include "frc/DigitalOutput.h" #include "frc/ErrorBase.h" #include "frc/MotorSafety.h" @@ -102,7 +100,7 @@ class NidecBrushless : public SpeedController, private: bool m_isInverted = false; - std::atomic_bool m_disabled{false}; + bool m_disabled = false; DigitalOutput m_dio; PWM m_pwm; double m_speed = 0.0; diff --git a/wpilibc/src/main/native/include/frc/PIDBase.h b/wpilibc/src/main/native/include/frc/PIDBase.h index 9181ba8bda..d2d2af79a5 100644 --- a/wpilibc/src/main/native/include/frc/PIDBase.h +++ b/wpilibc/src/main/native/include/frc/PIDBase.h @@ -66,9 +66,6 @@ class PIDBase : public PIDInterface, virtual ~PIDBase() = default; - PIDBase(PIDBase&&) = default; - PIDBase& operator=(PIDBase&&) = default; - /** * Return the current PID result. * diff --git a/wpilibc/src/main/native/include/frc/PIDController.h b/wpilibc/src/main/native/include/frc/PIDController.h index e640f45c30..88b07865c9 100644 --- a/wpilibc/src/main/native/include/frc/PIDController.h +++ b/wpilibc/src/main/native/include/frc/PIDController.h @@ -102,9 +102,6 @@ class PIDController : public PIDBase, public Controller { ~PIDController() override; - PIDController(PIDController&&) = default; - PIDController& operator=(PIDController&&) = default; - /** * Begin running the PIDController. */ diff --git a/wpilibc/src/main/native/include/frc/Resource.h b/wpilibc/src/main/native/include/frc/Resource.h index 9df219632b..e9759d5607 100644 --- a/wpilibc/src/main/native/include/frc/Resource.h +++ b/wpilibc/src/main/native/include/frc/Resource.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -33,9 +33,6 @@ class Resource : public ErrorBase { public: virtual ~Resource() = default; - Resource(Resource&&) = default; - Resource& operator=(Resource&&) = default; - /** * Factory method to create a Resource allocation-tracker *if* needed. * diff --git a/wpilibc/src/main/native/include/frc/Timer.h b/wpilibc/src/main/native/include/frc/Timer.h index c143dcc36c..c293f11e29 100644 --- a/wpilibc/src/main/native/include/frc/Timer.h +++ b/wpilibc/src/main/native/include/frc/Timer.h @@ -57,6 +57,8 @@ class Timer { virtual ~Timer() = default; + Timer(const Timer& rhs); + Timer& operator=(const Timer& rhs); Timer(Timer&& rhs); Timer& operator=(Timer&& rhs); diff --git a/wpilibc/src/main/native/include/frc/buttons/Trigger.h b/wpilibc/src/main/native/include/frc/buttons/Trigger.h index 4c7b01c61b..56700e98c4 100644 --- a/wpilibc/src/main/native/include/frc/buttons/Trigger.h +++ b/wpilibc/src/main/native/include/frc/buttons/Trigger.h @@ -34,8 +34,10 @@ class Trigger : public Sendable, public SendableHelper { Trigger() = default; ~Trigger() override = default; - Trigger(Trigger&&) = default; - Trigger& operator=(Trigger&&) = default; + Trigger(const Trigger& rhs); + Trigger& operator=(const Trigger& rhs); + Trigger(Trigger&& rhs); + Trigger& operator=(Trigger&& rhs); bool Grab(); virtual bool Get() = 0; diff --git a/wpilibc/src/main/native/include/frc/drive/DifferentialDrive.h b/wpilibc/src/main/native/include/frc/drive/DifferentialDrive.h index 6138f2c833..192d21bf01 100644 --- a/wpilibc/src/main/native/include/frc/drive/DifferentialDrive.h +++ b/wpilibc/src/main/native/include/frc/drive/DifferentialDrive.h @@ -212,8 +212,8 @@ class DifferentialDrive : public RobotDriveBase, void InitSendable(SendableBuilder& builder) override; private: - SpeedController& m_leftMotor; - SpeedController& m_rightMotor; + SpeedController* m_leftMotor; + SpeedController* m_rightMotor; double m_quickStopThreshold = kDefaultQuickStopThreshold; double m_quickStopAlpha = kDefaultQuickStopAlpha; diff --git a/wpilibc/src/main/native/include/frc/drive/KilloughDrive.h b/wpilibc/src/main/native/include/frc/drive/KilloughDrive.h index a35b59d667..2cc1c91690 100644 --- a/wpilibc/src/main/native/include/frc/drive/KilloughDrive.h +++ b/wpilibc/src/main/native/include/frc/drive/KilloughDrive.h @@ -132,9 +132,9 @@ class KilloughDrive : public RobotDriveBase, void InitSendable(SendableBuilder& builder) override; private: - SpeedController& m_leftMotor; - SpeedController& m_rightMotor; - SpeedController& m_backMotor; + SpeedController* m_leftMotor; + SpeedController* m_rightMotor; + SpeedController* m_backMotor; Vector2d m_leftVec; Vector2d m_rightVec; diff --git a/wpilibc/src/main/native/include/frc/drive/MecanumDrive.h b/wpilibc/src/main/native/include/frc/drive/MecanumDrive.h index 7c3489e19b..9ddb57e89e 100644 --- a/wpilibc/src/main/native/include/frc/drive/MecanumDrive.h +++ b/wpilibc/src/main/native/include/frc/drive/MecanumDrive.h @@ -137,10 +137,10 @@ class MecanumDrive : public RobotDriveBase, void InitSendable(SendableBuilder& builder) override; private: - SpeedController& m_frontLeftMotor; - SpeedController& m_rearLeftMotor; - SpeedController& m_frontRightMotor; - SpeedController& m_rearRightMotor; + SpeedController* m_frontLeftMotor; + SpeedController* m_rearLeftMotor; + SpeedController* m_frontRightMotor; + SpeedController* m_rearRightMotor; double m_rightSideInvertMultiplier = -1.0; diff --git a/wpilibc/src/main/native/include/frc/smartdashboard/SendableChooserBase.h b/wpilibc/src/main/native/include/frc/smartdashboard/SendableChooserBase.h index b3447e3143..2a5f5ab239 100644 --- a/wpilibc/src/main/native/include/frc/smartdashboard/SendableChooserBase.h +++ b/wpilibc/src/main/native/include/frc/smartdashboard/SendableChooserBase.h @@ -31,8 +31,8 @@ class SendableChooserBase : public Sendable, SendableChooserBase(); ~SendableChooserBase() override = default; - SendableChooserBase(SendableChooserBase&&) = default; - SendableChooserBase& operator=(SendableChooserBase&&) = default; + SendableChooserBase(SendableChooserBase&& oth); + SendableChooserBase& operator=(SendableChooserBase&& oth); protected: static constexpr const char* kDefault = "default";