Run wpiformat on merged repo (#1021)

This commit is contained in:
Tyler Veness
2018-05-13 17:09:56 -07:00
committed by Peter Johnson
parent 0babbf317c
commit 6729a7d6b1
481 changed files with 9581 additions and 6828 deletions

View File

@@ -50,8 +50,7 @@ Command::Command(double timeout) : Command("", timeout) {}
* @param timeout the time (in seconds) before this command "times out"
* @see IsTimedOut()
*/
Command::Command(const wpi::Twine& name, double timeout)
: SendableBase(false) {
Command::Command(const wpi::Twine& name, double timeout) : SendableBase(false) {
// We use -1.0 to indicate no timeout.
if (timeout < 0.0 && timeout != -1.0)
wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0");

View File

@@ -19,8 +19,7 @@ using namespace frc;
* @param i the integral value
* @param d the derivative value
*/
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i,
double d)
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, double d)
: Subsystem(name) {
m_controller = std::make_shared<PIDController>(p, i, d, this, this);
AddChild("PIDController", m_controller);
@@ -35,8 +34,8 @@ PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i,
* @param d the derivative value
* @param f the feedforward value
*/
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i,
double d, double f)
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, double d,
double f)
: Subsystem(name) {
m_controller = std::make_shared<PIDController>(p, i, d, f, this, this);
AddChild("PIDController", m_controller);
@@ -55,8 +54,8 @@ PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i,
* @param f the feedfoward value
* @param period the time (in seconds) between calculations
*/
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i,
double d, double f, double period)
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i, double d,
double f, double period)
: Subsystem(name) {
m_controller =
std::make_shared<PIDController>(p, i, d, f, this, this, period);

View File

@@ -42,9 +42,8 @@ DoubleSolenoid::DoubleSolenoid(int moduleNumber, int forwardChannel,
m_forwardChannel(forwardChannel),
m_reverseChannel(reverseChannel) {
if (!SensorBase::CheckSolenoidModule(m_moduleNumber)) {
wpi_setWPIErrorWithContext(
ModuleIndexOutOfRange,
"Solenoid Module " + wpi::Twine(m_moduleNumber));
wpi_setWPIErrorWithContext(ModuleIndexOutOfRange,
"Solenoid Module " + wpi::Twine(m_moduleNumber));
return;
}
if (!SensorBase::CheckSolenoidChannel(m_forwardChannel)) {

View File

@@ -41,7 +41,8 @@ void RobotDriveBase::SetDeadband(double deadband) { m_deadband = deadband; }
void RobotDriveBase::SetMaxOutput(double maxOutput) { m_maxOutput = maxOutput; }
/**
* Feed the motor safety object. Resets the timer that will stop the motors if it completes.
* Feed the motor safety object. Resets the timer that will stop the motors if
* it completes.
*
* @see MotorSafetyHelper::Feed()
*/

View File

@@ -50,8 +50,8 @@ void ErrorBase::ClearError() const { m_error.Clear(); }
* @param lineNumber Line number of the error source
*/
void ErrorBase::SetErrnoError(const wpi::Twine& contextMessage,
wpi::StringRef filename,
wpi::StringRef function, int lineNumber) const {
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const {
wpi::SmallString<128> buf;
wpi::raw_svector_ostream err(buf);
int errNo = errno;
@@ -141,8 +141,8 @@ void ErrorBase::SetError(Error::Code code, const wpi::Twine& contextMessage,
void ErrorBase::SetErrorRange(Error::Code code, int32_t minRange,
int32_t maxRange, int32_t requestedValue,
const wpi::Twine& contextMessage,
wpi::StringRef filename,
wpi::StringRef function, int lineNumber) const {
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const {
// If there was an error
if (code != 0) {
// Set the current error information for this object.
@@ -197,8 +197,8 @@ bool ErrorBase::StatusIsFatal() const { return m_error.GetCode() < 0; }
void ErrorBase::SetGlobalError(Error::Code code,
const wpi::Twine& contextMessage,
wpi::StringRef filename,
wpi::StringRef function, int lineNumber) {
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) {
// If there was an error
if (code != 0) {
std::lock_guard<wpi::mutex> mutex(_globalErrorMutex);

View File

@@ -115,8 +115,7 @@ void LiveWindow::SetEnabled(bool enabled) {
* @brief Use a STL smart pointer to share ownership of component.
* @deprecated Use Sendable::SetName() instead.
*/
void LiveWindow::AddSensor(const wpi::Twine& subsystem,
const wpi::Twine& name,
void LiveWindow::AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name,
std::shared_ptr<Sendable> component) {
Add(component);
component->SetName(subsystem, name);
@@ -126,8 +125,8 @@ void LiveWindow::AddSensor(const wpi::Twine& subsystem,
* @brief Pass a reference to LiveWindow and retain ownership of the component.
* @deprecated Use Sendable::SetName() instead.
*/
void LiveWindow::AddSensor(const wpi::Twine& subsystem,
const wpi::Twine& name, Sendable& component) {
void LiveWindow::AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name,
Sendable& component) {
Add(&component);
component.SetName(subsystem, name);
}
@@ -136,8 +135,8 @@ void LiveWindow::AddSensor(const wpi::Twine& subsystem,
* @brief Use a raw pointer to the LiveWindow.
* @deprecated Use Sendable::SetName() instead.
*/
void LiveWindow::AddSensor(const wpi::Twine& subsystem,
const wpi::Twine& name, Sendable* component) {
void LiveWindow::AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name,
Sendable* component) {
Add(component);
component->SetName(subsystem, name);
}

View File

@@ -311,8 +311,7 @@ void SPI::FreeAuto() {
* @param dataToSend data to send (maximum 16 bytes)
* @param zeroSize number of zeros to send after the data
*/
void SPI::SetAutoTransmitData(wpi::ArrayRef<uint8_t> dataToSend,
int zeroSize) {
void SPI::SetAutoTransmitData(wpi::ArrayRef<uint8_t> dataToSend, int zeroSize) {
int32_t status = 0;
HAL_SetSPIAutoTransmitData(m_port, dataToSend.data(), dataToSend.size(),
zeroSize, &status);

View File

@@ -71,8 +71,7 @@ void SendableBase::AddChild(void* child) {
* @param channel The channel number the device is plugged into
*/
void SendableBase::SetName(const wpi::Twine& moduleType, int channel) {
SetName(moduleType + wpi::Twine('[') + wpi::Twine(channel) +
wpi::Twine(']'));
SetName(moduleType + wpi::Twine('[') + wpi::Twine(channel) + wpi::Twine(']'));
}
/**

View File

@@ -304,8 +304,7 @@ bool SmartDashboard::PutNumber(wpi::StringRef keyName, double value) {
* @param defaultValue The default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
bool SmartDashboard::SetDefaultNumber(wpi::StringRef key,
double defaultValue) {
bool SmartDashboard::SetDefaultNumber(wpi::StringRef key, double defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultDouble(
defaultValue);
}
@@ -435,8 +434,8 @@ bool SmartDashboard::PutNumberArray(wpi::StringRef key,
* @param defaultValue The default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
bool SmartDashboard::SetDefaultNumberArray(
wpi::StringRef key, wpi::ArrayRef<double> defaultValue) {
bool SmartDashboard::SetDefaultNumberArray(wpi::StringRef key,
wpi::ArrayRef<double> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultDoubleArray(
defaultValue);
}

View File

@@ -34,9 +34,8 @@ Solenoid::Solenoid(int channel)
Solenoid::Solenoid(int moduleNumber, int channel)
: SolenoidBase(moduleNumber), m_channel(channel) {
if (!SensorBase::CheckSolenoidModule(m_moduleNumber)) {
wpi_setWPIErrorWithContext(
ModuleIndexOutOfRange,
"Solenoid Module " + wpi::Twine(m_moduleNumber));
wpi_setWPIErrorWithContext(ModuleIndexOutOfRange,
"Solenoid Module " + wpi::Twine(m_moduleNumber));
return;
}
if (!SensorBase::CheckSolenoidChannel(m_channel)) {

View File

@@ -127,9 +127,8 @@ bool wpi_assertEqual_impl(int valueA, int valueB,
bool wpi_assertNotEqual_impl(int valueA, int valueB,
const wpi::Twine& valueAString,
const wpi::Twine& valueBString,
const wpi::Twine& message,
wpi::StringRef fileName, int lineNumber,
wpi::StringRef funcName) {
const wpi::Twine& message, wpi::StringRef fileName,
int lineNumber, wpi::StringRef funcName) {
if (!(valueA != valueB)) {
wpi_assertEqual_common_impl(valueAString, valueBString, "!=", message,
fileName, lineNumber, funcName);

View File

@@ -41,8 +41,7 @@ class DriverStation : public ErrorBase, public RobotStateInterface {
static void ReportError(const wpi::Twine& error);
static void ReportWarning(const wpi::Twine& error);
static void ReportError(bool isError, int code, const wpi::Twine& error,
const wpi::Twine& location,
const wpi::Twine& stack);
const wpi::Twine& location, const wpi::Twine& stack);
static constexpr int kJoystickPorts = 6;

View File

@@ -47,8 +47,8 @@ class Error {
const ErrorBase* GetOriginatingObject() const;
double GetTimestamp() const;
void Clear();
void Set(Code code, const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function, int lineNumber,
void Set(Code code, const wpi::Twine& contextMessage, wpi::StringRef filename,
wpi::StringRef function, int lineNumber,
const ErrorBase* originatingObject);
private:

View File

@@ -103,8 +103,7 @@ class ErrorBase {
virtual void CloneError(const ErrorBase& rhs) const;
virtual void ClearError() const;
virtual bool StatusIsFatal() const;
static void SetGlobalError(Error::Code code,
const wpi::Twine& contextMessage,
static void SetGlobalError(Error::Code code, const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber);
static void SetGlobalWPIError(const wpi::Twine& errorMessage,

View File

@@ -23,16 +23,16 @@ namespace frc {
* used types of filters.
*
* Filters are of the form:<br>
* y[n] = (b0 * x[n] + b1 * x[n-1] + + bP * x[n-P]) -
* (a0 * y[n-1] + a2 * y[n-2] + + aQ * y[n-Q])
* y[n] = (b0 * x[n] + b1 * x[n-1] + … + bP * x[n-P]) -
* (a0 * y[n-1] + a2 * y[n-2] + … + aQ * y[n-Q])
*
* Where:<br>
* y[n] is the output at time "n"<br>
* x[n] is the input at time "n"<br>
* y[n-1] is the output from the LAST time step ("n-1")<br>
* x[n-1] is the input from the LAST time step ("n-1")<br>
* b0 bP are the "feedforward" (FIR) gains<br>
* a0 aQ are the "feedback" (IIR) gains<br>
* b0 … bP are the "feedforward" (FIR) gains<br>
* a0 … aQ are the "feedback" (IIR) gains<br>
* IMPORTANT! Note the "-" sign in front of the feedback term! This is a common
* convention in signal processing.
*

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2017 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2018 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. */

View File

@@ -144,8 +144,7 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddValueProperty(
const wpi::Twine& key,
std::function<std::shared_ptr<nt::Value>()> getter,
const wpi::Twine& key, std::function<std::shared_ptr<nt::Value>()> getter,
std::function<void(std::shared_ptr<nt::Value>)> setter) = 0;
/**
@@ -169,8 +168,7 @@ class SendableBuilder {
*/
virtual void AddSmallBooleanArrayProperty(
const wpi::Twine& key,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)>
getter,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)> getter,
std::function<void(wpi::ArrayRef<int>)> setter) = 0;
/**

View File

@@ -105,8 +105,7 @@ class SendableBuilderImpl : public SendableBuilder {
std::function<void(wpi::StringRef)> setter) override;
void AddValueProperty(
const wpi::Twine& key,
std::function<std::shared_ptr<nt::Value>()> getter,
const wpi::Twine& key, std::function<std::shared_ptr<nt::Value>()> getter,
std::function<void(std::shared_ptr<nt::Value>)> setter) override;
void AddSmallStringProperty(
@@ -116,8 +115,7 @@ class SendableBuilderImpl : public SendableBuilder {
void AddSmallBooleanArrayProperty(
const wpi::Twine& key,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)>
getter,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)> getter,
std::function<void(wpi::ArrayRef<int>)> setter) override;
void AddSmallDoubleArrayProperty(

View File

@@ -50,8 +50,7 @@ class SmartDashboard : public SensorBase {
static double GetNumber(wpi::StringRef keyName, double defaultValue);
static bool PutString(wpi::StringRef keyName, wpi::StringRef value);
static bool SetDefaultString(wpi::StringRef key,
wpi::StringRef defaultValue);
static bool SetDefaultString(wpi::StringRef key, wpi::StringRef defaultValue);
static std::string GetString(wpi::StringRef keyName,
wpi::StringRef defaultValue);
@@ -64,8 +63,8 @@ class SmartDashboard : public SensorBase {
static bool PutNumberArray(wpi::StringRef key, wpi::ArrayRef<double> value);
static bool SetDefaultNumberArray(wpi::StringRef key,
wpi::ArrayRef<double> defaultValue);
static std::vector<double> GetNumberArray(
wpi::StringRef key, wpi::ArrayRef<double> defaultValue);
static std::vector<double> GetNumberArray(wpi::StringRef key,
wpi::ArrayRef<double> defaultValue);
static bool PutStringArray(wpi::StringRef key,
wpi::ArrayRef<std::string> value);

View File

@@ -47,9 +47,8 @@ bool wpi_assertEqual_impl(int valueA, int valueB,
bool wpi_assertNotEqual_impl(int valueA, int valueB,
const wpi::Twine& valueAString,
const wpi::Twine& valueBString,
const wpi::Twine& message,
wpi::StringRef fileName, int lineNumber,
wpi::StringRef funcName);
const wpi::Twine& message, wpi::StringRef fileName,
int lineNumber, wpi::StringRef funcName);
void wpi_suspendOnAssertEnabled(bool enabled);