clang-tidy: modernize-pass-by-value

This commit is contained in:
Peter Johnson
2020-12-28 10:12:52 -08:00
parent 29c7da5f1a
commit aee4603269
32 changed files with 158 additions and 107 deletions

View File

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

View File

@@ -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),