mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
Fixes warnings thrown by cpplint.py (#154)
* Fixed cpplint.py [runtime/int] warnings * Fixed cpplint.py [readability/casting] warnings * Fixed cpplint.py [readability/namespace] warnings * Fixed cpplint.py [readability/braces] warnings * Fixed cpplint.py [whitespace/braces] warnings * Fixed cpplint.py [runtime/explicit] warnings * Fixed cpplint.py [runtime/printf] warnings * Fixed cpplint.py [readability/inheritance] warnings * Fixed cpplint.py [whitespace/tab] warnings * Fixed cpplint.py [build/storage_class] warnings * Fixed cpplint.py [readability/multiline_comment] warnings * Fixed cpplint.py [whitespace/semicolon] warnings * Fixed cpplint.py [readability/check] warnings * Fixed cpplint.py [runtime/arrays] warnings * Ran format.py
This commit is contained in:
committed by
Peter Johnson
parent
e44a6e227a
commit
0cb288ffba
@@ -12,7 +12,7 @@
|
||||
class InternalButton : public Button {
|
||||
public:
|
||||
InternalButton() = default;
|
||||
InternalButton(bool inverted);
|
||||
explicit InternalButton(bool inverted);
|
||||
virtual ~InternalButton() = default;
|
||||
|
||||
void SetInverted(bool inverted);
|
||||
|
||||
@@ -39,9 +39,9 @@ class Trigger : public Sendable {
|
||||
void CancelWhenActive(Command* command);
|
||||
void ToggleWhenActive(Command* command);
|
||||
|
||||
virtual void InitTable(std::shared_ptr<ITable> table);
|
||||
virtual std::shared_ptr<ITable> GetTable() const;
|
||||
virtual std::string GetSmartDashboardType() const;
|
||||
void InitTable(std::shared_ptr<ITable> subtable) override;
|
||||
std::shared_ptr<ITable> GetTable() const override;
|
||||
std::string GetSmartDashboardType() const override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ITable> m_table;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
template <class T>
|
||||
class CircularBuffer {
|
||||
public:
|
||||
CircularBuffer(size_t size);
|
||||
explicit CircularBuffer(size_t size);
|
||||
|
||||
void PushFront(T value);
|
||||
void PushBack(T value);
|
||||
|
||||
@@ -52,8 +52,8 @@ class Command : public ErrorBase, public NamedSendable, public ITableListener {
|
||||
|
||||
public:
|
||||
Command();
|
||||
Command(const std::string& name);
|
||||
Command(double timeout);
|
||||
explicit Command(const std::string& name);
|
||||
explicit Command(double timeout);
|
||||
Command(const std::string& name, double timeout);
|
||||
virtual ~Command();
|
||||
double TimeSinceInitialized() const;
|
||||
@@ -167,12 +167,12 @@ class Command : public ErrorBase, public NamedSendable, public ITableListener {
|
||||
static int m_commandCounter;
|
||||
|
||||
public:
|
||||
virtual std::string GetName() const;
|
||||
virtual void InitTable(std::shared_ptr<ITable> table);
|
||||
virtual std::shared_ptr<ITable> GetTable() const;
|
||||
virtual std::string GetSmartDashboardType() const;
|
||||
virtual void ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value, bool isNew);
|
||||
std::string GetName() const override;
|
||||
void InitTable(std::shared_ptr<ITable> subtable) override;
|
||||
std::shared_ptr<ITable> GetTable() const override;
|
||||
std::string GetSmartDashboardType() const override;
|
||||
void ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value, bool isNew) override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ITable> m_table;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
class CommandGroup : public Command {
|
||||
public:
|
||||
CommandGroup() = default;
|
||||
CommandGroup(const std::string& name);
|
||||
explicit CommandGroup(const std::string& name);
|
||||
virtual ~CommandGroup() = default;
|
||||
|
||||
void AddSequential(Command* command);
|
||||
|
||||
@@ -51,6 +51,6 @@ class PIDCommand : public Command, public PIDOutput, public PIDSource {
|
||||
std::shared_ptr<PIDController> m_controller;
|
||||
|
||||
public:
|
||||
virtual void InitTable(std::shared_ptr<ITable> table);
|
||||
virtual std::string GetSmartDashboardType() const;
|
||||
void InitTable(std::shared_ptr<ITable> subtable) override;
|
||||
std::string GetSmartDashboardType() const override;
|
||||
};
|
||||
|
||||
@@ -66,6 +66,6 @@ class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource {
|
||||
std::shared_ptr<PIDController> m_controller;
|
||||
|
||||
public:
|
||||
virtual void InitTable(std::shared_ptr<ITable> table);
|
||||
virtual std::string GetSmartDashboardType() const;
|
||||
void InitTable(std::shared_ptr<ITable> subtable) override;
|
||||
std::string GetSmartDashboardType() const override;
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
class PrintCommand : public Command {
|
||||
public:
|
||||
PrintCommand(const std::string& message);
|
||||
explicit PrintCommand(const std::string& message);
|
||||
virtual ~PrintCommand() = default;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class StartCommand : public Command {
|
||||
public:
|
||||
StartCommand(Command* commandToStart);
|
||||
explicit StartCommand(Command* commandToStart);
|
||||
virtual ~StartCommand() = default;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -18,7 +18,7 @@ class Subsystem : public ErrorBase, public NamedSendable {
|
||||
friend class Scheduler;
|
||||
|
||||
public:
|
||||
Subsystem(const std::string& name);
|
||||
explicit Subsystem(const std::string& name);
|
||||
virtual ~Subsystem() = default;
|
||||
|
||||
void SetDefaultCommand(Command* command);
|
||||
@@ -37,10 +37,10 @@ class Subsystem : public ErrorBase, public NamedSendable {
|
||||
bool m_initializedDefaultCommand = false;
|
||||
|
||||
public:
|
||||
virtual std::string GetName() const;
|
||||
virtual void InitTable(std::shared_ptr<ITable> table);
|
||||
virtual std::shared_ptr<ITable> GetTable() const;
|
||||
virtual std::string GetSmartDashboardType() const;
|
||||
std::string GetName() const override;
|
||||
void InitTable(std::shared_ptr<ITable> subtable) override;
|
||||
std::shared_ptr<ITable> GetTable() const override;
|
||||
std::string GetSmartDashboardType() const override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ITable> m_table;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class WaitCommand : public Command {
|
||||
public:
|
||||
WaitCommand(double timeout);
|
||||
explicit WaitCommand(double timeout);
|
||||
WaitCommand(const std::string& name, double timeout);
|
||||
virtual ~WaitCommand() = default;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class WaitForChildren : public Command {
|
||||
public:
|
||||
WaitForChildren(double timeout);
|
||||
explicit WaitForChildren(double timeout);
|
||||
WaitForChildren(const std::string& name, double timeout);
|
||||
virtual ~WaitForChildren() = default;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class WaitUntilCommand : public Command {
|
||||
public:
|
||||
WaitUntilCommand(double time);
|
||||
explicit WaitUntilCommand(double time);
|
||||
WaitUntilCommand(const std::string& name, double time);
|
||||
virtual ~WaitUntilCommand() = default;
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
class Filter : public PIDSource {
|
||||
public:
|
||||
Filter(std::shared_ptr<PIDSource> source);
|
||||
explicit Filter(std::shared_ptr<PIDSource> source);
|
||||
virtual ~Filter() = default;
|
||||
|
||||
// PIDSource interface
|
||||
virtual void SetPIDSourceType(PIDSourceType pidSource) override;
|
||||
void SetPIDSourceType(PIDSourceType pidSource) override;
|
||||
PIDSourceType GetPIDSourceType() const;
|
||||
virtual double PIDGet() override = 0;
|
||||
double PIDGet() override = 0;
|
||||
|
||||
/**
|
||||
* Returns the current filter estimate without also inserting new data as
|
||||
|
||||
@@ -50,15 +50,15 @@ class PIDController : public LiveWindowSendable,
|
||||
virtual void SetContinuous(bool continuous = true);
|
||||
virtual void SetInputRange(float minimumInput, float maximumInput);
|
||||
virtual void SetOutputRange(float minimumOutput, float maximumOutput);
|
||||
virtual void SetPID(double p, double i, double d) override;
|
||||
void SetPID(double p, double i, double d) override;
|
||||
virtual void SetPID(double p, double i, double d, double f);
|
||||
virtual double GetP() const override;
|
||||
virtual double GetI() const override;
|
||||
virtual double GetD() const override;
|
||||
double GetP() const override;
|
||||
double GetI() const override;
|
||||
double GetD() const override;
|
||||
virtual double GetF() const;
|
||||
|
||||
virtual void SetSetpoint(float setpoint) override;
|
||||
virtual double GetSetpoint() const override;
|
||||
void SetSetpoint(float setpoint) override;
|
||||
double GetSetpoint() const override;
|
||||
double GetDeltaSetpoint() const;
|
||||
|
||||
virtual float GetError() const;
|
||||
@@ -73,13 +73,13 @@ class PIDController : public LiveWindowSendable,
|
||||
virtual void SetToleranceBuffer(unsigned buf = 1);
|
||||
virtual bool OnTarget() const;
|
||||
|
||||
virtual void Enable() override;
|
||||
virtual void Disable() override;
|
||||
virtual bool IsEnabled() const override;
|
||||
void Enable() override;
|
||||
void Disable() override;
|
||||
bool IsEnabled() const override;
|
||||
|
||||
virtual void Reset() override;
|
||||
void Reset() override;
|
||||
|
||||
virtual void InitTable(std::shared_ptr<ITable> table) override;
|
||||
void InitTable(std::shared_ptr<ITable> subtable) override;
|
||||
|
||||
protected:
|
||||
PIDSource* m_pidInput;
|
||||
@@ -141,12 +141,11 @@ class PIDController : public LiveWindowSendable,
|
||||
void Initialize(float p, float i, float d, float f, PIDSource* source,
|
||||
PIDOutput* output, float period = 0.05);
|
||||
|
||||
virtual std::shared_ptr<ITable> GetTable() const override;
|
||||
virtual std::string GetSmartDashboardType() const override;
|
||||
virtual void ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value,
|
||||
bool isNew) override;
|
||||
virtual void UpdateTable() override;
|
||||
virtual void StartLiveWindowMode() override;
|
||||
virtual void StopLiveWindowMode() override;
|
||||
std::shared_ptr<ITable> GetTable() const override;
|
||||
std::string GetSmartDashboardType() const override;
|
||||
void ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value, bool isNew) override;
|
||||
void UpdateTable() override;
|
||||
void StartLiveWindowMode() override;
|
||||
void StopLiveWindowMode() override;
|
||||
};
|
||||
|
||||
@@ -34,9 +34,9 @@ class SendableChooser : public Sendable {
|
||||
void AddDefault(const std::string& name, void* object);
|
||||
void* GetSelected();
|
||||
|
||||
virtual void InitTable(std::shared_ptr<ITable> subtable);
|
||||
virtual std::shared_ptr<ITable> GetTable() const;
|
||||
virtual std::string GetSmartDashboardType() const;
|
||||
void InitTable(std::shared_ptr<ITable> subtable) override;
|
||||
std::shared_ptr<ITable> GetTable() const override;
|
||||
std::string GetSmartDashboardType() const override;
|
||||
|
||||
private:
|
||||
std::string m_defaultChoice;
|
||||
|
||||
@@ -23,5 +23,5 @@ class Potentiometer : public PIDSource {
|
||||
*/
|
||||
virtual double Get() const = 0;
|
||||
|
||||
virtual void SetPIDSourceType(PIDSourceType pidSource) override;
|
||||
void SetPIDSourceType(PIDSourceType pidSource) override;
|
||||
};
|
||||
|
||||
@@ -14,15 +14,13 @@
|
||||
#include "Buttons/ToggleButtonScheduler.h"
|
||||
|
||||
bool Trigger::Grab() {
|
||||
if (Get())
|
||||
if (Get()) {
|
||||
return true;
|
||||
else if (m_table != nullptr) {
|
||||
// if (m_table->isConnected())//TODO is connected on button?
|
||||
} else if (m_table != nullptr) {
|
||||
return m_table->GetBoolean("pressed", false);
|
||||
/*else
|
||||
return false;*/
|
||||
} else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Trigger::WhenActive(Command* command) {
|
||||
@@ -52,8 +50,8 @@ void Trigger::ToggleWhenActive(Command* command) {
|
||||
|
||||
std::string Trigger::GetSmartDashboardType() const { return "Button"; }
|
||||
|
||||
void Trigger::InitTable(std::shared_ptr<ITable> table) {
|
||||
m_table = table;
|
||||
void Trigger::InitTable(std::shared_ptr<ITable> subtable) {
|
||||
m_table = subtable;
|
||||
if (m_table != nullptr) {
|
||||
m_table->PutBoolean("pressed", Get());
|
||||
}
|
||||
|
||||
@@ -392,9 +392,9 @@ std::string Command::GetName() const { return m_name; }
|
||||
|
||||
std::string Command::GetSmartDashboardType() const { return "Command"; }
|
||||
|
||||
void Command::InitTable(std::shared_ptr<ITable> table) {
|
||||
void Command::InitTable(std::shared_ptr<ITable> subtable) {
|
||||
if (m_table != nullptr) m_table->RemoveTableListener(this);
|
||||
m_table = table;
|
||||
m_table = subtable;
|
||||
if (m_table != nullptr) {
|
||||
m_table->PutString(kName, GetName());
|
||||
m_table->PutBoolean(kRunning, IsRunning());
|
||||
|
||||
@@ -66,7 +66,8 @@ double PIDCommand::GetSetpoint() const { return m_controller->GetSetpoint(); }
|
||||
double PIDCommand::GetPosition() { return ReturnPIDInput(); }
|
||||
|
||||
std::string PIDCommand::GetSmartDashboardType() const { return "PIDCommand"; }
|
||||
void PIDCommand::InitTable(std::shared_ptr<ITable> table) {
|
||||
m_controller->InitTable(table);
|
||||
Command::InitTable(table);
|
||||
|
||||
void PIDCommand::InitTable(std::shared_ptr<ITable> subtable) {
|
||||
m_controller->InitTable(subtable);
|
||||
Command::InitTable(subtable);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,8 @@ void PIDSubsystem::PIDWrite(float output) { UsePIDOutput(output); }
|
||||
double PIDSubsystem::PIDGet() { return ReturnPIDInput(); }
|
||||
|
||||
std::string PIDSubsystem::GetSmartDashboardType() const { return "PIDCommand"; }
|
||||
void PIDSubsystem::InitTable(std::shared_ptr<ITable> table) {
|
||||
m_controller->InitTable(table);
|
||||
Subsystem::InitTable(table);
|
||||
|
||||
void PIDSubsystem::InitTable(std::shared_ptr<ITable> subtable) {
|
||||
m_controller->InitTable(subtable);
|
||||
Subsystem::InitTable(subtable);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ void Scheduler::UpdateTable() {
|
||||
toCancel = new_toCancel->GetDoubleArray();
|
||||
else
|
||||
toCancel.resize(0);
|
||||
// m_table->RetrieveValue("Ids", *ids);
|
||||
// m_table->RetrieveValue("Ids", *ids);
|
||||
|
||||
// cancel commands that have had the cancel buttons pressed
|
||||
// on the SmartDashboad
|
||||
|
||||
@@ -129,8 +129,8 @@ std::string Subsystem::GetName() const { return m_name; }
|
||||
|
||||
std::string Subsystem::GetSmartDashboardType() const { return "Subsystem"; }
|
||||
|
||||
void Subsystem::InitTable(std::shared_ptr<ITable> table) {
|
||||
m_table = table;
|
||||
void Subsystem::InitTable(std::shared_ptr<ITable> subtable) {
|
||||
m_table = subtable;
|
||||
if (m_table != nullptr) {
|
||||
if (m_defaultCommand != nullptr) {
|
||||
m_table->PutBoolean("hasDefault", true);
|
||||
|
||||
Reference in New Issue
Block a user