clang-tidy: modernize-use-override (NFC)

Add NOLINT to CommandTestBase due to gmock not adding "override" keyword,
which causes warnings on clang.
This commit is contained in:
Peter Johnson
2020-12-28 00:10:13 -08:00
parent 4cc0706b06
commit d11a3a6380
89 changed files with 156 additions and 151 deletions

View File

@@ -75,7 +75,7 @@ class MjpegServerImpl::ConnThread : public wpi::SafeThread {
explicit ConnThread(const wpi::Twine& name, wpi::Logger& logger)
: m_name(name.str()), m_logger(logger) {}
void Main();
void Main() override;
bool ProcessCommand(wpi::raw_ostream& os, SourceImpl& source,
wpi::StringRef parameters, bool respond);

View File

@@ -68,7 +68,7 @@ class Notifier::Thread : public wpi::SafeThread {
Thread(std::function<void()> on_start, std::function<void()> on_exit)
: m_on_start(on_start), m_on_exit(on_exit) {}
void Main();
void Main() override;
struct Listener {
Listener() = default;

View File

@@ -29,7 +29,7 @@ class SinkImpl : public PropertyContainer {
public:
explicit SinkImpl(const wpi::Twine& name, wpi::Logger& logger,
Notifier& notifier, Telemetry& telemetry);
virtual ~SinkImpl();
~SinkImpl() override;
SinkImpl(const SinkImpl& queue) = delete;
SinkImpl& operator=(const SinkImpl& queue) = delete;

View File

@@ -39,7 +39,7 @@ class SourceImpl : public PropertyContainer {
public:
SourceImpl(const wpi::Twine& name, wpi::Logger& logger, Notifier& notifier,
Telemetry& telemetry);
virtual ~SourceImpl();
~SourceImpl() override;
SourceImpl(const SourceImpl& oth) = delete;
SourceImpl& operator=(const SourceImpl& oth) = delete;

View File

@@ -22,7 +22,7 @@ class Telemetry::Thread : public wpi::SafeThread {
public:
explicit Thread(Notifier& notifier) : m_notifier(notifier) {}
void Main();
void Main() override;
Notifier& m_notifier;
wpi::DenseMap<std::pair<CS_Handle, int>, int64_t> m_user;

View File

@@ -34,7 +34,7 @@ class NetworkListener::Impl {
public:
Thread(wpi::Logger& logger, Notifier& notifier)
: m_logger(logger), m_notifier(notifier) {}
void Main();
void Main() override;
wpi::Logger& m_logger;
Notifier& m_notifier;

View File

@@ -24,7 +24,7 @@ namespace {
// Safe thread to allow callbacks to run on their own thread
class InterruptThread : public wpi::SafeThread {
public:
void Main() {
void Main() override {
std::unique_lock lock(m_mutex);
while (m_active) {
m_cond.wait(lock, [&] { return !m_active || m_notify; });

View File

@@ -31,7 +31,7 @@ using namespace hal;
// process, we will just ignore the redundant wakeup.
class InterruptThreadJNI : public wpi::SafeThread {
public:
void Main();
void Main() override;
bool m_notify = false;
uint32_t m_mask = 0;

View File

@@ -49,7 +49,7 @@ class IndexedClassedHandleResource : public HandleBase {
}
std::shared_ptr<TStruct> Get(THandle handle);
void Free(THandle handle);
void ResetHandles();
void ResetHandles() override;
private:
std::array<std::shared_ptr<TStruct>, size> m_structures;

View File

@@ -54,7 +54,7 @@ class CallbackThread : public wpi::SafeThread {
using NotifierData = TNotifierData;
using ListenerData = TListenerData;
~CallbackThread() {
~CallbackThread() override {
// Wake up any blocked pollers
for (size_t i = 0; i < m_pollers.size(); ++i) {
if (auto poller = m_pollers[i]) {

View File

@@ -41,7 +41,7 @@ class DispatcherBase : public IDispatcher {
DispatcherBase(IStorage& storage, IConnectionNotifier& notifier,
wpi::Logger& logger);
virtual ~DispatcherBase();
~DispatcherBase() override;
unsigned int GetNetworkMode() const;
void StartLocal();

View File

@@ -19,7 +19,7 @@ class DsClient::Thread : public wpi::SafeThread {
Thread(Dispatcher& dispatcher, wpi::Logger& logger, unsigned int port)
: m_dispatcher(dispatcher), m_logger(logger), m_port(port) {}
void Main();
void Main() override;
Dispatcher& m_dispatcher;
wpi::Logger& m_logger;

View File

@@ -49,7 +49,7 @@ class NetworkConnection : public INetworkConnection {
IConnectionNotifier& notifier, wpi::Logger& logger,
HandshakeFunc handshake,
Message::GetEntryTypeFunc get_entry_type);
~NetworkConnection();
~NetworkConnection() override;
// Set the input processor function. This must be called before Start().
void set_process_incoming(ProcessIncomingFunc func) {

View File

@@ -47,7 +47,7 @@ class Storage : public IStorage {
Storage(const Storage&) = delete;
Storage& operator=(const Storage&) = delete;
~Storage();
~Storage() override;
// Accessors required by Dispatcher. An interface is used for
// generation of outgoing messages to break a dependency loop between

View File

@@ -56,7 +56,7 @@ class EncoderSimModel : public glass::EncoderModel {
: EncoderSimModel(index, HALSIM_GetEncoderDigitalChannelA(index),
HALSIM_GetEncoderDigitalChannelB(index)) {}
~EncoderSimModel() {
~EncoderSimModel() override {
if (m_distancePerPulseCallback != 0) {
HALSIM_CancelEncoderDistancePerPulseCallback(m_index,
m_distancePerPulseCallback);

View File

@@ -24,7 +24,7 @@ class SimValueSource : public glass::DataSource {
: DataSource(wpi::Twine{device} + wpi::Twine{'-'} + name),
m_callback{HALSIM_RegisterSimValueChangedCallback(
handle, this, CallbackFunc, true)} {}
~SimValueSource() {
~SimValueSource() override {
if (m_callback != 0) {
HALSIM_CancelSimValueChangedCallback(m_callback);
}

View File

@@ -27,8 +27,9 @@ class HALSimWSHalProvider : public HALSimWSBaseProvider {
public:
using HALSimWSBaseProvider::HALSimWSBaseProvider;
void OnNetworkConnected(std::shared_ptr<HALSimBaseWebSocketConnection> ws);
void OnNetworkDisconnected();
void OnNetworkConnected(
std::shared_ptr<HALSimBaseWebSocketConnection> ws) override;
void OnNetworkDisconnected() override;
void ProcessHalCallback(const wpi::json& payload);

View File

@@ -15,7 +15,7 @@ class HALSimWSProviderAnalogIn : public HALSimWSHalChanProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
~HALSimWSProviderAnalogIn();
~HALSimWSProviderAnalogIn() override;
void OnNetValueChanged(const wpi::json& json) override;
@@ -41,7 +41,7 @@ class HALSimWSProviderAnalogOut : public HALSimWSHalChanProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
~HALSimWSProviderAnalogOut();
~HALSimWSProviderAnalogOut() override;
protected:
void RegisterCallbacks() override;

View File

@@ -13,7 +13,7 @@ class HALSimWSProviderBuiltInAccelerometer : public HALSimWSHalProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalProvider::HALSimWSHalProvider;
~HALSimWSProviderBuiltInAccelerometer();
~HALSimWSProviderBuiltInAccelerometer() override;
void OnNetValueChanged(const wpi::json& json) override;

View File

@@ -15,7 +15,7 @@ class HALSimWSProviderDIO : public HALSimWSHalChanProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
~HALSimWSProviderDIO();
~HALSimWSProviderDIO() override;
void OnNetValueChanged(const wpi::json& json) override;

View File

@@ -15,7 +15,7 @@ class HALSimWSProviderDriverStation : public HALSimWSHalProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalProvider::HALSimWSHalProvider;
~HALSimWSProviderDriverStation();
~HALSimWSProviderDriverStation() override;
void OnNetValueChanged(const wpi::json& json) override;

View File

@@ -15,7 +15,7 @@ class HALSimWSProviderEncoder : public HALSimWSHalChanProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
~HALSimWSProviderEncoder();
~HALSimWSProviderEncoder() override;
void OnNetValueChanged(const wpi::json& json) override;

View File

@@ -15,7 +15,7 @@ class HALSimWSProviderJoystick : public HALSimWSHalChanProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
~HALSimWSProviderJoystick();
~HALSimWSProviderJoystick() override;
void OnNetValueChanged(const wpi::json& json) override;

View File

@@ -15,7 +15,7 @@ class HALSimWSProviderPWM : public HALSimWSHalChanProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
~HALSimWSProviderPWM();
~HALSimWSProviderPWM() override;
protected:
void RegisterCallbacks() override;

View File

@@ -15,7 +15,7 @@ class HALSimWSProviderRelay : public HALSimWSHalChanProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
~HALSimWSProviderRelay();
~HALSimWSProviderRelay() override;
protected:
void RegisterCallbacks() override;

View File

@@ -15,7 +15,7 @@ class HALSimWSProviderRoboRIO : public HALSimWSHalProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalProvider::HALSimWSHalProvider;
~HALSimWSProviderRoboRIO();
~HALSimWSProviderRoboRIO() override;
void OnNetValueChanged(const wpi::json& json) override;

View File

@@ -39,7 +39,7 @@ class HALSimWSProviderSimDevice : public HALSimWSBaseProvider {
m_deviceId = deviceId;
}
~HALSimWSProviderSimDevice();
~HALSimWSProviderSimDevice() override;
void OnNetworkConnected(
std::shared_ptr<HALSimBaseWebSocketConnection> ws) override;

View File

@@ -15,7 +15,7 @@ class HALSimWSProviderDigitalPWM : public HALSimWSHalChanProvider {
static void Initialize(WSRegisterFunc webRegisterFunc);
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
~HALSimWSProviderDigitalPWM();
~HALSimWSProviderDigitalPWM() override;
protected:
void RegisterCallbacks() override;

View File

@@ -49,7 +49,7 @@ class ProxyScheduleCommand;
class Command : public frc::ErrorBase {
public:
Command() = default;
virtual ~Command();
~Command() override;
Command(const Command&);
Command& operator=(const Command&);

View File

@@ -39,7 +39,7 @@ class CommandScheduler final : public frc::Sendable,
*/
static CommandScheduler& GetInstance();
~CommandScheduler();
~CommandScheduler() override;
CommandScheduler(const CommandScheduler&) = delete;
CommandScheduler& operator=(const CommandScheduler&) = delete;

View File

@@ -45,7 +45,7 @@ class RunCommand : public CommandHelper<CommandBase, RunCommand> {
RunCommand(const RunCommand& other) = default;
void Execute();
void Execute() override;
protected:
std::function<void()> m_toRun;

View File

@@ -72,13 +72,13 @@ class CommandTestBase : public ::testing::Test {
.WillRepeatedly(::testing::Return(finished));
}
~MockCommand() {
~MockCommand() { // NOLINT
auto& scheduler = CommandScheduler::GetInstance();
scheduler.Cancel(this);
}
protected:
std::unique_ptr<Command> TransferOwnership() && {
std::unique_ptr<Command> TransferOwnership() && { // NOLINT
return std::make_unique<MockCommand>(std::move(*this));
}

View File

@@ -14,12 +14,12 @@ class Command;
class CancelButtonScheduler : public ButtonScheduler {
public:
CancelButtonScheduler(bool last, Trigger* button, Command* orders);
virtual ~CancelButtonScheduler() = default;
~CancelButtonScheduler() override = default;
CancelButtonScheduler(CancelButtonScheduler&&) = default;
CancelButtonScheduler& operator=(CancelButtonScheduler&&) = default;
virtual void Execute();
void Execute() override;
};
} // namespace frc

View File

@@ -14,12 +14,12 @@ class Command;
class HeldButtonScheduler : public ButtonScheduler {
public:
HeldButtonScheduler(bool last, Trigger* button, Command* orders);
virtual ~HeldButtonScheduler() = default;
~HeldButtonScheduler() override = default;
HeldButtonScheduler(HeldButtonScheduler&&) = default;
HeldButtonScheduler& operator=(HeldButtonScheduler&&) = default;
virtual void Execute();
void Execute() override;
};
} // namespace frc

View File

@@ -12,7 +12,7 @@ class InternalButton : public Button {
public:
InternalButton() = default;
explicit InternalButton(bool inverted);
virtual ~InternalButton() = default;
~InternalButton() override = default;
InternalButton(InternalButton&&) = default;
InternalButton& operator=(InternalButton&&) = default;
@@ -20,7 +20,7 @@ class InternalButton : public Button {
void SetInverted(bool inverted);
void SetPressed(bool pressed);
virtual bool Get();
bool Get() override;
private:
bool m_pressed = false;

View File

@@ -12,12 +12,12 @@ namespace frc {
class JoystickButton : public Button {
public:
JoystickButton(GenericHID* joystick, int buttonNumber);
virtual ~JoystickButton() = default;
~JoystickButton() override = default;
JoystickButton(JoystickButton&&) = default;
JoystickButton& operator=(JoystickButton&&) = default;
virtual bool Get();
bool Get() override;
private:
GenericHID* m_joystick;

View File

@@ -19,12 +19,12 @@ class NetworkButton : public Button {
NetworkButton(const wpi::Twine& tableName, const wpi::Twine& field);
NetworkButton(std::shared_ptr<nt::NetworkTable> table,
const wpi::Twine& field);
virtual ~NetworkButton() = default;
~NetworkButton() override = default;
NetworkButton(NetworkButton&&) = default;
NetworkButton& operator=(NetworkButton&&) = default;
virtual bool Get();
bool Get() override;
private:
nt::NetworkTableEntry m_entry;

View File

@@ -18,7 +18,7 @@ class POVButton : public Button {
* @param povNumber The POV number (@see GenericHID#GetPOV)
*/
POVButton(GenericHID& joystick, int angle, int povNumber = 0);
virtual ~POVButton() = default;
~POVButton() override = default;
POVButton(POVButton&&) = default;
POVButton& operator=(POVButton&&) = default;

View File

@@ -14,12 +14,12 @@ class Command;
class PressedButtonScheduler : public ButtonScheduler {
public:
PressedButtonScheduler(bool last, Trigger* button, Command* orders);
virtual ~PressedButtonScheduler() = default;
~PressedButtonScheduler() override = default;
PressedButtonScheduler(PressedButtonScheduler&&) = default;
PressedButtonScheduler& operator=(PressedButtonScheduler&&) = default;
virtual void Execute();
void Execute() override;
};
} // namespace frc

View File

@@ -14,12 +14,12 @@ class Command;
class ReleasedButtonScheduler : public ButtonScheduler {
public:
ReleasedButtonScheduler(bool last, Trigger* button, Command* orders);
virtual ~ReleasedButtonScheduler() = default;
~ReleasedButtonScheduler() override = default;
ReleasedButtonScheduler(ReleasedButtonScheduler&&) = default;
ReleasedButtonScheduler& operator=(ReleasedButtonScheduler&&) = default;
virtual void Execute();
void Execute() override;
};
} // namespace frc

View File

@@ -14,12 +14,12 @@ class Command;
class ToggleButtonScheduler : public ButtonScheduler {
public:
ToggleButtonScheduler(bool last, Trigger* button, Command* orders);
virtual ~ToggleButtonScheduler() = default;
~ToggleButtonScheduler() override = default;
ToggleButtonScheduler(ToggleButtonScheduler&&) = default;
ToggleButtonScheduler& operator=(ToggleButtonScheduler&&) = default;
virtual void Execute();
void Execute() override;
};
} // namespace frc

View File

@@ -41,7 +41,7 @@ class CommandGroup : public Command {
*/
explicit CommandGroup(const wpi::Twine& name);
virtual ~CommandGroup() = default;
~CommandGroup() override = default;
CommandGroup(CommandGroup&&) = default;
CommandGroup& operator=(CommandGroup&&) = default;
@@ -134,32 +134,32 @@ class CommandGroup : public Command {
/**
* Can be overridden by teams.
*/
virtual void Initialize();
void Initialize() override;
/**
* Can be overridden by teams.
*/
virtual void Execute();
void Execute() override;
/**
* Can be overridden by teams.
*/
virtual bool IsFinished();
bool IsFinished() override;
/**
* Can be overridden by teams.
*/
virtual void End();
void End() override;
/**
* Can be overridden by teams.
*/
virtual void Interrupted();
void Interrupted() override;
virtual void _Initialize();
virtual void _Execute();
virtual void _End();
virtual void _Interrupted();
void _Initialize() override;
void _Execute() override;
void _End() override;
void _Interrupted() override;
private:
void CancelConflicts(Command* command);

View File

@@ -49,7 +49,7 @@ class ConditionalCommand : public Command {
ConditionalCommand(const wpi::Twine& name, Command* onTrue,
Command* onFalse = nullptr);
virtual ~ConditionalCommand() = default;
~ConditionalCommand() override = default;
ConditionalCommand(ConditionalCommand&&) = default;
ConditionalCommand& operator=(ConditionalCommand&&) = default;

View File

@@ -76,7 +76,7 @@ class InstantCommand : public Command {
std::function<void()> func);
InstantCommand() = default;
virtual ~InstantCommand() = default;
~InstantCommand() override = default;
InstantCommand(InstantCommand&&) = default;
InstantCommand& operator=(InstantCommand&&) = default;

View File

@@ -35,7 +35,7 @@ class PIDCommand : public Command, public PIDOutput, public PIDSource {
PIDCommand(double p, double i, double d, double period, Subsystem& subsystem);
PIDCommand(double p, double i, double d, double f, double period,
Subsystem& subsystem);
virtual ~PIDCommand() = default;
~PIDCommand() override = default;
PIDCommand(PIDCommand&&) = default;
PIDCommand& operator=(PIDCommand&&) = default;

View File

@@ -15,13 +15,13 @@ namespace frc {
class PrintCommand : public InstantCommand {
public:
explicit PrintCommand(const wpi::Twine& message);
virtual ~PrintCommand() = default;
~PrintCommand() override = default;
PrintCommand(PrintCommand&&) = default;
PrintCommand& operator=(PrintCommand&&) = default;
protected:
virtual void Initialize();
void Initialize() override;
private:
std::string m_message;

View File

@@ -11,13 +11,13 @@ namespace frc {
class StartCommand : public InstantCommand {
public:
explicit StartCommand(Command* commandToStart);
virtual ~StartCommand() = default;
~StartCommand() override = default;
StartCommand(StartCommand&&) = default;
StartCommand& operator=(StartCommand&&) = default;
protected:
virtual void Initialize();
void Initialize() override;
private:
Command* m_commandToFork;

View File

@@ -49,7 +49,7 @@ class TimedCommand : public Command {
*/
TimedCommand(double timeout, Subsystem& subsystem);
virtual ~TimedCommand() = default;
~TimedCommand() override = default;
TimedCommand(TimedCommand&&) = default;
TimedCommand& operator=(TimedCommand&&) = default;

View File

@@ -27,7 +27,7 @@ class WaitCommand : public TimedCommand {
*/
WaitCommand(const wpi::Twine& name, double timeout);
virtual ~WaitCommand() = default;
~WaitCommand() override = default;
WaitCommand(WaitCommand&&) = default;
WaitCommand& operator=(WaitCommand&&) = default;

View File

@@ -14,13 +14,13 @@ class WaitForChildren : public Command {
public:
explicit WaitForChildren(double timeout);
WaitForChildren(const wpi::Twine& name, double timeout);
virtual ~WaitForChildren() = default;
~WaitForChildren() override = default;
WaitForChildren(WaitForChildren&&) = default;
WaitForChildren& operator=(WaitForChildren&&) = default;
protected:
virtual bool IsFinished();
bool IsFinished() override;
};
} // namespace frc

View File

@@ -24,7 +24,7 @@ class WaitUntilCommand : public Command {
WaitUntilCommand(const wpi::Twine& name, double time);
virtual ~WaitUntilCommand() = default;
~WaitUntilCommand() override = default;
WaitUntilCommand(WaitUntilCommand&&) = default;
WaitUntilCommand& operator=(WaitUntilCommand&&) = default;
@@ -33,7 +33,7 @@ class WaitUntilCommand : public Command {
/**
* Check if we've reached the actual finish time.
*/
virtual bool IsFinished();
bool IsFinished() override;
private:
double m_time;

View File

@@ -25,8 +25,8 @@ class DigitalSource : public InterruptableSensorBase {
DigitalSource(DigitalSource&&) = default;
DigitalSource& operator=(DigitalSource&&) = default;
virtual HAL_Handle GetPortHandleForRouting() const = 0;
virtual AnalogTriggerType GetAnalogTriggerTypeForRouting() const = 0;
HAL_Handle GetPortHandleForRouting() const override = 0;
AnalogTriggerType GetAnalogTriggerTypeForRouting() const override = 0;
virtual bool IsAnalogTrigger() const = 0;
virtual int GetChannel() const = 0;
};

View File

@@ -44,7 +44,7 @@ class GenericHID : public ErrorBase {
enum JoystickHand { kLeftHand = 0, kRightHand = 1 };
explicit GenericHID(int port);
virtual ~GenericHID() = default;
~GenericHID() override = default;
GenericHID(GenericHID&&) = default;
GenericHID& operator=(GenericHID&&) = default;

View File

@@ -35,7 +35,7 @@ class InterruptableSensorBase : public ErrorBase {
/**
* Free the resources for an interrupt event.
*/
virtual ~InterruptableSensorBase();
~InterruptableSensorBase() override;
InterruptableSensorBase(InterruptableSensorBase&&) = default;
InterruptableSensorBase& operator=(InterruptableSensorBase&&) = default;

View File

@@ -28,7 +28,7 @@ class IterativeRobot : public IterativeRobotBase {
"Use TimedRobot instead. It's a drop-in replacement that provides more "
"regular execution periods.")
IterativeRobot();
virtual ~IterativeRobot() = default;
~IterativeRobot() override = default;
/**
* Provide an alternate "main loop" via StartCompetition().

View File

@@ -178,7 +178,7 @@ class IterativeRobotBase : public RobotBase {
*/
explicit IterativeRobotBase(units::second_t period);
virtual ~IterativeRobotBase() = default;
~IterativeRobotBase() override = default;
protected:
IterativeRobotBase(IterativeRobotBase&&) = default;

View File

@@ -39,7 +39,7 @@ class Joystick : public GenericHID {
*/
explicit Joystick(int port);
virtual ~Joystick() = default;
~Joystick() override = default;
Joystick(Joystick&&) = default;
Joystick& operator=(Joystick&&) = default;

View File

@@ -21,7 +21,7 @@ namespace frc {
class MotorSafety : public ErrorBase {
public:
MotorSafety();
virtual ~MotorSafety();
~MotorSafety() override;
MotorSafety(MotorSafety&& rhs);
MotorSafety& operator=(MotorSafety&& rhs);

View File

@@ -62,7 +62,7 @@ class Notifier : public ErrorBase {
/**
* Free the resources for a timer event.
*/
virtual ~Notifier();
~Notifier() override;
Notifier(Notifier&& rhs);
Notifier& operator=(Notifier&& rhs);

View File

@@ -65,7 +65,7 @@ class PIDBase : public PIDInterface,
PIDBase(double p, double i, double d, double f, PIDSource& source,
PIDOutput& output);
virtual ~PIDBase() = default;
~PIDBase() override = default;
/**
* Return the current PID result.

View File

@@ -226,7 +226,7 @@ class Preferences : public ErrorBase {
protected:
Preferences();
virtual ~Preferences() = default;
~Preferences() override = default;
Preferences(Preferences&&) = default;
Preferences& operator=(Preferences&&) = default;

View File

@@ -28,7 +28,7 @@ namespace frc {
*/
class Resource : public ErrorBase {
public:
virtual ~Resource() = default;
~Resource() override = default;
/**
* Factory method to create a Resource allocation-tracker *if* needed.

View File

@@ -126,7 +126,7 @@ class RobotDrive : public MotorSafety {
std::shared_ptr<SpeedController> frontRightMotor,
std::shared_ptr<SpeedController> rearRightMotor);
virtual ~RobotDrive() = default;
~RobotDrive() override = default;
RobotDrive(RobotDrive&&) = default;
RobotDrive& operator=(RobotDrive&&) = default;

View File

@@ -87,7 +87,7 @@ class SerialPort : public ErrorBase {
int dataBits = 8, Parity parity = kParity_None,
StopBits stopBits = kStopBits_One);
~SerialPort();
~SerialPort() override;
SerialPort(SerialPort&& rhs) = default;
SerialPort& operator=(SerialPort&& rhs) = default;

View File

@@ -29,7 +29,7 @@ class XboxController : public GenericHID {
*/
explicit XboxController(int port);
virtual ~XboxController() = default;
~XboxController() override = default;
XboxController(XboxController&&) = default;
XboxController& operator=(XboxController&&) = default;

View File

@@ -23,7 +23,7 @@ class Filter : public PIDSource {
explicit Filter(PIDSource& source);
WPI_DEPRECATED("This class is no longer used.")
explicit Filter(std::shared_ptr<PIDSource> source);
virtual ~Filter() = default;
~Filter() override = default;
Filter(Filter&&) = default;
Filter& operator=(Filter&&) = default;

View File

@@ -14,7 +14,7 @@ namespace frc {
class Potentiometer : public PIDSource {
public:
Potentiometer() = default;
virtual ~Potentiometer() = default;
~Potentiometer() override = default;
Potentiometer(Potentiometer&&) = default;
Potentiometer& operator=(Potentiometer&&) = default;

View File

@@ -29,7 +29,7 @@ class ShuffleboardComponent : public ShuffleboardComponentBase {
ShuffleboardComponent(ShuffleboardContainer& parent, const wpi::Twine& title,
const wpi::Twine& type = "");
virtual ~ShuffleboardComponent() = default;
~ShuffleboardComponent() override = default;
/**
* Sets custom properties for this component. Property names are

View File

@@ -27,7 +27,7 @@ class ShuffleboardComponentBase : public virtual ShuffleboardValue {
const wpi::Twine& title,
const wpi::Twine& type = "");
virtual ~ShuffleboardComponentBase() = default;
~ShuffleboardComponentBase() override = default;
void SetType(const wpi::Twine& type);

View File

@@ -45,7 +45,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue,
ShuffleboardContainer(ShuffleboardContainer&& rhs) = default;
virtual ~ShuffleboardContainer() = default;
~ShuffleboardContainer() override = default;
/**
* Gets the components that are direct children of this container.

View File

@@ -432,7 +432,7 @@ class SmartDashboard : public ErrorBase,
static void UpdateValues();
private:
virtual ~SmartDashboard() = default;
~SmartDashboard() override = default;
static detail::ListenerExecutor listenerExecutor;
};

View File

@@ -13,7 +13,7 @@ class ReplaceMeSubsystem2 : public frc2::SubsystemBase {
/**
* Will be called periodically whenever the CommandScheduler runs.
*/
void Periodic();
void Periodic() override;
private:
// Components (e.g. motor controllers and sensors) should generally be

View File

@@ -18,7 +18,7 @@ class Robot : public frc::TimedRobot {
frc::Joystick m_stick{0};
public:
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Drive with arcade style
m_robotDrive.ArcadeDrive(m_stick.GetY(), m_stick.GetX());
}

View File

@@ -19,7 +19,7 @@ class Robot : public frc::TimedRobot {
frc::XboxController m_driverController{0};
public:
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Drive with split arcade style
// That means that the Y axis of the left stick moves forward
// and backward, and the X of the right stick turns left and right.

View File

@@ -63,9 +63,11 @@ class Robot : public frc::TimedRobot {
frc::sim::EncoderSim m_encoderSim{m_encoder};
public:
void RobotInit() { m_encoder.SetDistancePerPulse(kArmEncoderDistPerPulse); }
void RobotInit() override {
m_encoder.SetDistancePerPulse(kArmEncoderDistPerPulse);
}
void SimulationPeriodic() {
void SimulationPeriodic() override {
// In this method, we update our simulation of what our arm is doing
// First, we set our "inputs" (voltages)
m_armSim.SetInput(frc::MakeMatrix<1, 1>(
@@ -82,7 +84,7 @@ class Robot : public frc::TimedRobot {
frc::sim::BatterySim::Calculate({m_armSim.GetCurrentDraw()}));
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
if (m_joystick.GetTrigger()) {
// Here, we run PID control like normal, with a constant setpoint of 30in.
double pidOutput =
@@ -94,7 +96,7 @@ class Robot : public frc::TimedRobot {
}
}
void DisabledInit() {
void DisabledInit() override {
// This just makes sure that our simulation code knows that the motor's off.
m_motor.Set(0.0);
}

View File

@@ -62,9 +62,11 @@ class Robot : public frc::TimedRobot {
frc::sim::EncoderSim m_encoderSim{m_encoder};
public:
void RobotInit() { m_encoder.SetDistancePerPulse(kArmEncoderDistPerPulse); }
void RobotInit() override {
m_encoder.SetDistancePerPulse(kArmEncoderDistPerPulse);
}
void SimulationPeriodic() {
void SimulationPeriodic() override {
// In this method, we update our simulation of what our elevator is doing
// First, we set our "inputs" (voltages)
m_elevatorSim.SetInput(frc::MakeMatrix<1, 1>(
@@ -81,7 +83,7 @@ class Robot : public frc::TimedRobot {
frc::sim::BatterySim::Calculate({m_elevatorSim.GetCurrentDraw()}));
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
if (m_joystick.GetTrigger()) {
// Here, we run PID control like normal, with a constant setpoint of 30in.
double pidOutput =
@@ -93,7 +95,7 @@ class Robot : public frc::TimedRobot {
}
}
void DisabledInit() {
void DisabledInit() override {
// This just makes sure that our simulation code knows that the motor's off.
m_motor.Set(0.0);
}

View File

@@ -28,7 +28,7 @@ class DriveTrain : public frc::Subsystem {
* with
* the joystick.
*/
void InitDefaultCommand();
void InitDefaultCommand() override;
/**
* @param leftAxis Left sides value

View File

@@ -14,7 +14,7 @@ class DoubleButton : public frc::Trigger {
public:
DoubleButton(frc::Joystick* joy, int button1, int button2);
bool Get();
bool Get() override;
private:
frc::Joystick& m_joy;

View File

@@ -93,12 +93,12 @@ class Robot : public frc::TimedRobot {
frc::TrapezoidProfile<units::radians>::State m_lastProfiledReference;
public:
void RobotInit() {
void RobotInit() override {
// We go 2 pi radians per 4096 clicks.
m_encoder.SetDistancePerPulse(2.0 * wpi::math::pi / 4096.0);
}
void TeleopInit() {
void TeleopInit() override {
m_loop.Reset(
frc::MakeMatrix<2, 1>(m_encoder.GetDistance(), m_encoder.GetRate()));
@@ -107,7 +107,7 @@ class Robot : public frc::TimedRobot {
units::radians_per_second_t(m_encoder.GetRate())};
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Sets the target position of our arm. This is similar to setting the
// setpoint of a PID controller.
frc::TrapezoidProfile<units::radians>::State goal;

View File

@@ -90,13 +90,13 @@ class Robot : public frc::TimedRobot {
frc::TrapezoidProfile<units::meters>::State m_lastProfiledReference;
public:
void RobotInit() {
void RobotInit() override {
// Circumference = pi * d, so distance per click = pi * d / counts
m_encoder.SetDistancePerPulse(2.0 * wpi::math::pi *
kDrumRadius.to<double>() / 4096.0);
}
void TeleopInit() {
void TeleopInit() override {
// Reset our loop to make sure it's in a known state.
m_loop.Reset(
frc::MakeMatrix<2, 1>(m_encoder.GetDistance(), m_encoder.GetRate()));
@@ -105,7 +105,7 @@ class Robot : public frc::TimedRobot {
units::meters_per_second_t(m_encoder.GetRate())};
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Sets the target height of our elevator. This is similar to setting the
// setpoint of a PID controller.
frc::TrapezoidProfile<units::meters>::State goal;

View File

@@ -81,16 +81,16 @@ class Robot : public frc::TimedRobot {
frc::XboxController m_joystick{kJoystickPort};
public:
void RobotInit() {
void RobotInit() override {
// We go 2 pi radians per 4096 clicks.
m_encoder.SetDistancePerPulse(2.0 * wpi::math::pi / 4096.0);
}
void TeleopInit() {
void TeleopInit() override {
m_loop.Reset(frc::MakeMatrix<1, 1>(m_encoder.GetRate()));
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Sets the target speed of our flywheel. This is similar to setting the
// setpoint of a PID controller.
if (m_joystick.GetBumper(frc::GenericHID::kRightHand)) {

View File

@@ -82,16 +82,16 @@ class Robot : public frc::TimedRobot {
frc::XboxController m_joystick{kJoystickPort};
public:
void RobotInit() {
void RobotInit() override {
// We go 2 pi radians per 4096 clicks.
m_encoder.SetDistancePerPulse(2.0 * wpi::math::pi / 4096.0);
}
void TeleopInit() {
void TeleopInit() override {
m_loop.Reset(frc::MakeMatrix<1, 1>(m_encoder.GetRate()));
}
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Sets the target speed of our flywheel. This is similar to setting the
// setpoint of a PID controller.
if (m_joystick.GetBumper(frc::GenericHID::kRightHand)) {

View File

@@ -19,7 +19,7 @@ class Robot : public frc::TimedRobot {
frc::XboxController m_driverController{0};
public:
void TeleopPeriodic() {
void TeleopPeriodic() override {
// Drive with tank style
m_robotDrive.TankDrive(
m_driverController.GetY(frc::GenericHID::JoystickHand::kLeftHand),

View File

@@ -94,65 +94,65 @@ namespace {
class TypeTraits : public ::testing::Test {
protected:
TypeTraits() {}
virtual ~TypeTraits() {}
virtual void SetUp() {}
virtual void TearDown() {}
~TypeTraits() override {}
void SetUp() override {}
void TearDown() override {}
};
class UnitManipulators : public ::testing::Test {
protected:
UnitManipulators() {}
virtual ~UnitManipulators() {}
virtual void SetUp() {}
virtual void TearDown() {}
~UnitManipulators() override {}
void SetUp() override {}
void TearDown() override {}
};
class UnitContainer : public ::testing::Test {
protected:
UnitContainer() {}
virtual ~UnitContainer() {}
virtual void SetUp() {}
virtual void TearDown() {}
~UnitContainer() override {}
void SetUp() override {}
void TearDown() override {}
};
class UnitConversion : public ::testing::Test {
protected:
UnitConversion() {}
virtual ~UnitConversion() {}
virtual void SetUp() {}
virtual void TearDown() {}
~UnitConversion() override {}
void SetUp() override {}
void TearDown() override {}
};
class UnitMath : public ::testing::Test {
protected:
UnitMath() {}
virtual ~UnitMath() {}
virtual void SetUp() {}
virtual void TearDown() {}
~UnitMath() override {}
void SetUp() override {}
void TearDown() override {}
};
class CompileTimeArithmetic : public ::testing::Test {
protected:
CompileTimeArithmetic() {}
virtual ~CompileTimeArithmetic() {}
virtual void SetUp() {}
virtual void TearDown() {}
~CompileTimeArithmetic() override {}
void SetUp() override {}
void TearDown() override {}
};
class Constexpr : public ::testing::Test {
protected:
Constexpr() {}
virtual ~Constexpr() {}
virtual void SetUp() {}
virtual void TearDown() {}
~Constexpr() override {}
void SetUp() override {}
void TearDown() override {}
};
class CaseStudies : public ::testing::Test {
protected:
CaseStudies() {}
virtual ~CaseStudies() {}
virtual void SetUp() {}
virtual void TearDown() {}
~CaseStudies() override {}
void SetUp() override {}
void TearDown() override {}
struct RightTriangle {
using a = unit_value_t<meters, 3>;

View File

@@ -30,7 +30,7 @@ class EventLoopRunner::Thread : public SafeThread {
});
}
void Main() {
void Main() override {
if (m_loop) {
m_loop->Run();
}

View File

@@ -45,7 +45,7 @@ class TCPAcceptor : public NetworkAcceptor {
public:
TCPAcceptor(int port, const char* address, Logger& logger);
~TCPAcceptor();
~TCPAcceptor() override;
int start() override;
void shutdown() override;

View File

@@ -43,7 +43,7 @@ class TCPStream : public NetworkStream {
friend class TCPAcceptor;
friend class TCPConnector;
~TCPStream();
~TCPStream() override;
size_t send(const char* buffer, size_t len, Error* err) override;
size_t receive(char* buffer, size_t len, Error* err,

View File

@@ -15,7 +15,7 @@ class raw_socket_ostream : public raw_ostream {
public:
raw_socket_ostream(NetworkStream& stream, bool shouldClose)
: m_stream(stream), m_shouldClose(shouldClose) {}
~raw_socket_ostream();
~raw_socket_ostream() override;
void close();

View File

@@ -48,7 +48,7 @@ class WebSocketTest : public ::testing::Test {
failTimer->Unreference();
}
~WebSocketTest() { Finish(); }
~WebSocketTest() override { Finish(); }
void Finish() {
loop->Walk([](uv::Handle& it) { it.Close(); });