mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Use llvm::Twine across C++ Command structure.
This commit is contained in:
@@ -12,12 +12,13 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
NetworkButton::NetworkButton(llvm::StringRef tableName, llvm::StringRef field)
|
||||
NetworkButton::NetworkButton(const llvm::Twine& tableName,
|
||||
const llvm::Twine& field)
|
||||
: NetworkButton(nt::NetworkTableInstance::GetDefault().GetTable(tableName),
|
||||
field) {}
|
||||
|
||||
NetworkButton::NetworkButton(std::shared_ptr<nt::NetworkTable> table,
|
||||
llvm::StringRef field)
|
||||
const llvm::Twine& field)
|
||||
: m_entry(table->GetEntry(field)) {}
|
||||
|
||||
bool NetworkButton::Get() {
|
||||
|
||||
@@ -16,7 +16,7 @@ using namespace frc;
|
||||
*
|
||||
* @param name The name for this command group
|
||||
*/
|
||||
CommandGroup::CommandGroup(const std::string& name) : Command(name) {}
|
||||
CommandGroup::CommandGroup(const llvm::Twine& name) : Command(name) {}
|
||||
|
||||
/**
|
||||
* Adds a new Command to the group. The Command will be started after all the
|
||||
|
||||
@@ -42,7 +42,7 @@ ConditionalCommand::ConditionalCommand(Command* onTrue, Command* onFalse) {
|
||||
* @param onTrue The Command to execute if Condition() returns true
|
||||
* @param onFalse The Command to execute if Condition() returns false
|
||||
*/
|
||||
ConditionalCommand::ConditionalCommand(const std::string& name, Command* onTrue,
|
||||
ConditionalCommand::ConditionalCommand(const llvm::Twine& name, Command* onTrue,
|
||||
Command* onFalse)
|
||||
: Command(name) {
|
||||
m_onTrue = onTrue;
|
||||
|
||||
@@ -14,6 +14,6 @@ using namespace frc;
|
||||
*
|
||||
* @param name The name for this command
|
||||
*/
|
||||
InstantCommand::InstantCommand(const std::string& name) : Command(name) {}
|
||||
InstantCommand::InstantCommand(const llvm::Twine& name) : Command(name) {}
|
||||
|
||||
bool InstantCommand::IsFinished() { return true; }
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
PIDCommand::PIDCommand(const std::string& name, double p, double i, double d,
|
||||
PIDCommand::PIDCommand(const llvm::Twine& name, double p, double i, double d,
|
||||
double f, double period)
|
||||
: Command(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
|
||||
@@ -22,12 +22,12 @@ PIDCommand::PIDCommand(double p, double i, double d, double f, double period) {
|
||||
std::make_shared<PIDController>(p, i, d, f, this, this, period);
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(const std::string& name, double p, double i, double d)
|
||||
PIDCommand::PIDCommand(const llvm::Twine& name, double p, double i, double d)
|
||||
: Command(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this);
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(const std::string& name, double p, double i, double d,
|
||||
PIDCommand::PIDCommand(const llvm::Twine& name, double p, double i, double d,
|
||||
double period)
|
||||
: Command(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
|
||||
|
||||
@@ -19,7 +19,7 @@ using namespace frc;
|
||||
* @param i the integral value
|
||||
* @param d the derivative value
|
||||
*/
|
||||
PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
|
||||
PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
|
||||
double d)
|
||||
: Subsystem(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this);
|
||||
@@ -35,7 +35,7 @@ PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
|
||||
* @param d the derivative value
|
||||
* @param f the feedforward value
|
||||
*/
|
||||
PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
|
||||
PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
|
||||
double d, double f)
|
||||
: Subsystem(name) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, f, this, this);
|
||||
@@ -55,7 +55,7 @@ PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
|
||||
* @param f the feedfoward value
|
||||
* @param period the time (in seconds) between calculations
|
||||
*/
|
||||
PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
|
||||
PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
|
||||
double d, double f, double period)
|
||||
: Subsystem(name) {
|
||||
m_controller =
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
PrintCommand::PrintCommand(const std::string& message)
|
||||
: InstantCommand("Print \"" + message + "\"") {
|
||||
m_message = message;
|
||||
PrintCommand::PrintCommand(const llvm::Twine& message)
|
||||
: InstantCommand("Print \"" + message + llvm::Twine('"')) {
|
||||
m_message = message.str();
|
||||
}
|
||||
|
||||
void PrintCommand::Initialize() { llvm::outs() << m_message << "\n"; }
|
||||
void PrintCommand::Initialize() { llvm::outs() << m_message << '\n'; }
|
||||
|
||||
@@ -15,7 +15,7 @@ using namespace frc;
|
||||
* @param name the name of the command
|
||||
* @param timeout the time (in seconds) before this command "times out"
|
||||
*/
|
||||
TimedCommand::TimedCommand(const std::string& name, double timeout)
|
||||
TimedCommand::TimedCommand(const llvm::Twine& name, double timeout)
|
||||
: Command(name, timeout) {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,5 +23,5 @@ WaitCommand::WaitCommand(double timeout)
|
||||
*
|
||||
* @param timeout the time (in seconds) before this command "times out"
|
||||
*/
|
||||
WaitCommand::WaitCommand(const std::string& name, double timeout)
|
||||
WaitCommand::WaitCommand(const llvm::Twine& name, double timeout)
|
||||
: TimedCommand(name, timeout) {}
|
||||
|
||||
@@ -14,7 +14,7 @@ using namespace frc;
|
||||
WaitForChildren::WaitForChildren(double timeout)
|
||||
: Command("WaitForChildren", timeout) {}
|
||||
|
||||
WaitForChildren::WaitForChildren(const std::string& name, double timeout)
|
||||
WaitForChildren::WaitForChildren(const llvm::Twine& name, double timeout)
|
||||
: Command(name, timeout) {}
|
||||
|
||||
bool WaitForChildren::IsFinished() {
|
||||
|
||||
@@ -23,7 +23,7 @@ WaitUntilCommand::WaitUntilCommand(double time)
|
||||
m_time = time;
|
||||
}
|
||||
|
||||
WaitUntilCommand::WaitUntilCommand(const std::string& name, double time)
|
||||
WaitUntilCommand::WaitUntilCommand(const llvm::Twine& name, double time)
|
||||
: Command(name, time) {
|
||||
m_time = time;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user