mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
clang-tidy: modernize-pass-by-value
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "frc/AnalogPotentiometer.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "frc/Base.h"
|
||||
#include "frc/RobotController.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
@@ -26,7 +28,9 @@ AnalogPotentiometer::AnalogPotentiometer(AnalogInput* input, double fullRange,
|
||||
|
||||
AnalogPotentiometer::AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
|
||||
double fullRange, double offset)
|
||||
: m_analog_input(input), m_fullRange(fullRange), m_offset(offset) {
|
||||
: m_analog_input(std::move(input)),
|
||||
m_fullRange(fullRange),
|
||||
m_offset(offset) {
|
||||
SendableRegistry::GetInstance().AddLW(this, "AnalogPotentiometer",
|
||||
m_analog_input->GetChannel());
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ Encoder::Encoder(DigitalSource& aSource, DigitalSource& bSource,
|
||||
Encoder::Encoder(std::shared_ptr<DigitalSource> aSource,
|
||||
std::shared_ptr<DigitalSource> bSource, bool reverseDirection,
|
||||
EncodingType encodingType)
|
||||
: m_aSource(aSource), m_bSource(bSource) {
|
||||
: m_aSource(std::move(aSource)), m_bSource(std::move(bSource)) {
|
||||
if (m_aSource == nullptr || m_bSource == nullptr) {
|
||||
wpi_setWPIError(NullParameter);
|
||||
} else {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "frc/Ultrasonic.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
|
||||
#include "frc/Base.h"
|
||||
@@ -61,8 +63,8 @@ Ultrasonic::Ultrasonic(DigitalOutput& pingChannel, DigitalInput& echoChannel,
|
||||
Ultrasonic::Ultrasonic(std::shared_ptr<DigitalOutput> pingChannel,
|
||||
std::shared_ptr<DigitalInput> echoChannel,
|
||||
DistanceUnit units)
|
||||
: m_pingChannel(pingChannel),
|
||||
m_echoChannel(echoChannel),
|
||||
: m_pingChannel(std::move(pingChannel)),
|
||||
m_echoChannel(std::move(echoChannel)),
|
||||
m_counter(m_echoChannel) {
|
||||
m_units = units;
|
||||
Initialize();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "frc/Watchdog.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <utility>
|
||||
|
||||
#include <hal/Notifier.h>
|
||||
#include <wpi/Format.h>
|
||||
@@ -137,7 +138,7 @@ Watchdog::Watchdog(double timeout, std::function<void()> callback)
|
||||
: Watchdog(units::second_t{timeout}, callback) {}
|
||||
|
||||
Watchdog::Watchdog(units::second_t timeout, std::function<void()> callback)
|
||||
: m_timeout(timeout), m_callback(callback), m_impl(GetImpl()) {}
|
||||
: m_timeout(timeout), m_callback(std::move(callback)), m_impl(GetImpl()) {}
|
||||
|
||||
Watchdog::~Watchdog() {
|
||||
Disable();
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
|
||||
#include "frc/controller/HolonomicDriveController.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <units/angular_velocity.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
HolonomicDriveController::HolonomicDriveController(
|
||||
const frc2::PIDController& xController,
|
||||
const frc2::PIDController& yController,
|
||||
const ProfiledPIDController<units::radian>& thetaController)
|
||||
: m_xController(xController),
|
||||
m_yController(yController),
|
||||
m_thetaController(thetaController) {}
|
||||
frc2::PIDController xController, frc2::PIDController yController,
|
||||
ProfiledPIDController<units::radian> thetaController)
|
||||
: m_xController(std::move(xController)),
|
||||
m_yController(std::move(yController)),
|
||||
m_thetaController(std::move(thetaController)) {}
|
||||
|
||||
bool HolonomicDriveController::AtReference() const {
|
||||
const auto& eTranslate = m_poseError.Translation();
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "frc/simulation/CallbackStore.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
using namespace frc;
|
||||
using namespace frc::sim;
|
||||
|
||||
@@ -21,31 +23,35 @@ void frc::sim::ConstBufferCallbackStoreThunk(const char* name, void* param,
|
||||
|
||||
CallbackStore::CallbackStore(int32_t i, NotifyCallback cb,
|
||||
CancelCallbackNoIndexFunc ccf)
|
||||
: index(i), callback(cb), cancelType(NoIndex) {
|
||||
: index(i), callback(std::move(cb)), cancelType(NoIndex) {
|
||||
this->ccnif = ccf;
|
||||
}
|
||||
|
||||
CallbackStore::CallbackStore(int32_t i, int32_t u, NotifyCallback cb,
|
||||
CancelCallbackFunc ccf)
|
||||
: index(i), uid(u), callback(cb), cancelType(Normal) {
|
||||
: index(i), uid(u), callback(std::move(cb)), cancelType(Normal) {
|
||||
this->ccf = ccf;
|
||||
}
|
||||
|
||||
CallbackStore::CallbackStore(int32_t i, int32_t c, int32_t u, NotifyCallback cb,
|
||||
CancelCallbackChannelFunc ccf)
|
||||
: index(i), channel(c), uid(u), callback(cb), cancelType(Channel) {
|
||||
: index(i),
|
||||
channel(c),
|
||||
uid(u),
|
||||
callback(std::move(cb)),
|
||||
cancelType(Channel) {
|
||||
this->cccf = ccf;
|
||||
}
|
||||
|
||||
CallbackStore::CallbackStore(int32_t i, ConstBufferCallback cb,
|
||||
CancelCallbackNoIndexFunc ccf)
|
||||
: index(i), constBufferCallback(cb), cancelType(NoIndex) {
|
||||
: index(i), constBufferCallback(std::move(cb)), cancelType(NoIndex) {
|
||||
this->ccnif = ccf;
|
||||
}
|
||||
|
||||
CallbackStore::CallbackStore(int32_t i, int32_t u, ConstBufferCallback cb,
|
||||
CancelCallbackFunc ccf)
|
||||
: index(i), uid(u), constBufferCallback(cb), cancelType(Normal) {
|
||||
: index(i), uid(u), constBufferCallback(std::move(cb)), cancelType(Normal) {
|
||||
this->ccf = ccf;
|
||||
}
|
||||
|
||||
@@ -55,7 +61,7 @@ CallbackStore::CallbackStore(int32_t i, int32_t c, int32_t u,
|
||||
: index(i),
|
||||
channel(c),
|
||||
uid(u),
|
||||
constBufferCallback(cb),
|
||||
constBufferCallback(std::move(cb)),
|
||||
cancelType(Channel) {
|
||||
this->cccf = ccf;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <frc/system/plant/LinearSystemId.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "frc/RobotController.h"
|
||||
#include "frc/system/RungeKutta.h"
|
||||
|
||||
@@ -13,10 +15,10 @@ using namespace frc;
|
||||
using namespace frc::sim;
|
||||
|
||||
DifferentialDrivetrainSim::DifferentialDrivetrainSim(
|
||||
const LinearSystem<2, 2, 2>& plant, units::meter_t trackWidth,
|
||||
DCMotor driveMotor, double gearRatio, units::meter_t wheelRadius,
|
||||
LinearSystem<2, 2, 2> plant, units::meter_t trackWidth, DCMotor driveMotor,
|
||||
double gearRatio, units::meter_t wheelRadius,
|
||||
const std::array<double, 7>& measurementStdDevs)
|
||||
: m_plant(plant),
|
||||
: m_plant(std::move(plant)),
|
||||
m_rb(trackWidth / 2.0),
|
||||
m_wheelRadius(wheelRadius),
|
||||
m_motor(driveMotor),
|
||||
|
||||
Reference in New Issue
Block a user