Move entirety of llvm namespace to wpi namespace.

During shared library loading, a different libLLVM can be pulled in, causing
llvm symbols from dependent libraries to resolve to that library instead of
this one. This has been seen in the wild with the Mesa OpenGL implementation
in JavaFX applications (see wpilibsuite/shuffleboard#361).

This is clearly a very breaking change. For some level of backwards
compatibility, a namespace alias from llvm to wpi is performed in the "llvm"
headers.  Unfortunately, forward declarations of llvm classes will still break,
but compilers seem to generate clear error messages in those cases
("namespace alias 'llvm' not allowed here, assuming 'wpi'").

This change also moves all the wpiutil headers to a single "wpi" subdirectory
from the previously split "llvm", "support", "tcpsockets", and "udpsockets".
Shim headers will be added for backwards compatibility in a later commit.
This commit is contained in:
Peter Johnson
2018-04-29 23:33:19 -07:00
parent 93859eb84f
commit f84018af5f
377 changed files with 2747 additions and 2742 deletions

View File

@@ -27,7 +27,7 @@ using namespace frc;
AnalogInput::AnalogInput(int channel) {
if (!SensorBase::CheckAnalogInputChannel(channel)) {
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
"Analog Input " + llvm::Twine(channel));
"Analog Input " + wpi::Twine(channel));
return;
}

View File

@@ -28,7 +28,7 @@ using namespace frc;
AnalogOutput::AnalogOutput(int channel) {
if (!SensorBase::CheckAnalogOutputChannel(channel)) {
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
"analog output " + llvm::Twine(channel));
"analog output " + wpi::Twine(channel));
m_channel = std::numeric_limits<int>::max();
m_port = HAL_kInvalidHandle;
return;

View File

@@ -12,13 +12,13 @@
using namespace frc;
NetworkButton::NetworkButton(const llvm::Twine& tableName,
const llvm::Twine& field)
NetworkButton::NetworkButton(const wpi::Twine& tableName,
const wpi::Twine& field)
: NetworkButton(nt::NetworkTableInstance::GetDefault().GetTable(tableName),
field) {}
NetworkButton::NetworkButton(std::shared_ptr<nt::NetworkTable> table,
const llvm::Twine& field)
const wpi::Twine& field)
: m_entry(table->GetEntry(field)) {}
bool NetworkButton::Get() {

View File

@@ -33,7 +33,7 @@ Command::Command() : Command("", -1.0) {}
*
* @param name the name for this command
*/
Command::Command(const llvm::Twine& name) : Command(name, -1.0) {}
Command::Command(const wpi::Twine& name) : Command(name, -1.0) {}
/**
* Creates a new command with the given timeout and a default name.
@@ -50,7 +50,7 @@ Command::Command(double timeout) : Command("", timeout) {}
* @param timeout the time (in seconds) before this command "times out"
* @see IsTimedOut()
*/
Command::Command(const llvm::Twine& name, double timeout)
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)
@@ -61,7 +61,7 @@ Command::Command(const llvm::Twine& name, double timeout)
// If name contains an empty string
if (name.isTriviallyEmpty() ||
(name.isSingleStringRef() && name.getSingleStringRef().empty())) {
SetName("Command_" + llvm::Twine(typeid(*this).name()));
SetName("Command_" + wpi::Twine(typeid(*this).name()));
} else {
SetName(name);
}

View File

@@ -16,7 +16,7 @@ using namespace frc;
*
* @param name The name for this command group
*/
CommandGroup::CommandGroup(const llvm::Twine& name) : Command(name) {}
CommandGroup::CommandGroup(const wpi::Twine& name) : Command(name) {}
/**
* Adds a new Command to the group. The Command will be started after all the

View File

@@ -44,7 +44,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 llvm::Twine& name, Command* onTrue,
ConditionalCommand::ConditionalCommand(const wpi::Twine& name, Command* onTrue,
Command* onFalse)
: Command(name) {
m_onTrue = onTrue;

View File

@@ -14,6 +14,6 @@ using namespace frc;
*
* @param name The name for this command
*/
InstantCommand::InstantCommand(const llvm::Twine& name) : Command(name) {}
InstantCommand::InstantCommand(const wpi::Twine& name) : Command(name) {}
bool InstantCommand::IsFinished() { return true; }

View File

@@ -11,7 +11,7 @@
using namespace frc;
PIDCommand::PIDCommand(const llvm::Twine& name, double p, double i, double d,
PIDCommand::PIDCommand(const wpi::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 llvm::Twine& name, double p, double i, double d)
PIDCommand::PIDCommand(const wpi::Twine& name, double p, double i, double d)
: Command(name) {
m_controller = std::make_shared<PIDController>(p, i, d, this, this);
}
PIDCommand::PIDCommand(const llvm::Twine& name, double p, double i, double d,
PIDCommand::PIDCommand(const wpi::Twine& name, double p, double i, double d,
double period)
: Command(name) {
m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);

View File

@@ -19,7 +19,7 @@ using namespace frc;
* @param i the integral value
* @param d the derivative value
*/
PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
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);
@@ -35,7 +35,7 @@ PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
* @param d the derivative value
* @param f the feedforward value
*/
PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
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);
@@ -55,7 +55,7 @@ PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
* @param f the feedfoward value
* @param period the time (in seconds) between calculations
*/
PIDSubsystem::PIDSubsystem(const llvm::Twine& name, double p, double i,
PIDSubsystem::PIDSubsystem(const wpi::Twine& name, double p, double i,
double d, double f, double period)
: Subsystem(name) {
m_controller =

View File

@@ -7,13 +7,13 @@
#include "Commands/PrintCommand.h"
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
using namespace frc;
PrintCommand::PrintCommand(const llvm::Twine& message)
: InstantCommand("Print \"" + message + llvm::Twine('"')) {
PrintCommand::PrintCommand(const wpi::Twine& message)
: InstantCommand("Print \"" + message + wpi::Twine('"')) {
m_message = message.str();
}
void PrintCommand::Initialize() { llvm::outs() << m_message << '\n'; }
void PrintCommand::Initialize() { wpi::outs() << m_message << '\n'; }

View File

@@ -20,7 +20,7 @@ using namespace frc;
*
* @param name the name of the subsystem
*/
Subsystem::Subsystem(const llvm::Twine& name) {
Subsystem::Subsystem(const wpi::Twine& name) {
SetName(name, name);
Scheduler::GetInstance()->RegisterSubsystem(this);
}
@@ -87,12 +87,12 @@ Command* Subsystem::GetDefaultCommand() {
*
* @return the default command name
*/
llvm::StringRef Subsystem::GetDefaultCommandName() {
wpi::StringRef Subsystem::GetDefaultCommandName() {
Command* defaultCommand = GetDefaultCommand();
if (defaultCommand) {
return defaultCommand->GetName();
} else {
return llvm::StringRef();
return wpi::StringRef();
}
}
@@ -118,12 +118,12 @@ Command* Subsystem::GetCurrentCommand() const { return m_currentCommand; }
*
* @return the current command name
*/
llvm::StringRef Subsystem::GetCurrentCommandName() const {
wpi::StringRef Subsystem::GetCurrentCommandName() const {
Command* currentCommand = GetCurrentCommand();
if (currentCommand) {
return currentCommand->GetName();
} else {
return llvm::StringRef();
return wpi::StringRef();
}
}
@@ -151,7 +151,7 @@ void Subsystem::ConfirmCommand() {
* @param name name to give child
* @param child sendable
*/
void Subsystem::AddChild(const llvm::Twine& name,
void Subsystem::AddChild(const wpi::Twine& name,
std::shared_ptr<Sendable> child) {
AddChild(name, *child);
}
@@ -163,7 +163,7 @@ void Subsystem::AddChild(const llvm::Twine& name,
* @param name name to give child
* @param child sendable
*/
void Subsystem::AddChild(const llvm::Twine& name, Sendable* child) {
void Subsystem::AddChild(const wpi::Twine& name, Sendable* child) {
AddChild(name, *child);
}
@@ -174,7 +174,7 @@ void Subsystem::AddChild(const llvm::Twine& name, Sendable* child) {
* @param name name to give child
* @param child sendable
*/
void Subsystem::AddChild(const llvm::Twine& name, Sendable& child) {
void Subsystem::AddChild(const wpi::Twine& name, Sendable& child) {
child.SetName(GetSubsystem(), name);
LiveWindow::GetInstance()->Add(&child);
}

View File

@@ -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 llvm::Twine& name, double timeout)
TimedCommand::TimedCommand(const wpi::Twine& name, double timeout)
: Command(name, timeout) {}
/**

View File

@@ -23,5 +23,5 @@ WaitCommand::WaitCommand(double timeout)
*
* @param timeout the time (in seconds) before this command "times out"
*/
WaitCommand::WaitCommand(const llvm::Twine& name, double timeout)
WaitCommand::WaitCommand(const wpi::Twine& name, double timeout)
: TimedCommand(name, timeout) {}

View File

@@ -14,7 +14,7 @@ using namespace frc;
WaitForChildren::WaitForChildren(double timeout)
: Command("WaitForChildren", timeout) {}
WaitForChildren::WaitForChildren(const llvm::Twine& name, double timeout)
WaitForChildren::WaitForChildren(const wpi::Twine& name, double timeout)
: Command(name, timeout) {}
bool WaitForChildren::IsFinished() {

View File

@@ -23,7 +23,7 @@ WaitUntilCommand::WaitUntilCommand(double time)
m_time = time;
}
WaitUntilCommand::WaitUntilCommand(const llvm::Twine& name, double time)
WaitUntilCommand::WaitUntilCommand(const wpi::Twine& name, double time)
: Command(name, time) {
m_time = time;
}

View File

@@ -28,7 +28,7 @@ using namespace frc;
DigitalInput::DigitalInput(int channel) {
if (!CheckDigitalChannel(channel)) {
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
"Digital Channel " + llvm::Twine(channel));
"Digital Channel " + wpi::Twine(channel));
m_channel = std::numeric_limits<int>::max();
return;
}

View File

@@ -31,7 +31,7 @@ DigitalOutput::DigitalOutput(int channel) {
m_pwmGenerator = HAL_kInvalidHandle;
if (!SensorBase::CheckDigitalChannel(channel)) {
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
"Digital Channel " + llvm::Twine(channel));
"Digital Channel " + wpi::Twine(channel));
m_channel = std::numeric_limits<int>::max();
return;
}

View File

@@ -44,19 +44,19 @@ DoubleSolenoid::DoubleSolenoid(int moduleNumber, int forwardChannel,
if (!SensorBase::CheckSolenoidModule(m_moduleNumber)) {
wpi_setWPIErrorWithContext(
ModuleIndexOutOfRange,
"Solenoid Module " + llvm::Twine(m_moduleNumber));
"Solenoid Module " + wpi::Twine(m_moduleNumber));
return;
}
if (!SensorBase::CheckSolenoidChannel(m_forwardChannel)) {
wpi_setWPIErrorWithContext(
ChannelIndexOutOfRange,
"Solenoid Channel " + llvm::Twine(m_forwardChannel));
"Solenoid Channel " + wpi::Twine(m_forwardChannel));
return;
}
if (!SensorBase::CheckSolenoidChannel(m_reverseChannel)) {
wpi_setWPIErrorWithContext(
ChannelIndexOutOfRange,
"Solenoid Channel " + llvm::Twine(m_reverseChannel));
"Solenoid Channel " + wpi::Twine(m_reverseChannel));
return;
}
int32_t status = 0;
@@ -186,7 +186,7 @@ void DoubleSolenoid::InitSendable(SendableBuilder& builder) {
builder.SetSafeState([=]() { Set(kOff); });
builder.AddSmallStringProperty(
"Value",
[=](llvm::SmallVectorImpl<char>& buf) -> llvm::StringRef {
[=](wpi::SmallVectorImpl<char>& buf) -> wpi::StringRef {
switch (Get()) {
case kForward:
return "Forward";
@@ -196,7 +196,7 @@ void DoubleSolenoid::InitSendable(SendableBuilder& builder) {
return "Off";
}
},
[=](llvm::StringRef value) {
[=](wpi::StringRef value) {
Value lvalue = kOff;
if (value == "Forward")
lvalue = kForward;

View File

@@ -262,7 +262,7 @@ void DifferentialDrive::StopMotor() {
m_safetyHelper.Feed();
}
void DifferentialDrive::GetDescription(llvm::raw_ostream& desc) const {
void DifferentialDrive::GetDescription(wpi::raw_ostream& desc) const {
desc << "DifferentialDrive";
}

View File

@@ -150,7 +150,7 @@ void KilloughDrive::StopMotor() {
m_safetyHelper.Feed();
}
void KilloughDrive::GetDescription(llvm::raw_ostream& desc) const {
void KilloughDrive::GetDescription(wpi::raw_ostream& desc) const {
desc << "KilloughDrive";
}

View File

@@ -124,7 +124,7 @@ void MecanumDrive::StopMotor() {
m_safetyHelper.Feed();
}
void MecanumDrive::GetDescription(llvm::raw_ostream& desc) const {
void MecanumDrive::GetDescription(wpi::raw_ostream& desc) const {
desc << "MecanumDrive";
}

View File

@@ -93,7 +93,7 @@ double RobotDriveBase::ApplyDeadband(double value, double deadband) {
/**
* Normalize all wheel speeds if the magnitude of any wheel is greater than 1.0.
*/
void RobotDriveBase::Normalize(llvm::MutableArrayRef<double> wheelSpeeds) {
void RobotDriveBase::Normalize(wpi::MutableArrayRef<double> wheelSpeeds) {
double maxMagnitude = std::abs(wheelSpeeds[0]);
for (size_t i = 1; i < wheelSpeeds.size(); i++) {
double temp = std::abs(wheelSpeeds[i]);

View File

@@ -12,11 +12,11 @@
#include <HAL/HAL.h>
#include <HAL/Power.h>
#include <HAL/cpp/Log.h>
#include <llvm/SmallString.h>
#include <llvm/StringRef.h>
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableInstance.h>
#include <wpi/SmallString.h>
#include <wpi/StringRef.h>
#include "AnalogInput.h"
#include "MotorSafetyHelper.h"
@@ -96,8 +96,8 @@ DriverStation& DriverStation::GetInstance() {
*
* The error is also printed to the program console.
*/
void DriverStation::ReportError(const llvm::Twine& error) {
llvm::SmallString<128> temp;
void DriverStation::ReportError(const wpi::Twine& error) {
wpi::SmallString<128> temp;
HAL_SendError(1, 1, 0, error.toNullTerminatedStringRef(temp).data(), "", "",
1);
}
@@ -107,8 +107,8 @@ void DriverStation::ReportError(const llvm::Twine& error) {
*
* The warning is also printed to the program console.
*/
void DriverStation::ReportWarning(const llvm::Twine& error) {
llvm::SmallString<128> temp;
void DriverStation::ReportWarning(const wpi::Twine& error) {
wpi::SmallString<128> temp;
HAL_SendError(0, 1, 0, error.toNullTerminatedStringRef(temp).data(), "", "",
1);
}
@@ -119,12 +119,12 @@ void DriverStation::ReportWarning(const llvm::Twine& error) {
* The error is also printed to the program console.
*/
void DriverStation::ReportError(bool isError, int32_t code,
const llvm::Twine& error,
const llvm::Twine& location,
const llvm::Twine& stack) {
llvm::SmallString<128> errorTemp;
llvm::SmallString<128> locationTemp;
llvm::SmallString<128> stackTemp;
const wpi::Twine& error,
const wpi::Twine& location,
const wpi::Twine& stack) {
wpi::SmallString<128> errorTemp;
wpi::SmallString<128> locationTemp;
wpi::SmallString<128> stackTemp;
HAL_SendError(isError, code, 0,
error.toNullTerminatedStringRef(errorTemp).data(),
location.toNullTerminatedStringRef(locationTemp).data(),
@@ -853,7 +853,7 @@ DriverStation::DriverStation() {
* Reports errors related to unplugged joysticks
* Throttles the errors so that they don't overwhelm the DS
*/
void DriverStation::ReportJoystickUnpluggedError(const llvm::Twine& message) {
void DriverStation::ReportJoystickUnpluggedError(const wpi::Twine& message) {
double currentTime = Timer::GetFPGATimestamp();
if (currentTime > m_nextMessageTime) {
ReportError(message);
@@ -866,7 +866,7 @@ void DriverStation::ReportJoystickUnpluggedError(const llvm::Twine& message) {
*
* Throttles the errors so that they don't overwhelm the DS.
*/
void DriverStation::ReportJoystickUnpluggedWarning(const llvm::Twine& message) {
void DriverStation::ReportJoystickUnpluggedWarning(const wpi::Twine& message) {
double currentTime = Timer::GetFPGATimestamp();
if (currentTime > m_nextMessageTime) {
ReportWarning(message);

View File

@@ -7,7 +7,7 @@
#include "Error.h"
#include <llvm/Path.h>
#include <wpi/Path.h>
#include "DriverStation.h"
#include "Timer.h"
@@ -41,8 +41,8 @@ const ErrorBase* Error::GetOriginatingObject() const {
double Error::GetTimestamp() const { return m_timestamp; }
void Error::Set(Code code, const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
void Error::Set(Code code, const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber, const ErrorBase* originatingObject) {
bool report = true;
@@ -66,8 +66,8 @@ void Error::Set(Code code, const llvm::Twine& contextMessage,
void Error::Report() {
DriverStation::ReportError(
true, m_code, m_message,
m_function + llvm::Twine(" [") + llvm::sys::path::filename(m_filename) +
llvm::Twine(':') + llvm::Twine(m_lineNumber) + llvm::Twine(']'),
m_function + wpi::Twine(" [") + wpi::sys::path::filename(m_filename) +
wpi::Twine(':') + wpi::Twine(m_lineNumber) + wpi::Twine(']'),
GetStackTrace(4));
}

View File

@@ -12,12 +12,12 @@
#include <cstring>
#include <HAL/HAL.h>
#include <wpi/Format.h>
#include <wpi/SmallString.h>
#include <wpi/raw_ostream.h>
#define WPI_ERRORS_DEFINE_STRINGS
#include "WPIErrors.h"
#include "llvm/Format.h"
#include "llvm/SmallString.h"
#include "llvm/raw_ostream.h"
using namespace frc;
@@ -49,16 +49,16 @@ void ErrorBase::ClearError() const { m_error.Clear(); }
* @param function Function of the error source
* @param lineNumber Line number of the error source
*/
void ErrorBase::SetErrnoError(const llvm::Twine& contextMessage,
llvm::StringRef filename,
llvm::StringRef function, int lineNumber) const {
llvm::SmallString<128> buf;
llvm::raw_svector_ostream err(buf);
void ErrorBase::SetErrnoError(const wpi::Twine& contextMessage,
wpi::StringRef filename,
wpi::StringRef function, int lineNumber) const {
wpi::SmallString<128> buf;
wpi::raw_svector_ostream err(buf);
int errNo = errno;
if (errNo == 0) {
err << "OK: ";
} else {
err << std::strerror(errNo) << " (" << llvm::format_hex(errNo, 10, true)
err << std::strerror(errNo) << " (" << wpi::format_hex(errNo, 10, true)
<< "): ";
}
@@ -83,13 +83,13 @@ void ErrorBase::SetErrnoError(const llvm::Twine& contextMessage,
* @param function Function of the error source
* @param lineNumber Line number of the error source
*/
void ErrorBase::SetImaqError(int success, const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
void ErrorBase::SetImaqError(int success, const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const {
// If there was an error
if (success <= 0) {
// Set the current error information for this object.
m_error.Set(success, llvm::Twine(success) + ": " + contextMessage, filename,
m_error.Set(success, wpi::Twine(success) + ": " + contextMessage, filename,
function, lineNumber, this);
// Update the global error if there is not one already set.
@@ -109,8 +109,8 @@ void ErrorBase::SetImaqError(int success, const llvm::Twine& contextMessage,
* @param function Function of the error source
* @param lineNumber Line number of the error source
*/
void ErrorBase::SetError(Error::Code code, const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
void ErrorBase::SetError(Error::Code code, const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const {
// If there was an error
if (code != 0) {
@@ -140,16 +140,16 @@ void ErrorBase::SetError(Error::Code code, const llvm::Twine& contextMessage,
*/
void ErrorBase::SetErrorRange(Error::Code code, int32_t minRange,
int32_t maxRange, int32_t requestedValue,
const llvm::Twine& contextMessage,
llvm::StringRef filename,
llvm::StringRef function, int lineNumber) const {
const wpi::Twine& contextMessage,
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.
m_error.Set(code,
contextMessage + ", Minimum Value: " + llvm::Twine(minRange) +
", MaximumValue: " + llvm::Twine(maxRange) +
", Requested Value: " + llvm::Twine(requestedValue),
contextMessage + ", Minimum Value: " + wpi::Twine(minRange) +
", MaximumValue: " + wpi::Twine(maxRange) +
", Requested Value: " + wpi::Twine(requestedValue),
filename, function, lineNumber, this);
// Update the global error if there is not one already set.
@@ -169,9 +169,9 @@ void ErrorBase::SetErrorRange(Error::Code code, int32_t minRange,
* @param function Function of the error source
* @param lineNumber Line number of the error source
*/
void ErrorBase::SetWPIError(const llvm::Twine& errorMessage, Error::Code code,
const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
void ErrorBase::SetWPIError(const wpi::Twine& errorMessage, Error::Code code,
const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const {
// Set the current error information for this object.
m_error.Set(code, errorMessage + ": " + contextMessage, filename, function,
@@ -196,9 +196,9 @@ void ErrorBase::CloneError(const ErrorBase& rhs) const {
bool ErrorBase::StatusIsFatal() const { return m_error.GetCode() < 0; }
void ErrorBase::SetGlobalError(Error::Code code,
const llvm::Twine& contextMessage,
llvm::StringRef filename,
llvm::StringRef function, int lineNumber) {
const wpi::Twine& contextMessage,
wpi::StringRef filename,
wpi::StringRef function, int lineNumber) {
// If there was an error
if (code != 0) {
std::lock_guard<wpi::mutex> mutex(_globalErrorMutex);
@@ -209,10 +209,10 @@ void ErrorBase::SetGlobalError(Error::Code code,
}
}
void ErrorBase::SetGlobalWPIError(const llvm::Twine& errorMessage,
const llvm::Twine& contextMessage,
llvm::StringRef filename,
llvm::StringRef function, int lineNumber) {
void ErrorBase::SetGlobalWPIError(const wpi::Twine& errorMessage,
const wpi::Twine& contextMessage,
wpi::StringRef filename,
wpi::StringRef function, int lineNumber) {
std::lock_guard<wpi::mutex> mutex(_globalErrorMutex);
if (_globalError.GetCode() != 0) {
_globalError.Clear();

View File

@@ -20,8 +20,8 @@ using namespace frc;
* @param fbGains The "feed back" or IIR gains
*/
LinearDigitalFilter::LinearDigitalFilter(PIDSource& source,
llvm::ArrayRef<double> ffGains,
llvm::ArrayRef<double> fbGains)
wpi::ArrayRef<double> ffGains,
wpi::ArrayRef<double> fbGains)
: Filter(source),
m_inputs(ffGains.size()),
m_outputs(fbGains.size()),
@@ -36,8 +36,8 @@ LinearDigitalFilter::LinearDigitalFilter(PIDSource& source,
* @param fbGains The "feed back" or IIR gains
*/
LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
llvm::ArrayRef<double> ffGains,
llvm::ArrayRef<double> fbGains)
wpi::ArrayRef<double> ffGains,
wpi::ArrayRef<double> fbGains)
: Filter(source),
m_inputs(ffGains.size()),
m_outputs(fbGains.size()),

View File

@@ -10,7 +10,7 @@
#include <cstdio>
#include <HAL/HAL.h>
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
#include "Commands/Scheduler.h"
#include "LiveWindow/LiveWindow.h"
@@ -31,7 +31,7 @@ using namespace frc;
* ready, causing the robot to be bypassed in a match.
*/
void IterativeRobotBase::RobotInit() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**
@@ -42,7 +42,7 @@ void IterativeRobotBase::RobotInit() {
* the robot enters disabled mode.
*/
void IterativeRobotBase::DisabledInit() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**
@@ -52,7 +52,7 @@ void IterativeRobotBase::DisabledInit() {
* called each time the robot enters autonomous mode.
*/
void IterativeRobotBase::AutonomousInit() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**
@@ -62,7 +62,7 @@ void IterativeRobotBase::AutonomousInit() {
* called each time the robot enters teleop mode.
*/
void IterativeRobotBase::TeleopInit() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**
@@ -72,7 +72,7 @@ void IterativeRobotBase::TeleopInit() {
* called each time the robot enters test mode.
*/
void IterativeRobotBase::TestInit() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**
@@ -84,7 +84,7 @@ void IterativeRobotBase::TestInit() {
void IterativeRobotBase::RobotPeriodic() {
static bool firstRun = true;
if (firstRun) {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
firstRun = false;
}
}
@@ -99,7 +99,7 @@ void IterativeRobotBase::RobotPeriodic() {
void IterativeRobotBase::DisabledPeriodic() {
static bool firstRun = true;
if (firstRun) {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
firstRun = false;
}
}
@@ -114,7 +114,7 @@ void IterativeRobotBase::DisabledPeriodic() {
void IterativeRobotBase::AutonomousPeriodic() {
static bool firstRun = true;
if (firstRun) {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
firstRun = false;
}
}
@@ -129,7 +129,7 @@ void IterativeRobotBase::AutonomousPeriodic() {
void IterativeRobotBase::TeleopPeriodic() {
static bool firstRun = true;
if (firstRun) {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
firstRun = false;
}
}
@@ -143,7 +143,7 @@ void IterativeRobotBase::TeleopPeriodic() {
void IterativeRobotBase::TestPeriodic() {
static bool firstRun = true;
if (firstRun) {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
firstRun = false;
}
}

View File

@@ -9,20 +9,20 @@
#include <algorithm>
#include <llvm/DenseMap.h>
#include <llvm/SmallString.h>
#include <llvm/raw_ostream.h>
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableInstance.h>
#include <support/mutex.h>
#include <wpi/DenseMap.h>
#include <wpi/SmallString.h>
#include <wpi/mutex.h>
#include <wpi/raw_ostream.h>
#include "Commands/Scheduler.h"
#include "SmartDashboard/SendableBuilderImpl.h"
using namespace frc;
using llvm::Twine;
using wpi::Twine;
struct LiveWindow::Impl {
Impl();
@@ -37,7 +37,7 @@ struct LiveWindow::Impl {
wpi::mutex mutex;
llvm::DenseMap<void*, Component> components;
wpi::DenseMap<void*, Component> components;
std::shared_ptr<nt::NetworkTable> liveWindowTable;
std::shared_ptr<nt::NetworkTable> statusTable;
@@ -115,8 +115,8 @@ 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 llvm::Twine& subsystem,
const llvm::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 +126,8 @@ void LiveWindow::AddSensor(const llvm::Twine& subsystem,
* @brief Pass a reference to LiveWindow and retain ownership of the component.
* @deprecated Use Sendable::SetName() instead.
*/
void LiveWindow::AddSensor(const llvm::Twine& subsystem,
const llvm::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 +136,8 @@ void LiveWindow::AddSensor(const llvm::Twine& subsystem,
* @brief Use a raw pointer to the LiveWindow.
* @deprecated Use Sendable::SetName() instead.
*/
void LiveWindow::AddSensor(const llvm::Twine& subsystem,
const llvm::Twine& name, Sendable* component) {
void LiveWindow::AddSensor(const wpi::Twine& subsystem,
const wpi::Twine& name, Sendable* component) {
Add(component);
component->SetName(subsystem, name);
}
@@ -157,8 +157,8 @@ void LiveWindow::AddSensor(const llvm::Twine& subsystem,
/**
* @brief Use a STL smart pointer to share ownership of component.
*/
void LiveWindow::AddActuator(const llvm::Twine& subsystem,
const llvm::Twine& name,
void LiveWindow::AddActuator(const wpi::Twine& subsystem,
const wpi::Twine& name,
std::shared_ptr<Sendable> component) {
Add(component);
component->SetName(subsystem, name);
@@ -168,8 +168,8 @@ void LiveWindow::AddActuator(const llvm::Twine& subsystem,
* @brief Pass a reference to LiveWindow and retain ownership of the component.
* @deprecated Use Sendable::SetName() instead.
*/
void LiveWindow::AddActuator(const llvm::Twine& subsystem,
const llvm::Twine& name, Sendable& component) {
void LiveWindow::AddActuator(const wpi::Twine& subsystem,
const wpi::Twine& name, Sendable& component) {
Add(&component);
component.SetName(subsystem, name);
}
@@ -178,8 +178,8 @@ void LiveWindow::AddActuator(const llvm::Twine& subsystem,
* @brief Use a raw pointer to the LiveWindow.
* @deprecated Use Sendable::SetName() instead.
*/
void LiveWindow::AddActuator(const llvm::Twine& subsystem,
const llvm::Twine& name, Sendable* component) {
void LiveWindow::AddActuator(const wpi::Twine& subsystem,
const wpi::Twine& name, Sendable* component) {
Add(component);
component->SetName(subsystem, name);
}
@@ -189,7 +189,7 @@ void LiveWindow::AddActuator(const llvm::Twine& subsystem,
* Meant for internal use in other WPILib classes.
* @deprecated Use SensorBase::SetName() instead.
*/
void LiveWindow::AddSensor(const llvm::Twine& type, int channel,
void LiveWindow::AddSensor(const wpi::Twine& type, int channel,
Sendable* component) {
Add(component);
component->SetName("Ungrouped",
@@ -200,7 +200,7 @@ void LiveWindow::AddSensor(const llvm::Twine& type, int channel,
* Meant for internal use in other WPILib classes.
* @deprecated Use SensorBase::SetName() instead.
*/
void LiveWindow::AddActuator(const llvm::Twine& type, int channel,
void LiveWindow::AddActuator(const wpi::Twine& type, int channel,
Sendable* component) {
Add(component);
component->SetName("Ungrouped",
@@ -211,7 +211,7 @@ void LiveWindow::AddActuator(const llvm::Twine& type, int channel,
* Meant for internal use in other WPILib classes.
* @deprecated Use SensorBase::SetName() instead.
*/
void LiveWindow::AddActuator(const llvm::Twine& type, int module, int channel,
void LiveWindow::AddActuator(const wpi::Twine& type, int module, int channel,
Sendable* component) {
Add(component);
component->SetName("Ungrouped", type + Twine('[') + Twine(module) +

View File

@@ -13,11 +13,11 @@ using namespace frc;
std::string LiveWindowSendable::GetName() const { return std::string(); }
void LiveWindowSendable::SetName(const llvm::Twine&) {}
void LiveWindowSendable::SetName(const wpi::Twine&) {}
std::string LiveWindowSendable::GetSubsystem() const { return std::string(); }
void LiveWindowSendable::SetSubsystem(const llvm::Twine&) {}
void LiveWindowSendable::SetSubsystem(const wpi::Twine&) {}
void LiveWindowSendable::InitSendable(SendableBuilder& builder) {
builder.SetUpdateTable([=]() { UpdateTable(); });

View File

@@ -7,8 +7,8 @@
#include "MotorSafetyHelper.h"
#include <llvm/SmallString.h>
#include <llvm/raw_ostream.h>
#include <wpi/SmallString.h>
#include <wpi/raw_ostream.h>
#include "DriverStation.h"
#include "MotorSafety.h"
@@ -109,8 +109,8 @@ void MotorSafetyHelper::Check() {
if (!enabled || ds.IsDisabled() || ds.IsTest()) return;
if (stopTime < Timer::GetFPGATimestamp()) {
llvm::SmallString<128> buf;
llvm::raw_svector_ostream desc(buf);
wpi::SmallString<128> buf;
wpi::raw_svector_ostream desc(buf);
m_safeObject->GetDescription(desc);
desc << "... Output not updated often enough.";
wpi_setWPIErrorWithContext(Timeout, desc.str());

View File

@@ -120,7 +120,7 @@ void NidecBrushless::SetSafetyEnabled(bool enabled) {
m_safetyHelper.SetSafetyEnabled(enabled);
}
void NidecBrushless::GetDescription(llvm::raw_ostream& desc) const {
void NidecBrushless::GetDescription(wpi::raw_ostream& desc) const {
desc << "Nidec " << GetChannel();
}

View File

@@ -31,7 +31,7 @@ using namespace frc;
PWM::PWM(int channel) {
if (!SensorBase::CheckPWMChannel(channel)) {
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
"PWM Channel " + llvm::Twine(channel));
"PWM Channel " + wpi::Twine(channel));
return;
}

View File

@@ -10,8 +10,8 @@
#include <HAL/HAL.h>
#include <HAL/PDP.h>
#include <HAL/Ports.h>
#include <llvm/SmallString.h>
#include <llvm/raw_ostream.h>
#include <wpi/SmallString.h>
#include <wpi/raw_ostream.h>
#include "SmartDashboard/SendableBuilder.h"
#include "WPIErrors.h"
@@ -78,8 +78,8 @@ double PowerDistributionPanel::GetCurrent(int channel) const {
int32_t status = 0;
if (!CheckPDPChannel(channel)) {
llvm::SmallString<32> str;
llvm::raw_svector_ostream buf(str);
wpi::SmallString<32> str;
wpi::raw_svector_ostream buf(str);
buf << "PDP Channel " << channel;
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
}
@@ -175,7 +175,7 @@ void PowerDistributionPanel::ClearStickyFaults() {
void PowerDistributionPanel::InitSendable(SendableBuilder& builder) {
builder.SetSmartDashboardType("PowerDistributionPanel");
for (int i = 0; i < kPDPChannels; ++i) {
builder.AddDoubleProperty("Chan" + llvm::Twine(i),
builder.AddDoubleProperty("Chan" + wpi::Twine(i),
[=]() { return GetCurrent(i); }, nullptr);
}
builder.AddDoubleProperty("Voltage", [=]() { return GetVoltage(); }, nullptr);

View File

@@ -10,21 +10,21 @@
#include <algorithm>
#include <HAL/HAL.h>
#include <llvm/StringRef.h>
#include <networktables/NetworkTableInstance.h>
#include <wpi/StringRef.h>
#include "WPIErrors.h"
using namespace frc;
// The Preferences table name
static llvm::StringRef kTableName{"Preferences"};
static wpi::StringRef kTableName{"Preferences"};
Preferences::Preferences()
: m_table(nt::NetworkTableInstance::GetDefault().GetTable(kTableName)) {
m_table->GetEntry(".type").SetString("RobotPreferences");
m_listener = m_table->AddEntryListener(
[=](nt::NetworkTable* table, llvm::StringRef name,
[=](nt::NetworkTable* table, wpi::StringRef name,
nt::NetworkTableEntry entry, std::shared_ptr<nt::Value> value,
int flags) { entry.SetPersistent(); },
NT_NOTIFY_NEW | NT_NOTIFY_IMMEDIATE);
@@ -56,8 +56,8 @@ std::vector<std::string> Preferences::GetKeys() { return m_table->GetKeys(); }
* @param defaultValue the value to return if none exists in the table
* @return either the value in the table, or the defaultValue
*/
std::string Preferences::GetString(llvm::StringRef key,
llvm::StringRef defaultValue) {
std::string Preferences::GetString(wpi::StringRef key,
wpi::StringRef defaultValue) {
return m_table->GetString(key, defaultValue);
}
@@ -69,7 +69,7 @@ std::string Preferences::GetString(llvm::StringRef key,
* @param defaultValue the value to return if none exists in the table
* @return either the value in the table, or the defaultValue
*/
int Preferences::GetInt(llvm::StringRef key, int defaultValue) {
int Preferences::GetInt(wpi::StringRef key, int defaultValue) {
return static_cast<int>(m_table->GetNumber(key, defaultValue));
}
@@ -81,7 +81,7 @@ int Preferences::GetInt(llvm::StringRef key, int defaultValue) {
* @param defaultValue the value to return if none exists in the table
* @return either the value in the table, or the defaultValue
*/
double Preferences::GetDouble(llvm::StringRef key, double defaultValue) {
double Preferences::GetDouble(wpi::StringRef key, double defaultValue) {
return m_table->GetNumber(key, defaultValue);
}
@@ -93,7 +93,7 @@ double Preferences::GetDouble(llvm::StringRef key, double defaultValue) {
* @param defaultValue the value to return if none exists in the table
* @return either the value in the table, or the defaultValue
*/
float Preferences::GetFloat(llvm::StringRef key, float defaultValue) {
float Preferences::GetFloat(wpi::StringRef key, float defaultValue) {
return m_table->GetNumber(key, defaultValue);
}
@@ -105,7 +105,7 @@ float Preferences::GetFloat(llvm::StringRef key, float defaultValue) {
* @param defaultValue the value to return if none exists in the table
* @return either the value in the table, or the defaultValue
*/
bool Preferences::GetBoolean(llvm::StringRef key, bool defaultValue) {
bool Preferences::GetBoolean(wpi::StringRef key, bool defaultValue) {
return m_table->GetBoolean(key, defaultValue);
}
@@ -117,7 +117,7 @@ bool Preferences::GetBoolean(llvm::StringRef key, bool defaultValue) {
* @param defaultValue the value to return if none exists in the table
* @return either the value in the table, or the defaultValue
*/
int64_t Preferences::GetLong(llvm::StringRef key, int64_t defaultValue) {
int64_t Preferences::GetLong(wpi::StringRef key, int64_t defaultValue) {
return static_cast<int64_t>(m_table->GetNumber(key, defaultValue));
}
@@ -130,7 +130,7 @@ int64_t Preferences::GetLong(llvm::StringRef key, int64_t defaultValue) {
* @param key the key
* @param value the value
*/
void Preferences::PutString(llvm::StringRef key, llvm::StringRef value) {
void Preferences::PutString(wpi::StringRef key, wpi::StringRef value) {
auto entry = m_table->GetEntry(key);
entry.SetString(value);
entry.SetPersistent();
@@ -144,7 +144,7 @@ void Preferences::PutString(llvm::StringRef key, llvm::StringRef value) {
* @param key the key
* @param value the value
*/
void Preferences::PutInt(llvm::StringRef key, int value) {
void Preferences::PutInt(wpi::StringRef key, int value) {
auto entry = m_table->GetEntry(key);
entry.SetDouble(value);
entry.SetPersistent();
@@ -158,7 +158,7 @@ void Preferences::PutInt(llvm::StringRef key, int value) {
* @param key the key
* @param value the value
*/
void Preferences::PutDouble(llvm::StringRef key, double value) {
void Preferences::PutDouble(wpi::StringRef key, double value) {
auto entry = m_table->GetEntry(key);
entry.SetDouble(value);
entry.SetPersistent();
@@ -172,7 +172,7 @@ void Preferences::PutDouble(llvm::StringRef key, double value) {
* @param key the key
* @param value the value
*/
void Preferences::PutFloat(llvm::StringRef key, float value) {
void Preferences::PutFloat(wpi::StringRef key, float value) {
auto entry = m_table->GetEntry(key);
entry.SetDouble(value);
entry.SetPersistent();
@@ -186,7 +186,7 @@ void Preferences::PutFloat(llvm::StringRef key, float value) {
* @param key the key
* @param value the value
*/
void Preferences::PutBoolean(llvm::StringRef key, bool value) {
void Preferences::PutBoolean(wpi::StringRef key, bool value) {
auto entry = m_table->GetEntry(key);
entry.SetBoolean(value);
entry.SetPersistent();
@@ -200,7 +200,7 @@ void Preferences::PutBoolean(llvm::StringRef key, bool value) {
* @param key the key
* @param value the value
*/
void Preferences::PutLong(llvm::StringRef key, int64_t value) {
void Preferences::PutLong(wpi::StringRef key, int64_t value) {
auto entry = m_table->GetEntry(key);
entry.SetDouble(value);
entry.SetPersistent();
@@ -212,7 +212,7 @@ void Preferences::PutLong(llvm::StringRef key, int64_t value) {
* @param key the key
* @return if there is a value at the given key
*/
bool Preferences::ContainsKey(llvm::StringRef key) {
bool Preferences::ContainsKey(wpi::StringRef key) {
return m_table->ContainsKey(key);
}
@@ -221,4 +221,4 @@ bool Preferences::ContainsKey(llvm::StringRef key) {
*
* @param key the key
*/
void Preferences::Remove(llvm::StringRef key) { m_table->Delete(key); }
void Preferences::Remove(wpi::StringRef key) { m_table->Delete(key); }

View File

@@ -10,7 +10,7 @@
#include <HAL/HAL.h>
#include <HAL/Ports.h>
#include <HAL/Relay.h>
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
#include "MotorSafetyHelper.h"
#include "SensorBase.h"
@@ -32,7 +32,7 @@ Relay::Relay(int channel, Relay::Direction direction)
: m_channel(channel), m_direction(direction) {
if (!SensorBase::CheckRelayChannel(m_channel)) {
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
"Relay Channel " + llvm::Twine(m_channel));
"Relay Channel " + wpi::Twine(m_channel));
return;
}
@@ -268,7 +268,7 @@ bool Relay::IsSafetyEnabled() const {
return m_safetyHelper->IsSafetyEnabled();
}
void Relay::GetDescription(llvm::raw_ostream& desc) const {
void Relay::GetDescription(wpi::raw_ostream& desc) const {
desc << "Relay " << GetChannel();
}
@@ -277,7 +277,7 @@ void Relay::InitSendable(SendableBuilder& builder) {
builder.SetSafeState([=]() { Set(kOff); });
builder.AddSmallStringProperty(
"Value",
[=](llvm::SmallVectorImpl<char>& buf) -> llvm::StringRef {
[=](wpi::SmallVectorImpl<char>& buf) -> wpi::StringRef {
switch (Get()) {
case kOn:
return "On";
@@ -289,7 +289,7 @@ void Relay::InitSendable(SendableBuilder& builder) {
return "Off";
}
},
[=](llvm::StringRef value) {
[=](wpi::StringRef value) {
if (value == "Off")
Set(kOff);
else if (value == "Forward")

View File

@@ -39,13 +39,13 @@ class WPILibCameraServerShared : public frc::CameraServerShared {
void ReportVideoServer(int id) override {
HAL_Report(HALUsageReporting::kResourceType_PCVideoServer, id);
}
void SetCameraServerError(llvm::StringRef error) override {
void SetCameraServerError(wpi::StringRef error) override {
wpi_setGlobalWPIErrorWithContext(CameraServerError, error);
}
void SetVisionRunnerError(llvm::StringRef error) override {
void SetVisionRunnerError(wpi::StringRef error) override {
wpi_setGlobalErrorWithContext(-1, error);
}
void ReportDriverStationError(llvm::StringRef error) override {
void ReportDriverStationError(wpi::StringRef error) override {
DriverStation::ReportError(error);
}
std::pair<std::thread::id, bool> GetRobotMainThreadId() const override {

View File

@@ -735,7 +735,7 @@ void RobotDrive::SetSafetyEnabled(bool enabled) {
m_safetyHelper->SetSafetyEnabled(enabled);
}
void RobotDrive::GetDescription(llvm::raw_ostream& desc) const {
void RobotDrive::GetDescription(wpi::raw_ostream& desc) const {
desc << "RobotDrive";
}

View File

@@ -11,8 +11,8 @@
#include <HAL/HAL.h>
#include <HAL/SPI.h>
#include <llvm/SmallVector.h>
#include <support/mutex.h>
#include <wpi/SmallVector.h>
#include <wpi/mutex.h>
#include "DigitalSource.h"
#include "Notifier.h"
@@ -257,7 +257,7 @@ int SPI::Write(uint8_t* data, int size) {
int SPI::Read(bool initiate, uint8_t* dataReceived, int size) {
int retVal = 0;
if (initiate) {
llvm::SmallVector<uint8_t, 32> dataToSend;
wpi::SmallVector<uint8_t, 32> dataToSend;
dataToSend.resize(size);
retVal = HAL_TransactionSPI(m_port, dataToSend.data(), dataReceived, size);
} else {
@@ -311,7 +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(llvm::ArrayRef<uint8_t> dataToSend,
void SPI::SetAutoTransmitData(wpi::ArrayRef<uint8_t> dataToSend,
int zeroSize) {
int32_t status = 0;
HAL_SetSPIAutoTransmitData(m_port, dataToSend.data(), dataToSend.size(),

View File

@@ -74,7 +74,7 @@ bool SafePWM::IsSafetyEnabled() const {
return m_safetyHelper->IsSafetyEnabled();
}
void SafePWM::GetDescription(llvm::raw_ostream& desc) const {
void SafePWM::GetDescription(wpi::raw_ostream& desc) const {
desc << "PWM " << GetChannel();
}

View File

@@ -7,8 +7,8 @@
#include "SampleRobot.h"
#include <llvm/raw_ostream.h>
#include <networktables/NetworkTable.h>
#include <wpi/raw_ostream.h>
#include "DriverStation.h"
#include "LiveWindow/LiveWindow.h"
@@ -78,7 +78,7 @@ void SampleRobot::StartCompetition() {
* ready, causing the robot to be bypassed in a match.
*/
void SampleRobot::RobotInit() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**
@@ -88,7 +88,7 @@ void SampleRobot::RobotInit() {
* field is disabled.
*/
void SampleRobot::Disabled() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**
@@ -99,7 +99,7 @@ void SampleRobot::Disabled() {
* robot enters the autonomous state.
*/
void SampleRobot::Autonomous() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**
@@ -110,7 +110,7 @@ void SampleRobot::Autonomous() {
* each time the robot enters the teleop state.
*/
void SampleRobot::OperatorControl() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**
@@ -121,7 +121,7 @@ void SampleRobot::OperatorControl() {
* test mode
*/
void SampleRobot::Test() {
llvm::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
wpi::outs() << "Default " << __FUNCTION__ << "() method... Overload me!\n";
}
/**

View File

@@ -73,14 +73,14 @@ SerialPort::SerialPort(int baudRate, Port port, int dataBits,
* @param stopBits The number of stop bits to use as defined by the enum
* StopBits.
*/
SerialPort::SerialPort(int baudRate, llvm::StringRef portName, Port port,
SerialPort::SerialPort(int baudRate, wpi::StringRef portName, Port port,
int dataBits, SerialPort::Parity parity,
SerialPort::StopBits stopBits) {
int32_t status = 0;
m_port = port;
llvm::SmallVector<char, 64> buf;
wpi::SmallVector<char, 64> buf;
const char* portNameC = portName.c_str(buf);
HAL_InitializeSerialPortDirect(static_cast<HAL_SerialPort>(port), portNameC,
@@ -194,7 +194,7 @@ int SerialPort::Read(char* buffer, int count) {
* @return The number of bytes actually written into the port.
*/
int SerialPort::Write(const char* buffer, int count) {
return Write(llvm::StringRef(buffer, static_cast<size_t>(count)));
return Write(wpi::StringRef(buffer, static_cast<size_t>(count)));
}
/**
@@ -206,7 +206,7 @@ int SerialPort::Write(const char* buffer, int count) {
* @param buffer StringRef to the buffer to read the bytes from.
* @return The number of bytes actually written into the port.
*/
int SerialPort::Write(llvm::StringRef buffer) {
int SerialPort::Write(wpi::StringRef buffer) {
int32_t status = 0;
int retVal = HAL_WriteSerial(static_cast<HAL_SerialPort>(m_port),
buffer.data(), buffer.size(), &status);

View File

@@ -9,10 +9,10 @@
using namespace frc;
void NamedSendable::SetName(const llvm::Twine&) {}
void NamedSendable::SetName(const wpi::Twine&) {}
std::string NamedSendable::GetSubsystem() const { return std::string(); }
void NamedSendable::SetSubsystem(const llvm::Twine&) {}
void NamedSendable::SetSubsystem(const wpi::Twine&) {}
void NamedSendable::InitSendable(SendableBuilder&) {}

View File

@@ -30,7 +30,7 @@ std::string SendableBase::GetName() const {
return m_name;
}
void SendableBase::SetName(const llvm::Twine& name) {
void SendableBase::SetName(const wpi::Twine& name) {
std::lock_guard<wpi::mutex> lock(m_mutex);
m_name = name.str();
}
@@ -40,7 +40,7 @@ std::string SendableBase::GetSubsystem() const {
return m_subsystem;
}
void SendableBase::SetSubsystem(const llvm::Twine& subsystem) {
void SendableBase::SetSubsystem(const wpi::Twine& subsystem) {
std::lock_guard<wpi::mutex> lock(m_mutex);
m_subsystem = subsystem.str();
}
@@ -70,9 +70,9 @@ void SendableBase::AddChild(void* child) {
* value
* @param channel The channel number the device is plugged into
*/
void SendableBase::SetName(const llvm::Twine& moduleType, int channel) {
SetName(moduleType + llvm::Twine('[') + llvm::Twine(channel) +
llvm::Twine(']'));
void SendableBase::SetName(const wpi::Twine& moduleType, int channel) {
SetName(moduleType + wpi::Twine('[') + wpi::Twine(channel) +
wpi::Twine(']'));
}
/**
@@ -84,8 +84,8 @@ void SendableBase::SetName(const llvm::Twine& moduleType, int channel) {
* @param channel The channel number the device is plugged into (usually
* PWM)
*/
void SendableBase::SetName(const llvm::Twine& moduleType, int moduleNumber,
void SendableBase::SetName(const wpi::Twine& moduleType, int moduleNumber,
int channel) {
SetName(moduleType + llvm::Twine('[') + llvm::Twine(moduleNumber) +
llvm::Twine(',') + llvm::Twine(channel) + llvm::Twine(']'));
SetName(moduleType + wpi::Twine('[') + wpi::Twine(moduleNumber) +
wpi::Twine(',') + wpi::Twine(channel) + wpi::Twine(']'));
}

View File

@@ -7,7 +7,7 @@
#include "SmartDashboard/SendableBuilderImpl.h"
#include <llvm/SmallString.h>
#include <wpi/SmallString.h>
#include "ntcore_cpp.h"
@@ -47,7 +47,7 @@ void SendableBuilderImpl::StopLiveWindowMode() {
if (m_safeState) m_safeState();
}
void SendableBuilderImpl::SetSmartDashboardType(const llvm::Twine& type) {
void SendableBuilderImpl::SetSmartDashboardType(const wpi::Twine& type) {
m_table->GetEntry(".type").SetString(type);
}
@@ -59,11 +59,11 @@ void SendableBuilderImpl::SetUpdateTable(std::function<void()> func) {
m_updateTable = func;
}
nt::NetworkTableEntry SendableBuilderImpl::GetEntry(const llvm::Twine& key) {
nt::NetworkTableEntry SendableBuilderImpl::GetEntry(const wpi::Twine& key) {
return m_table->GetEntry(key);
}
void SendableBuilderImpl::AddBooleanProperty(const llvm::Twine& key,
void SendableBuilderImpl::AddBooleanProperty(const wpi::Twine& key,
std::function<bool()> getter,
std::function<void(bool)> setter) {
m_properties.emplace_back(*m_table, key);
@@ -87,7 +87,7 @@ void SendableBuilderImpl::AddBooleanProperty(const llvm::Twine& key,
}
void SendableBuilderImpl::AddDoubleProperty(
const llvm::Twine& key, std::function<double()> getter,
const wpi::Twine& key, std::function<double()> getter,
std::function<void(double)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
@@ -110,8 +110,8 @@ void SendableBuilderImpl::AddDoubleProperty(
}
void SendableBuilderImpl::AddStringProperty(
const llvm::Twine& key, std::function<std::string()> getter,
std::function<void(llvm::StringRef)> setter) {
const wpi::Twine& key, std::function<std::string()> getter,
std::function<void(wpi::StringRef)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -133,8 +133,8 @@ void SendableBuilderImpl::AddStringProperty(
}
void SendableBuilderImpl::AddBooleanArrayProperty(
const llvm::Twine& key, std::function<std::vector<int>()> getter,
std::function<void(llvm::ArrayRef<int>)> setter) {
const wpi::Twine& key, std::function<std::vector<int>()> getter,
std::function<void(wpi::ArrayRef<int>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -156,8 +156,8 @@ void SendableBuilderImpl::AddBooleanArrayProperty(
}
void SendableBuilderImpl::AddDoubleArrayProperty(
const llvm::Twine& key, std::function<std::vector<double>()> getter,
std::function<void(llvm::ArrayRef<double>)> setter) {
const wpi::Twine& key, std::function<std::vector<double>()> getter,
std::function<void(wpi::ArrayRef<double>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -179,8 +179,8 @@ void SendableBuilderImpl::AddDoubleArrayProperty(
}
void SendableBuilderImpl::AddStringArrayProperty(
const llvm::Twine& key, std::function<std::vector<std::string>()> getter,
std::function<void(llvm::ArrayRef<std::string>)> setter) {
const wpi::Twine& key, std::function<std::vector<std::string>()> getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -202,8 +202,8 @@ void SendableBuilderImpl::AddStringArrayProperty(
}
void SendableBuilderImpl::AddRawProperty(
const llvm::Twine& key, std::function<std::string()> getter,
std::function<void(llvm::StringRef)> setter) {
const wpi::Twine& key, std::function<std::string()> getter,
std::function<void(wpi::StringRef)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -225,7 +225,7 @@ void SendableBuilderImpl::AddRawProperty(
}
void SendableBuilderImpl::AddValueProperty(
const llvm::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) {
m_properties.emplace_back(*m_table, key);
if (getter) {
@@ -245,14 +245,14 @@ void SendableBuilderImpl::AddValueProperty(
}
void SendableBuilderImpl::AddSmallStringProperty(
const llvm::Twine& key,
std::function<llvm::StringRef(llvm::SmallVectorImpl<char>& buf)> getter,
std::function<void(llvm::StringRef)> setter) {
const wpi::Twine& key,
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
std::function<void(wpi::StringRef)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
uint64_t time) {
llvm::SmallString<128> buf;
wpi::SmallString<128> buf;
entry.SetValue(nt::Value::MakeString(getter(buf), time));
};
}
@@ -270,14 +270,14 @@ void SendableBuilderImpl::AddSmallStringProperty(
}
void SendableBuilderImpl::AddSmallBooleanArrayProperty(
const llvm::Twine& key,
std::function<llvm::ArrayRef<int>(llvm::SmallVectorImpl<int>& buf)> getter,
std::function<void(llvm::ArrayRef<int>)> setter) {
const wpi::Twine& key,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)> getter,
std::function<void(wpi::ArrayRef<int>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
uint64_t time) {
llvm::SmallVector<int, 16> buf;
wpi::SmallVector<int, 16> buf;
entry.SetValue(nt::Value::MakeBooleanArray(getter(buf), time));
};
}
@@ -295,15 +295,15 @@ void SendableBuilderImpl::AddSmallBooleanArrayProperty(
}
void SendableBuilderImpl::AddSmallDoubleArrayProperty(
const llvm::Twine& key,
std::function<llvm::ArrayRef<double>(llvm::SmallVectorImpl<double>& buf)>
const wpi::Twine& key,
std::function<wpi::ArrayRef<double>(wpi::SmallVectorImpl<double>& buf)>
getter,
std::function<void(llvm::ArrayRef<double>)> setter) {
std::function<void(wpi::ArrayRef<double>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
uint64_t time) {
llvm::SmallVector<double, 16> buf;
wpi::SmallVector<double, 16> buf;
entry.SetValue(nt::Value::MakeDoubleArray(getter(buf), time));
};
}
@@ -321,16 +321,16 @@ void SendableBuilderImpl::AddSmallDoubleArrayProperty(
}
void SendableBuilderImpl::AddSmallStringArrayProperty(
const llvm::Twine& key,
const wpi::Twine& key,
std::function<
llvm::ArrayRef<std::string>(llvm::SmallVectorImpl<std::string>& buf)>
wpi::ArrayRef<std::string>(wpi::SmallVectorImpl<std::string>& buf)>
getter,
std::function<void(llvm::ArrayRef<std::string>)> setter) {
std::function<void(wpi::ArrayRef<std::string>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
uint64_t time) {
llvm::SmallVector<std::string, 16> buf;
wpi::SmallVector<std::string, 16> buf;
entry.SetValue(nt::Value::MakeStringArray(getter(buf), time));
};
}
@@ -348,14 +348,14 @@ void SendableBuilderImpl::AddSmallStringArrayProperty(
}
void SendableBuilderImpl::AddSmallRawProperty(
const llvm::Twine& key,
std::function<llvm::StringRef(llvm::SmallVectorImpl<char>& buf)> getter,
std::function<void(llvm::StringRef)> setter) {
const wpi::Twine& key,
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
std::function<void(wpi::StringRef)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
uint64_t time) {
llvm::SmallVector<char, 128> buf;
wpi::SmallVector<char, 128> buf;
entry.SetValue(nt::Value::MakeRaw(getter(buf), time));
};
}

View File

@@ -7,10 +7,10 @@
#include "SmartDashboard/SmartDashboard.h"
#include <llvm/StringMap.h>
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableInstance.h>
#include <support/mutex.h>
#include <wpi/StringMap.h>
#include <wpi/mutex.h>
#include "HLUsageReporting.h"
#include "SmartDashboard/Sendable.h"
@@ -34,7 +34,7 @@ class Singleton {
static Singleton& GetInstance();
std::shared_ptr<nt::NetworkTable> table;
llvm::StringMap<SmartDashboardData> tablesToData;
wpi::StringMap<SmartDashboardData> tablesToData;
wpi::mutex tablesToDataMutex;
private:
@@ -61,7 +61,7 @@ void SmartDashboard::init() { Singleton::GetInstance(); }
* @param key the key to search for
* @return true if the table as a value assigned to the given key
*/
bool SmartDashboard::ContainsKey(llvm::StringRef key) {
bool SmartDashboard::ContainsKey(wpi::StringRef key) {
return Singleton::GetInstance().table->ContainsKey(key);
}
@@ -78,7 +78,7 @@ std::vector<std::string> SmartDashboard::GetKeys(int types) {
*
* @param key the key to make persistent
*/
void SmartDashboard::SetPersistent(llvm::StringRef key) {
void SmartDashboard::SetPersistent(wpi::StringRef key) {
Singleton::GetInstance().table->GetEntry(key).SetPersistent();
}
@@ -88,7 +88,7 @@ void SmartDashboard::SetPersistent(llvm::StringRef key) {
*
* @param key the key name
*/
void SmartDashboard::ClearPersistent(llvm::StringRef key) {
void SmartDashboard::ClearPersistent(wpi::StringRef key) {
Singleton::GetInstance().table->GetEntry(key).ClearPersistent();
}
@@ -98,7 +98,7 @@ void SmartDashboard::ClearPersistent(llvm::StringRef key) {
*
* @param key the key name
*/
bool SmartDashboard::IsPersistent(llvm::StringRef key) {
bool SmartDashboard::IsPersistent(wpi::StringRef key) {
return Singleton::GetInstance().table->GetEntry(key).IsPersistent();
}
@@ -109,7 +109,7 @@ bool SmartDashboard::IsPersistent(llvm::StringRef key) {
* @param key the key name
* @param flags the flags to set (bitmask)
*/
void SmartDashboard::SetFlags(llvm::StringRef key, unsigned int flags) {
void SmartDashboard::SetFlags(wpi::StringRef key, unsigned int flags) {
Singleton::GetInstance().table->GetEntry(key).SetFlags(flags);
}
@@ -120,7 +120,7 @@ void SmartDashboard::SetFlags(llvm::StringRef key, unsigned int flags) {
* @param key the key name
* @param flags the flags to clear (bitmask)
*/
void SmartDashboard::ClearFlags(llvm::StringRef key, unsigned int flags) {
void SmartDashboard::ClearFlags(wpi::StringRef key, unsigned int flags) {
Singleton::GetInstance().table->GetEntry(key).ClearFlags(flags);
}
@@ -130,7 +130,7 @@ void SmartDashboard::ClearFlags(llvm::StringRef key, unsigned int flags) {
* @param key the key name
* @return the flags, or 0 if the key is not defined
*/
unsigned int SmartDashboard::GetFlags(llvm::StringRef key) {
unsigned int SmartDashboard::GetFlags(wpi::StringRef key) {
return Singleton::GetInstance().table->GetEntry(key).GetFlags();
}
@@ -139,7 +139,7 @@ unsigned int SmartDashboard::GetFlags(llvm::StringRef key) {
*
* @param key the key name
*/
void SmartDashboard::Delete(llvm::StringRef key) {
void SmartDashboard::Delete(wpi::StringRef key) {
Singleton::GetInstance().table->Delete(key);
}
@@ -152,7 +152,7 @@ void SmartDashboard::Delete(llvm::StringRef key) {
* @param keyName the key
* @param value the value
*/
void SmartDashboard::PutData(llvm::StringRef key, Sendable* data) {
void SmartDashboard::PutData(wpi::StringRef key, Sendable* data) {
if (data == nullptr) {
wpi_setGlobalWPIErrorWithContext(NullParameter, "value");
return;
@@ -194,7 +194,7 @@ void SmartDashboard::PutData(Sendable* value) {
* @param keyName the key
* @return the value
*/
Sendable* SmartDashboard::GetData(llvm::StringRef key) {
Sendable* SmartDashboard::GetData(wpi::StringRef key) {
auto& inst = Singleton::GetInstance();
std::lock_guard<wpi::mutex> lock(inst.tablesToDataMutex);
auto data = inst.tablesToData.find(key);
@@ -216,7 +216,7 @@ Sendable* SmartDashboard::GetData(llvm::StringRef key) {
* @param value the value
* @return False if the table key already exists with a different type
*/
bool SmartDashboard::PutValue(llvm::StringRef keyName,
bool SmartDashboard::PutValue(wpi::StringRef keyName,
std::shared_ptr<nt::Value> value) {
return Singleton::GetInstance().table->GetEntry(keyName).SetValue(value);
}
@@ -228,7 +228,7 @@ bool SmartDashboard::PutValue(llvm::StringRef keyName,
* @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::SetDefaultValue(llvm::StringRef key,
bool SmartDashboard::SetDefaultValue(wpi::StringRef key,
std::shared_ptr<nt::Value> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultValue(
defaultValue);
@@ -241,7 +241,7 @@ bool SmartDashboard::SetDefaultValue(llvm::StringRef key,
* @param keyName the key
* @param value the object to retrieve the value into
*/
std::shared_ptr<nt::Value> SmartDashboard::GetValue(llvm::StringRef keyName) {
std::shared_ptr<nt::Value> SmartDashboard::GetValue(wpi::StringRef keyName) {
return Singleton::GetInstance().table->GetEntry(keyName).GetValue();
}
@@ -255,7 +255,7 @@ std::shared_ptr<nt::Value> SmartDashboard::GetValue(llvm::StringRef keyName) {
* @param value the value
* @return False if the table key already exists with a different type
*/
bool SmartDashboard::PutBoolean(llvm::StringRef keyName, bool value) {
bool SmartDashboard::PutBoolean(wpi::StringRef keyName, bool value) {
return Singleton::GetInstance().table->GetEntry(keyName).SetBoolean(value);
}
@@ -265,7 +265,7 @@ bool SmartDashboard::PutBoolean(llvm::StringRef keyName, bool 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::SetDefaultBoolean(llvm::StringRef key, bool defaultValue) {
bool SmartDashboard::SetDefaultBoolean(wpi::StringRef key, bool defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultBoolean(
defaultValue);
}
@@ -278,7 +278,7 @@ bool SmartDashboard::SetDefaultBoolean(llvm::StringRef key, bool defaultValue) {
* @param keyName the key
* @return the value
*/
bool SmartDashboard::GetBoolean(llvm::StringRef keyName, bool defaultValue) {
bool SmartDashboard::GetBoolean(wpi::StringRef keyName, bool defaultValue) {
return Singleton::GetInstance().table->GetEntry(keyName).GetBoolean(
defaultValue);
}
@@ -293,7 +293,7 @@ bool SmartDashboard::GetBoolean(llvm::StringRef keyName, bool defaultValue) {
* @param value the value
* @return False if the table key already exists with a different type
*/
bool SmartDashboard::PutNumber(llvm::StringRef keyName, double value) {
bool SmartDashboard::PutNumber(wpi::StringRef keyName, double value) {
return Singleton::GetInstance().table->GetEntry(keyName).SetDouble(value);
}
@@ -304,7 +304,7 @@ bool SmartDashboard::PutNumber(llvm::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(llvm::StringRef key,
bool SmartDashboard::SetDefaultNumber(wpi::StringRef key,
double defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultDouble(
defaultValue);
@@ -318,7 +318,7 @@ bool SmartDashboard::SetDefaultNumber(llvm::StringRef key,
* @param keyName the key
* @return the value
*/
double SmartDashboard::GetNumber(llvm::StringRef keyName, double defaultValue) {
double SmartDashboard::GetNumber(wpi::StringRef keyName, double defaultValue) {
return Singleton::GetInstance().table->GetEntry(keyName).GetDouble(
defaultValue);
}
@@ -333,7 +333,7 @@ double SmartDashboard::GetNumber(llvm::StringRef keyName, double defaultValue) {
* @param value the value
* @return False if the table key already exists with a different type
*/
bool SmartDashboard::PutString(llvm::StringRef keyName, llvm::StringRef value) {
bool SmartDashboard::PutString(wpi::StringRef keyName, wpi::StringRef value) {
return Singleton::GetInstance().table->GetEntry(keyName).SetString(value);
}
@@ -343,8 +343,8 @@ bool SmartDashboard::PutString(llvm::StringRef keyName, llvm::StringRef 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::SetDefaultString(llvm::StringRef key,
llvm::StringRef defaultValue) {
bool SmartDashboard::SetDefaultString(wpi::StringRef key,
wpi::StringRef defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultString(
defaultValue);
}
@@ -357,8 +357,8 @@ bool SmartDashboard::SetDefaultString(llvm::StringRef key,
* @param keyName the key
* @return the value
*/
std::string SmartDashboard::GetString(llvm::StringRef keyName,
llvm::StringRef defaultValue) {
std::string SmartDashboard::GetString(wpi::StringRef keyName,
wpi::StringRef defaultValue) {
return Singleton::GetInstance().table->GetEntry(keyName).GetString(
defaultValue);
}
@@ -374,8 +374,8 @@ std::string SmartDashboard::GetString(llvm::StringRef keyName,
* std::vector<bool> is special-cased in C++. 0 is false, any
* non-zero value is true.
*/
bool SmartDashboard::PutBooleanArray(llvm::StringRef key,
llvm::ArrayRef<int> value) {
bool SmartDashboard::PutBooleanArray(wpi::StringRef key,
wpi::ArrayRef<int> value) {
return Singleton::GetInstance().table->GetEntry(key).SetBooleanArray(value);
}
@@ -386,8 +386,8 @@ bool SmartDashboard::PutBooleanArray(llvm::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::SetDefaultBooleanArray(llvm::StringRef key,
llvm::ArrayRef<int> defaultValue) {
bool SmartDashboard::SetDefaultBooleanArray(wpi::StringRef key,
wpi::ArrayRef<int> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultBooleanArray(
defaultValue);
}
@@ -411,7 +411,7 @@ bool SmartDashboard::SetDefaultBooleanArray(llvm::StringRef key,
* non-zero value is true.
*/
std::vector<int> SmartDashboard::GetBooleanArray(
llvm::StringRef key, llvm::ArrayRef<int> defaultValue) {
wpi::StringRef key, wpi::ArrayRef<int> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).GetBooleanArray(
defaultValue);
}
@@ -423,8 +423,8 @@ std::vector<int> SmartDashboard::GetBooleanArray(
* @param value The value that will be assigned.
* @return False if the table key already exists with a different type
*/
bool SmartDashboard::PutNumberArray(llvm::StringRef key,
llvm::ArrayRef<double> value) {
bool SmartDashboard::PutNumberArray(wpi::StringRef key,
wpi::ArrayRef<double> value) {
return Singleton::GetInstance().table->GetEntry(key).SetDoubleArray(value);
}
@@ -436,7 +436,7 @@ bool SmartDashboard::PutNumberArray(llvm::StringRef key,
* @returns False if the table key exists with a different type
*/
bool SmartDashboard::SetDefaultNumberArray(
llvm::StringRef key, llvm::ArrayRef<double> defaultValue) {
wpi::StringRef key, wpi::ArrayRef<double> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultDoubleArray(
defaultValue);
}
@@ -456,7 +456,7 @@ bool SmartDashboard::SetDefaultNumberArray(
* use GetValue() instead.
*/
std::vector<double> SmartDashboard::GetNumberArray(
llvm::StringRef key, llvm::ArrayRef<double> defaultValue) {
wpi::StringRef key, wpi::ArrayRef<double> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).GetDoubleArray(
defaultValue);
}
@@ -468,8 +468,8 @@ std::vector<double> SmartDashboard::GetNumberArray(
* @param value The value that will be assigned.
* @return False if the table key already exists with a different type
*/
bool SmartDashboard::PutStringArray(llvm::StringRef key,
llvm::ArrayRef<std::string> value) {
bool SmartDashboard::PutStringArray(wpi::StringRef key,
wpi::ArrayRef<std::string> value) {
return Singleton::GetInstance().table->GetEntry(key).SetStringArray(value);
}
@@ -481,7 +481,7 @@ bool SmartDashboard::PutStringArray(llvm::StringRef key,
* @returns False if the table key exists with a different type
*/
bool SmartDashboard::SetDefaultStringArray(
llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) {
wpi::StringRef key, wpi::ArrayRef<std::string> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultStringArray(
defaultValue);
}
@@ -501,7 +501,7 @@ bool SmartDashboard::SetDefaultStringArray(
* use GetValue() instead.
*/
std::vector<std::string> SmartDashboard::GetStringArray(
llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) {
wpi::StringRef key, wpi::ArrayRef<std::string> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).GetStringArray(
defaultValue);
}
@@ -513,7 +513,7 @@ std::vector<std::string> SmartDashboard::GetStringArray(
* @param value The value that will be assigned.
* @return False if the table key already exists with a different type
*/
bool SmartDashboard::PutRaw(llvm::StringRef key, llvm::StringRef value) {
bool SmartDashboard::PutRaw(wpi::StringRef key, wpi::StringRef value) {
return Singleton::GetInstance().table->GetEntry(key).SetRaw(value);
}
@@ -524,8 +524,8 @@ bool SmartDashboard::PutRaw(llvm::StringRef key, llvm::StringRef 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::SetDefaultRaw(llvm::StringRef key,
llvm::StringRef defaultValue) {
bool SmartDashboard::SetDefaultRaw(wpi::StringRef key,
wpi::StringRef defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultRaw(
defaultValue);
}
@@ -544,8 +544,8 @@ bool SmartDashboard::SetDefaultRaw(llvm::StringRef key,
* @note This makes a copy of the raw contents. If the overhead of this is a
* concern, use GetValue() instead.
*/
std::string SmartDashboard::GetRaw(llvm::StringRef key,
llvm::StringRef defaultValue) {
std::string SmartDashboard::GetRaw(wpi::StringRef key,
wpi::StringRef defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).GetRaw(defaultValue);
}

View File

@@ -36,12 +36,12 @@ Solenoid::Solenoid(int moduleNumber, int channel)
if (!SensorBase::CheckSolenoidModule(m_moduleNumber)) {
wpi_setWPIErrorWithContext(
ModuleIndexOutOfRange,
"Solenoid Module " + llvm::Twine(m_moduleNumber));
"Solenoid Module " + wpi::Twine(m_moduleNumber));
return;
}
if (!SensorBase::CheckSolenoidChannel(m_channel)) {
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
"Solenoid Channel " + llvm::Twine(m_channel));
"Solenoid Channel " + wpi::Twine(m_channel));
return;
}

View File

@@ -16,13 +16,13 @@
#include <cstdlib>
#include <cstring>
#include <llvm/Path.h>
#include <wpi/Path.h>
#include <wpi/SmallString.h>
#include <wpi/raw_ostream.h>
#include "ErrorBase.h"
#include "HAL/DriverStation.h"
#include "HAL/HAL.h"
#include "llvm/SmallString.h"
#include "llvm/raw_ostream.h"
using namespace frc;
@@ -32,17 +32,17 @@ using namespace frc;
* This allows breakpoints to be set on an assert. The users don't call this,
* but instead use the wpi_assert macros in Utility.h.
*/
bool wpi_assert_impl(bool conditionValue, const llvm::Twine& conditionText,
const llvm::Twine& message, llvm::StringRef fileName,
int lineNumber, llvm::StringRef funcName) {
bool wpi_assert_impl(bool conditionValue, const wpi::Twine& conditionText,
const wpi::Twine& message, wpi::StringRef fileName,
int lineNumber, wpi::StringRef funcName) {
if (!conditionValue) {
llvm::SmallString<128> locBuf;
llvm::raw_svector_ostream locStream(locBuf);
locStream << funcName << " [" << llvm::sys::path::filename(fileName) << ":"
wpi::SmallString<128> locBuf;
wpi::raw_svector_ostream locStream(locBuf);
locStream << funcName << " [" << wpi::sys::path::filename(fileName) << ":"
<< lineNumber << "]";
llvm::SmallString<128> errorBuf;
llvm::raw_svector_ostream errorStream(errorBuf);
wpi::SmallString<128> errorBuf;
wpi::raw_svector_ostream errorStream(errorBuf);
errorStream << "Assertion \"" << conditionText << "\" ";
@@ -68,19 +68,19 @@ bool wpi_assert_impl(bool conditionValue, const llvm::Twine& conditionText,
* This should not be called directly; it should only be used by
* wpi_assertEqual_impl and wpi_assertNotEqual_impl.
*/
void wpi_assertEqual_common_impl(const llvm::Twine& valueA,
const llvm::Twine& valueB,
const llvm::Twine& equalityType,
const llvm::Twine& message,
llvm::StringRef fileName, int lineNumber,
llvm::StringRef funcName) {
llvm::SmallString<128> locBuf;
llvm::raw_svector_ostream locStream(locBuf);
locStream << funcName << " [" << llvm::sys::path::filename(fileName) << ":"
void wpi_assertEqual_common_impl(const wpi::Twine& valueA,
const wpi::Twine& valueB,
const wpi::Twine& equalityType,
const wpi::Twine& message,
wpi::StringRef fileName, int lineNumber,
wpi::StringRef funcName) {
wpi::SmallString<128> locBuf;
wpi::raw_svector_ostream locStream(locBuf);
locStream << funcName << " [" << wpi::sys::path::filename(fileName) << ":"
<< lineNumber << "]";
llvm::SmallString<128> errorBuf;
llvm::raw_svector_ostream errorStream(errorBuf);
wpi::SmallString<128> errorBuf;
wpi::raw_svector_ostream errorStream(errorBuf);
errorStream << "Assertion \"" << valueA << " " << equalityType << " "
<< valueB << "\" ";
@@ -106,10 +106,10 @@ void wpi_assertEqual_common_impl(const llvm::Twine& valueA,
* call this, but instead use the wpi_assertEqual macros in Utility.h.
*/
bool wpi_assertEqual_impl(int valueA, int valueB,
const llvm::Twine& valueAString,
const llvm::Twine& valueBString,
const llvm::Twine& message, llvm::StringRef fileName,
int lineNumber, llvm::StringRef funcName) {
const wpi::Twine& valueAString,
const wpi::Twine& valueBString,
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);
@@ -125,11 +125,11 @@ bool wpi_assertEqual_impl(int valueA, int valueB,
* this, but instead use the wpi_assertNotEqual macros in Utility.h.
*/
bool wpi_assertNotEqual_impl(int valueA, int valueB,
const llvm::Twine& valueAString,
const llvm::Twine& valueBString,
const llvm::Twine& message,
llvm::StringRef fileName, int lineNumber,
llvm::StringRef funcName) {
const wpi::Twine& valueAString,
const wpi::Twine& valueBString,
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);
@@ -234,8 +234,8 @@ std::string GetStackTrace(int offset) {
void* stackTrace[128];
int stackSize = backtrace(stackTrace, 128);
char** mangledSymbols = backtrace_symbols(stackTrace, stackSize);
llvm::SmallString<1024> buf;
llvm::raw_svector_ostream trace(buf);
wpi::SmallString<1024> buf;
wpi::raw_svector_ostream trace(buf);
for (int i = offset; i < stackSize; i++) {
// Only print recursive functions once in a row.

View File

@@ -9,9 +9,9 @@
#include <memory>
#include <llvm/Twine.h>
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableEntry.h>
#include <wpi/Twine.h>
#include "Buttons/Button.h"
@@ -19,9 +19,9 @@ namespace frc {
class NetworkButton : public Button {
public:
NetworkButton(const llvm::Twine& tableName, const llvm::Twine& field);
NetworkButton(const wpi::Twine& tableName, const wpi::Twine& field);
NetworkButton(std::shared_ptr<nt::NetworkTable> table,
const llvm::Twine& field);
const wpi::Twine& field);
virtual ~NetworkButton() = default;
virtual bool Get();

View File

@@ -11,7 +11,7 @@
#include <set>
#include <string>
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "ErrorBase.h"
#include "SmartDashboard/SendableBase.h"
@@ -51,9 +51,9 @@ class Command : public ErrorBase, public SendableBase {
public:
Command();
explicit Command(const llvm::Twine& name);
explicit Command(const wpi::Twine& name);
explicit Command(double timeout);
Command(const llvm::Twine& name, double timeout);
Command(const wpi::Twine& name, double timeout);
~Command() override = default;
double TimeSinceInitialized() const;
void Requires(Subsystem* s);

View File

@@ -10,7 +10,7 @@
#include <list>
#include <vector>
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/Command.h"
#include "Commands/CommandGroupEntry.h"
@@ -37,7 +37,7 @@ namespace frc {
class CommandGroup : public Command {
public:
CommandGroup() = default;
explicit CommandGroup(const llvm::Twine& name);
explicit CommandGroup(const wpi::Twine& name);
virtual ~CommandGroup() = default;
void AddSequential(Command* command);

View File

@@ -7,7 +7,7 @@
#pragma once
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/Command.h"
@@ -35,7 +35,7 @@ namespace frc {
class ConditionalCommand : public Command {
public:
explicit ConditionalCommand(Command* onTrue, Command* onFalse = nullptr);
ConditionalCommand(const llvm::Twine& name, Command* onTrue,
ConditionalCommand(const wpi::Twine& name, Command* onTrue,
Command* onFalse = nullptr);
virtual ~ConditionalCommand() = default;

View File

@@ -7,7 +7,7 @@
#pragma once
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/Command.h"
@@ -20,7 +20,7 @@ namespace frc {
*/
class InstantCommand : public Command {
public:
explicit InstantCommand(const llvm::Twine& name);
explicit InstantCommand(const wpi::Twine& name);
InstantCommand() = default;
virtual ~InstantCommand() = default;

View File

@@ -9,7 +9,7 @@
#include <memory>
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/Command.h"
#include "PIDController.h"
@@ -20,10 +20,10 @@ namespace frc {
class PIDCommand : public Command, public PIDOutput, public PIDSource {
public:
PIDCommand(const llvm::Twine& name, double p, double i, double d);
PIDCommand(const llvm::Twine& name, double p, double i, double d,
PIDCommand(const wpi::Twine& name, double p, double i, double d);
PIDCommand(const wpi::Twine& name, double p, double i, double d,
double period);
PIDCommand(const llvm::Twine& name, double p, double i, double d, double f,
PIDCommand(const wpi::Twine& name, double p, double i, double d, double f,
double period);
PIDCommand(double p, double i, double d);
PIDCommand(double p, double i, double d, double period);

View File

@@ -9,7 +9,7 @@
#include <memory>
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/Subsystem.h"
#include "PIDController.h"
@@ -29,9 +29,9 @@ namespace frc {
*/
class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource {
public:
PIDSubsystem(const llvm::Twine& name, double p, double i, double d);
PIDSubsystem(const llvm::Twine& name, double p, double i, double d, double f);
PIDSubsystem(const llvm::Twine& name, double p, double i, double d, double f,
PIDSubsystem(const wpi::Twine& name, double p, double i, double d);
PIDSubsystem(const wpi::Twine& name, double p, double i, double d, double f);
PIDSubsystem(const wpi::Twine& name, double p, double i, double d, double f,
double period);
PIDSubsystem(double p, double i, double d);
PIDSubsystem(double p, double i, double d, double f);

View File

@@ -9,7 +9,7 @@
#include <string>
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/InstantCommand.h"
@@ -17,7 +17,7 @@ namespace frc {
class PrintCommand : public InstantCommand {
public:
explicit PrintCommand(const llvm::Twine& message);
explicit PrintCommand(const wpi::Twine& message);
virtual ~PrintCommand() = default;
protected:

View File

@@ -13,7 +13,7 @@
#include <vector>
#include <networktables/NetworkTableEntry.h>
#include <support/mutex.h>
#include <wpi/mutex.h>
#include "Commands/Command.h"
#include "ErrorBase.h"

View File

@@ -9,8 +9,8 @@
#include <memory>
#include <llvm/StringRef.h>
#include <llvm/Twine.h>
#include <wpi/StringRef.h>
#include <wpi/Twine.h>
#include "ErrorBase.h"
#include "SmartDashboard/Sendable.h"
@@ -24,20 +24,20 @@ class Subsystem : public ErrorBase, public SendableBase {
friend class Scheduler;
public:
explicit Subsystem(const llvm::Twine& name);
explicit Subsystem(const wpi::Twine& name);
void SetDefaultCommand(Command* command);
Command* GetDefaultCommand();
llvm::StringRef GetDefaultCommandName();
wpi::StringRef GetDefaultCommandName();
void SetCurrentCommand(Command* command);
Command* GetCurrentCommand() const;
llvm::StringRef GetCurrentCommandName() const;
wpi::StringRef GetCurrentCommandName() const;
virtual void Periodic();
virtual void InitDefaultCommand();
void AddChild(const llvm::Twine& name, std::shared_ptr<Sendable> child);
void AddChild(const llvm::Twine& name, Sendable* child);
void AddChild(const llvm::Twine& name, Sendable& child);
void AddChild(const wpi::Twine& name, std::shared_ptr<Sendable> child);
void AddChild(const wpi::Twine& name, Sendable* child);
void AddChild(const wpi::Twine& name, Sendable& child);
void AddChild(std::shared_ptr<Sendable> child);
void AddChild(Sendable* child);
void AddChild(Sendable& child);

View File

@@ -7,7 +7,7 @@
#pragma once
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/Command.h"
@@ -20,7 +20,7 @@ namespace frc {
*/
class TimedCommand : public Command {
public:
TimedCommand(const llvm::Twine& name, double timeout);
TimedCommand(const wpi::Twine& name, double timeout);
explicit TimedCommand(double timeout);
virtual ~TimedCommand() = default;

View File

@@ -7,7 +7,7 @@
#pragma once
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/TimedCommand.h"
@@ -16,7 +16,7 @@ namespace frc {
class WaitCommand : public TimedCommand {
public:
explicit WaitCommand(double timeout);
WaitCommand(const llvm::Twine& name, double timeout);
WaitCommand(const wpi::Twine& name, double timeout);
virtual ~WaitCommand() = default;
};

View File

@@ -7,7 +7,7 @@
#pragma once
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/Command.h"
@@ -16,7 +16,7 @@ namespace frc {
class WaitForChildren : public Command {
public:
explicit WaitForChildren(double timeout);
WaitForChildren(const llvm::Twine& name, double timeout);
WaitForChildren(const wpi::Twine& name, double timeout);
virtual ~WaitForChildren() = default;
protected:

View File

@@ -7,7 +7,7 @@
#pragma once
#include <llvm/Twine.h>
#include <wpi/Twine.h>
#include "Commands/Command.h"
@@ -16,7 +16,7 @@ namespace frc {
class WaitUntilCommand : public Command {
public:
explicit WaitUntilCommand(double time);
WaitUntilCommand(const llvm::Twine& name, double time);
WaitUntilCommand(const wpi::Twine& name, double time);
virtual ~WaitUntilCommand() = default;
protected:

View File

@@ -7,7 +7,7 @@
#pragma once
#include <support/deprecated.h>
#include <wpi/deprecated.h>
namespace frc {

View File

@@ -11,7 +11,7 @@
#include <array>
#include <support/mutex.h>
#include <wpi/mutex.h>
#include "DigitalSource.h"
#include "SensorBase.h"

View File

@@ -7,7 +7,7 @@
#pragma once
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
#include "Drive/RobotDriveBase.h"
@@ -116,7 +116,7 @@ class DifferentialDrive : public RobotDriveBase {
void SetQuickStopAlpha(double alpha);
void StopMotor() override;
void GetDescription(llvm::raw_ostream& desc) const override;
void GetDescription(wpi::raw_ostream& desc) const override;
void InitSendable(SendableBuilder& builder) override;

View File

@@ -9,7 +9,7 @@
#include <memory>
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
#include "Drive/RobotDriveBase.h"
#include "Drive/Vector2d.h"
@@ -65,7 +65,7 @@ class KilloughDrive : public RobotDriveBase {
void DrivePolar(double magnitude, double angle, double zRotation);
void StopMotor() override;
void GetDescription(llvm::raw_ostream& desc) const override;
void GetDescription(wpi::raw_ostream& desc) const override;
void InitSendable(SendableBuilder& builder) override;

View File

@@ -9,7 +9,7 @@
#include <memory>
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
#include "Drive/RobotDriveBase.h"
@@ -77,7 +77,7 @@ class MecanumDrive : public RobotDriveBase {
void DrivePolar(double magnitude, double angle, double rotation);
void StopMotor() override;
void GetDescription(llvm::raw_ostream& desc) const override;
void GetDescription(wpi::raw_ostream& desc) const override;
void InitSendable(SendableBuilder& builder) override;

View File

@@ -9,8 +9,8 @@
#include <memory>
#include <llvm/ArrayRef.h>
#include <llvm/raw_ostream.h>
#include <wpi/ArrayRef.h>
#include <wpi/raw_ostream.h>
#include "MotorSafety.h"
#include "MotorSafetyHelper.h"
@@ -53,12 +53,12 @@ class RobotDriveBase : public MotorSafety, public SendableBase {
void StopMotor() override = 0;
bool IsSafetyEnabled() const override;
void SetSafetyEnabled(bool enabled) override;
void GetDescription(llvm::raw_ostream& desc) const override = 0;
void GetDescription(wpi::raw_ostream& desc) const override = 0;
protected:
double Limit(double number);
double ApplyDeadband(double number, double deadband);
void Normalize(llvm::MutableArrayRef<double> wheelSpeeds);
void Normalize(wpi::MutableArrayRef<double> wheelSpeeds);
double m_deadband = 0.02;
double m_maxOutput = 1.0;

View File

@@ -14,10 +14,10 @@
#include <thread>
#include <HAL/DriverStation.h>
#include <llvm/Twine.h>
#include <support/condition_variable.h>
#include <support/deprecated.h>
#include <support/mutex.h>
#include <wpi/Twine.h>
#include <wpi/condition_variable.h>
#include <wpi/deprecated.h>
#include <wpi/mutex.h>
#include "ErrorBase.h"
#include "RobotState.h"
@@ -38,11 +38,11 @@ class DriverStation : public ErrorBase, public RobotStateInterface {
~DriverStation() override;
static DriverStation& GetInstance();
static void ReportError(const llvm::Twine& error);
static void ReportWarning(const llvm::Twine& error);
static void ReportError(bool isError, int code, const llvm::Twine& error,
const llvm::Twine& location,
const llvm::Twine& stack);
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);
static constexpr int kJoystickPorts = 6;
@@ -130,8 +130,8 @@ class DriverStation : public ErrorBase, public RobotStateInterface {
private:
DriverStation();
void ReportJoystickUnpluggedError(const llvm::Twine& message);
void ReportJoystickUnpluggedWarning(const llvm::Twine& message);
void ReportJoystickUnpluggedError(const wpi::Twine& message);
void ReportJoystickUnpluggedWarning(const wpi::Twine& message);
void Run();
void UpdateControlWord(bool force, HAL_ControlWord& controlWord) const;
void SendMatchData();

View File

@@ -11,8 +11,8 @@
#include <string>
#include <llvm/StringRef.h>
#include <llvm/Twine.h>
#include <wpi/StringRef.h>
#include <wpi/Twine.h>
#ifdef _WIN32
#include <Windows.h>
@@ -47,8 +47,8 @@ class Error {
const ErrorBase* GetOriginatingObject() const;
double GetTimestamp() const;
void Clear();
void Set(Code code, const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::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

@@ -7,9 +7,9 @@
#pragma once
#include <llvm/StringRef.h>
#include <llvm/Twine.h>
#include <support/mutex.h>
#include <wpi/StringRef.h>
#include <wpi/Twine.h>
#include <wpi/mutex.h>
#include "Base.h"
#include "Error.h"
@@ -82,35 +82,35 @@ class ErrorBase {
virtual Error& GetError();
virtual const Error& GetError() const;
virtual void SetErrnoError(const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
virtual void SetErrnoError(const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const;
virtual void SetImaqError(int success, const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
virtual void SetImaqError(int success, const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const;
virtual void SetError(Error::Code code, const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
virtual void SetError(Error::Code code, const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const;
virtual void SetErrorRange(Error::Code code, int32_t minRange,
int32_t maxRange, int32_t requestedValue,
const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const;
virtual void SetWPIError(const llvm::Twine& errorMessage, Error::Code code,
const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
virtual void SetWPIError(const wpi::Twine& errorMessage, Error::Code code,
const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber) const;
virtual void CloneError(const ErrorBase& rhs) const;
virtual void ClearError() const;
virtual bool StatusIsFatal() const;
static void SetGlobalError(Error::Code code,
const llvm::Twine& contextMessage,
llvm::StringRef filename, llvm::StringRef function,
const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function,
int lineNumber);
static void SetGlobalWPIError(const llvm::Twine& errorMessage,
const llvm::Twine& contextMessage,
llvm::StringRef filename,
llvm::StringRef function, int lineNumber);
static void SetGlobalWPIError(const wpi::Twine& errorMessage,
const wpi::Twine& contextMessage,
wpi::StringRef filename,
wpi::StringRef function, int lineNumber);
static Error& GetGlobalError();
protected:

View File

@@ -10,7 +10,7 @@
#include <memory>
#include <vector>
#include <llvm/ArrayRef.h>
#include <wpi/ArrayRef.h>
#include "Filter.h"
#include "circular_buffer.h"
@@ -69,11 +69,11 @@ namespace frc {
*/
class LinearDigitalFilter : public Filter {
public:
LinearDigitalFilter(PIDSource& source, llvm::ArrayRef<double> ffGains,
llvm::ArrayRef<double> fbGains);
LinearDigitalFilter(PIDSource& source, wpi::ArrayRef<double> ffGains,
wpi::ArrayRef<double> fbGains);
LinearDigitalFilter(std::shared_ptr<PIDSource> source,
llvm::ArrayRef<double> ffGains,
llvm::ArrayRef<double> fbGains);
wpi::ArrayRef<double> ffGains,
wpi::ArrayRef<double> fbGains);
// Static methods to create commonly used filters
static LinearDigitalFilter SinglePoleIIR(PIDSource& source,

View File

@@ -7,7 +7,7 @@
#pragma once
#include <support/deprecated.h>
#include <wpi/deprecated.h>
#include "GenericHID.h"

View File

@@ -9,7 +9,7 @@
#include <array>
#include <support/deprecated.h>
#include <wpi/deprecated.h>
#include "GenericHID.h"

View File

@@ -7,7 +7,7 @@
#pragma once
#include <support/deprecated.h>
#include <wpi/deprecated.h>
#include "GenericHID.h"

View File

@@ -9,8 +9,8 @@
#include <memory>
#include <llvm/Twine.h>
#include <support/deprecated.h>
#include <wpi/Twine.h>
#include <wpi/deprecated.h>
#include "SmartDashboard/Sendable.h"
@@ -31,30 +31,30 @@ class LiveWindow {
void Run() { UpdateValues(); }
WPI_DEPRECATED("use Sendable::SetName() instead")
void AddSensor(const llvm::Twine& subsystem, const llvm::Twine& name,
void AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name,
Sendable* component);
WPI_DEPRECATED("use Sendable::SetName() instead")
void AddSensor(const llvm::Twine& subsystem, const llvm::Twine& name,
void AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name,
Sendable& component);
WPI_DEPRECATED("use Sendable::SetName() instead")
void AddSensor(const llvm::Twine& subsystem, const llvm::Twine& name,
void AddSensor(const wpi::Twine& subsystem, const wpi::Twine& name,
std::shared_ptr<Sendable> component);
WPI_DEPRECATED("use Sendable::SetName() instead")
void AddActuator(const llvm::Twine& subsystem, const llvm::Twine& name,
void AddActuator(const wpi::Twine& subsystem, const wpi::Twine& name,
Sendable* component);
WPI_DEPRECATED("use Sendable::SetName() instead")
void AddActuator(const llvm::Twine& subsystem, const llvm::Twine& name,
void AddActuator(const wpi::Twine& subsystem, const wpi::Twine& name,
Sendable& component);
WPI_DEPRECATED("use Sendable::SetName() instead")
void AddActuator(const llvm::Twine& subsystem, const llvm::Twine& name,
void AddActuator(const wpi::Twine& subsystem, const wpi::Twine& name,
std::shared_ptr<Sendable> component);
WPI_DEPRECATED("use SensorBase::SetName() instead")
void AddSensor(const llvm::Twine& type, int channel, Sendable* component);
void AddSensor(const wpi::Twine& type, int channel, Sendable* component);
WPI_DEPRECATED("use SensorBase::SetName() instead")
void AddActuator(const llvm::Twine& type, int channel, Sendable* component);
void AddActuator(const wpi::Twine& type, int channel, Sendable* component);
WPI_DEPRECATED("use SensorBase::SetName() instead")
void AddActuator(const llvm::Twine& type, int module, int channel,
void AddActuator(const wpi::Twine& type, int module, int channel,
Sendable* component);
void Add(std::shared_ptr<Sendable> component);

View File

@@ -9,7 +9,7 @@
#include <string>
#include <support/deprecated.h>
#include <wpi/deprecated.h>
#include "SmartDashboard/Sendable.h"
@@ -39,9 +39,9 @@ class WPI_DEPRECATED("use Sendable directly instead") LiveWindowSendable
virtual void StopLiveWindowMode() = 0;
std::string GetName() const override;
void SetName(const llvm::Twine& name) override;
void SetName(const wpi::Twine& name) override;
std::string GetSubsystem() const override;
void SetSubsystem(const llvm::Twine& subsystem) override;
void SetSubsystem(const wpi::Twine& subsystem) override;
void InitSendable(SendableBuilder& builder) override;
};

View File

@@ -9,7 +9,7 @@
#define DEFAULT_SAFETY_EXPIRATION 0.1
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
namespace frc {
@@ -21,7 +21,7 @@ class MotorSafety {
virtual void StopMotor() = 0;
virtual void SetSafetyEnabled(bool enabled) = 0;
virtual bool IsSafetyEnabled() const = 0;
virtual void GetDescription(llvm::raw_ostream& desc) const = 0;
virtual void GetDescription(wpi::raw_ostream& desc) const = 0;
};
} // namespace frc

View File

@@ -9,7 +9,7 @@
#include <set>
#include <support/mutex.h>
#include <wpi/mutex.h>
#include "ErrorBase.h"

View File

@@ -49,7 +49,7 @@ class NidecBrushless : public ErrorBase,
bool IsAlive() const override;
void SetSafetyEnabled(bool enabled) override;
bool IsSafetyEnabled() const override;
void GetDescription(llvm::raw_ostream& desc) const override;
void GetDescription(wpi::raw_ostream& desc) const override;
int GetChannel() const;

View File

@@ -15,7 +15,7 @@
#include <utility>
#include <HAL/Notifier.h>
#include <support/mutex.h>
#include <wpi/mutex.h>
#include "ErrorBase.h"

View File

@@ -10,8 +10,8 @@
#include <memory>
#include <string>
#include <support/deprecated.h>
#include <support/mutex.h>
#include <wpi/deprecated.h>
#include <wpi/mutex.h>
#include "Base.h"
#include "Controller.h"

View File

@@ -38,20 +38,20 @@ class Preferences : public ErrorBase {
static Preferences* GetInstance();
std::vector<std::string> GetKeys();
std::string GetString(llvm::StringRef key, llvm::StringRef defaultValue = "");
int GetInt(llvm::StringRef key, int defaultValue = 0);
double GetDouble(llvm::StringRef key, double defaultValue = 0.0);
float GetFloat(llvm::StringRef key, float defaultValue = 0.0);
bool GetBoolean(llvm::StringRef key, bool defaultValue = false);
int64_t GetLong(llvm::StringRef key, int64_t defaultValue = 0);
void PutString(llvm::StringRef key, llvm::StringRef value);
void PutInt(llvm::StringRef key, int value);
void PutDouble(llvm::StringRef key, double value);
void PutFloat(llvm::StringRef key, float value);
void PutBoolean(llvm::StringRef key, bool value);
void PutLong(llvm::StringRef key, int64_t value);
bool ContainsKey(llvm::StringRef key);
void Remove(llvm::StringRef key);
std::string GetString(wpi::StringRef key, wpi::StringRef defaultValue = "");
int GetInt(wpi::StringRef key, int defaultValue = 0);
double GetDouble(wpi::StringRef key, double defaultValue = 0.0);
float GetFloat(wpi::StringRef key, float defaultValue = 0.0);
bool GetBoolean(wpi::StringRef key, bool defaultValue = false);
int64_t GetLong(wpi::StringRef key, int64_t defaultValue = 0);
void PutString(wpi::StringRef key, wpi::StringRef value);
void PutInt(wpi::StringRef key, int value);
void PutDouble(wpi::StringRef key, double value);
void PutFloat(wpi::StringRef key, float value);
void PutBoolean(wpi::StringRef key, bool value);
void PutLong(wpi::StringRef key, int64_t value);
bool ContainsKey(wpi::StringRef key);
void Remove(wpi::StringRef key);
protected:
Preferences();

View File

@@ -10,7 +10,7 @@
#include <memory>
#include <HAL/Types.h>
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
#include "ErrorBase.h"
#include "MotorSafety.h"
@@ -50,7 +50,7 @@ class Relay : public MotorSafety, public ErrorBase, public SendableBase {
void StopMotor() override;
bool IsSafetyEnabled() const override;
void SetSafetyEnabled(bool enabled) override;
void GetDescription(llvm::raw_ostream& desc) const override;
void GetDescription(wpi::raw_ostream& desc) const override;
void InitSendable(SendableBuilder& builder) override;

View File

@@ -13,7 +13,7 @@
#include <string>
#include <vector>
#include <support/mutex.h>
#include <wpi/mutex.h>
#include "ErrorBase.h"

View File

@@ -10,7 +10,7 @@
#include <thread>
#include <HAL/HAL.h>
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
#include "Base.h"
@@ -18,17 +18,17 @@ namespace frc {
class DriverStation;
#define START_ROBOT_CLASS(_ClassName_) \
int main() { \
if (!HAL_Initialize(500, 0)) { \
llvm::errs() << "FATAL ERROR: HAL could not be initialized\n"; \
return -1; \
} \
HAL_Report(HALUsageReporting::kResourceType_Language, \
HALUsageReporting::kLanguage_CPlusPlus); \
llvm::outs() << "\n********** Robot program starting **********\n"; \
static _ClassName_ robot; \
robot.StartCompetition(); \
#define START_ROBOT_CLASS(_ClassName_) \
int main() { \
if (!HAL_Initialize(500, 0)) { \
wpi::errs() << "FATAL ERROR: HAL could not be initialized\n"; \
return -1; \
} \
HAL_Report(HALUsageReporting::kResourceType_Language, \
HALUsageReporting::kLanguage_CPlusPlus); \
wpi::outs() << "\n********** Robot program starting **********\n"; \
static _ClassName_ robot; \
robot.StartCompetition(); \
}
/**

View File

@@ -9,8 +9,8 @@
#include <memory>
#include <llvm/raw_ostream.h>
#include <support/deprecated.h>
#include <wpi/deprecated.h>
#include <wpi/raw_ostream.h>
#include "ErrorBase.h"
#include "MotorSafety.h"
@@ -105,7 +105,7 @@ class RobotDrive : public MotorSafety, public ErrorBase {
void StopMotor() override;
bool IsSafetyEnabled() const override;
void SetSafetyEnabled(bool enabled) override;
void GetDescription(llvm::raw_ostream& desc) const override;
void GetDescription(wpi::raw_ostream& desc) const override;
protected:
void InitRobotDrive();

View File

@@ -11,7 +11,7 @@
#include <memory>
#include <llvm/ArrayRef.h>
#include <wpi/ArrayRef.h>
#include "ErrorBase.h"
@@ -58,7 +58,7 @@ class SPI : public ErrorBase {
void InitAuto(int bufferSize);
void FreeAuto();
void SetAutoTransmitData(llvm::ArrayRef<uint8_t> dataToSend, int zeroSize);
void SetAutoTransmitData(wpi::ArrayRef<uint8_t> dataToSend, int zeroSize);
void StartAutoRate(double period);
void StartAutoTrigger(DigitalSource& source, bool rising, bool falling);
void StopAuto();

View File

@@ -9,7 +9,7 @@
#include <memory>
#include <llvm/raw_ostream.h>
#include <wpi/raw_ostream.h>
#include "MotorSafety.h"
#include "MotorSafetyHelper.h"
@@ -36,7 +36,7 @@ class SafePWM : public PWM, public MotorSafety {
void StopMotor();
bool IsSafetyEnabled() const;
void SetSafetyEnabled(bool enabled);
void GetDescription(llvm::raw_ostream& desc) const;
void GetDescription(wpi::raw_ostream& desc) const;
virtual void SetSpeed(double speed);

View File

@@ -7,7 +7,7 @@
#pragma once
#include <support/deprecated.h>
#include <wpi/deprecated.h>
#include "RobotBase.h"

View File

@@ -9,8 +9,8 @@
#include <string>
#include <llvm/StringRef.h>
#include <support/deprecated.h>
#include <wpi/StringRef.h>
#include <wpi/deprecated.h>
#include "ErrorBase.h"
@@ -58,7 +58,7 @@ class SerialPort : public ErrorBase {
SerialPort(int baudRate, Port port = kOnboard, int dataBits = 8,
Parity parity = kParity_None, StopBits stopBits = kStopBits_One);
WPI_DEPRECATED("Will be removed for 2019")
SerialPort(int baudRate, llvm::StringRef portName, Port port = kOnboard,
SerialPort(int baudRate, wpi::StringRef portName, Port port = kOnboard,
int dataBits = 8, Parity parity = kParity_None,
StopBits stopBits = kStopBits_One);
~SerialPort();
@@ -72,7 +72,7 @@ class SerialPort : public ErrorBase {
int GetBytesReceived();
int Read(char* buffer, int count);
int Write(const char* buffer, int count);
int Write(llvm::StringRef buffer);
int Write(wpi::StringRef buffer);
void SetTimeout(double timeout);
void SetReadBufferSize(int size);
void SetWriteBufferSize(int size);

View File

@@ -9,7 +9,7 @@
#include <string>
#include <support/deprecated.h>
#include <wpi/deprecated.h>
#include "SmartDashboard/Sendable.h"
@@ -23,9 +23,9 @@ namespace frc {
class WPI_DEPRECATED("use Sendable directly instead") NamedSendable
: public Sendable {
public:
void SetName(const llvm::Twine& name) override;
void SetName(const wpi::Twine& name) override;
std::string GetSubsystem() const override;
void SetSubsystem(const llvm::Twine& subsystem) override;
void SetSubsystem(const wpi::Twine& subsystem) override;
void InitSendable(SendableBuilder& builder) override;
};

View File

@@ -9,7 +9,7 @@
#include <string>
#include <llvm/Twine.h>
#include <wpi/Twine.h>
namespace frc {
@@ -31,7 +31,7 @@ class Sendable {
*
* @param name name
*/
virtual void SetName(const llvm::Twine& name) = 0;
virtual void SetName(const wpi::Twine& name) = 0;
/**
* Sets both the subsystem name and device name of this Sendable object.
@@ -39,7 +39,7 @@ class Sendable {
* @param subsystem subsystem name
* @param name device name
*/
void SetName(const llvm::Twine& subsystem, const llvm::Twine& name) {
void SetName(const wpi::Twine& subsystem, const wpi::Twine& name) {
SetSubsystem(subsystem);
SetName(name);
}
@@ -56,7 +56,7 @@ class Sendable {
*
* @param subsystem subsystem name
*/
virtual void SetSubsystem(const llvm::Twine& subsystem) = 0;
virtual void SetSubsystem(const wpi::Twine& subsystem) = 0;
/**
* Initializes this Sendable object.

View File

@@ -10,7 +10,7 @@
#include <memory>
#include <string>
#include <support/mutex.h>
#include <wpi/mutex.h>
#include "Sendable.h"
@@ -24,16 +24,16 @@ class SendableBase : public Sendable {
using Sendable::SetName;
std::string GetName() const final;
void SetName(const llvm::Twine& name) final;
void SetName(const wpi::Twine& name) final;
std::string GetSubsystem() const final;
void SetSubsystem(const llvm::Twine& subsystem) final;
void SetSubsystem(const wpi::Twine& subsystem) final;
protected:
void AddChild(std::shared_ptr<Sendable> child);
void AddChild(void* child);
void SetName(const llvm::Twine& moduleType, int channel);
void SetName(const llvm::Twine& moduleType, int moduleNumber, int channel);
void SetName(const wpi::Twine& moduleType, int channel);
void SetName(const wpi::Twine& moduleType, int moduleNumber, int channel);
private:
mutable wpi::mutex m_mutex;

View File

@@ -12,11 +12,11 @@
#include <string>
#include <vector>
#include <llvm/ArrayRef.h>
#include <llvm/SmallVector.h>
#include <llvm/Twine.h>
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableValue.h>
#include <wpi/ArrayRef.h>
#include <wpi/SmallVector.h>
#include <wpi/Twine.h>
namespace frc {
@@ -30,7 +30,7 @@ class SendableBuilder {
*
* @param type data type
*/
virtual void SetSmartDashboardType(const llvm::Twine& type) = 0;
virtual void SetSmartDashboardType(const wpi::Twine& type) = 0;
/**
* Set the function that should be called to set the Sendable into a safe
@@ -57,7 +57,7 @@ class SendableBuilder {
* @param key property name
* @return Network table entry
*/
virtual nt::NetworkTableEntry GetEntry(const llvm::Twine& key) = 0;
virtual nt::NetworkTableEntry GetEntry(const wpi::Twine& key) = 0;
/**
* Add a boolean property.
@@ -66,7 +66,7 @@ class SendableBuilder {
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddBooleanProperty(const llvm::Twine& key,
virtual void AddBooleanProperty(const wpi::Twine& key,
std::function<bool()> getter,
std::function<void(bool)> setter) = 0;
@@ -77,7 +77,7 @@ class SendableBuilder {
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddDoubleProperty(const llvm::Twine& key,
virtual void AddDoubleProperty(const wpi::Twine& key,
std::function<double()> getter,
std::function<void(double)> setter) = 0;
@@ -89,8 +89,8 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddStringProperty(
const llvm::Twine& key, std::function<std::string()> getter,
std::function<void(llvm::StringRef)> setter) = 0;
const wpi::Twine& key, std::function<std::string()> getter,
std::function<void(wpi::StringRef)> setter) = 0;
/**
* Add a boolean array property.
@@ -100,8 +100,8 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddBooleanArrayProperty(
const llvm::Twine& key, std::function<std::vector<int>()> getter,
std::function<void(llvm::ArrayRef<int>)> setter) = 0;
const wpi::Twine& key, std::function<std::vector<int>()> getter,
std::function<void(wpi::ArrayRef<int>)> setter) = 0;
/**
* Add a double array property.
@@ -111,8 +111,8 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddDoubleArrayProperty(
const llvm::Twine& key, std::function<std::vector<double>()> getter,
std::function<void(llvm::ArrayRef<double>)> setter) = 0;
const wpi::Twine& key, std::function<std::vector<double>()> getter,
std::function<void(wpi::ArrayRef<double>)> setter) = 0;
/**
* Add a string array property.
@@ -122,8 +122,8 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddStringArrayProperty(
const llvm::Twine& key, std::function<std::vector<std::string>()> getter,
std::function<void(llvm::ArrayRef<std::string>)> setter) = 0;
const wpi::Twine& key, std::function<std::vector<std::string>()> getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) = 0;
/**
* Add a raw property.
@@ -132,9 +132,9 @@ class SendableBuilder {
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddRawProperty(const llvm::Twine& key,
virtual void AddRawProperty(const wpi::Twine& key,
std::function<std::string()> getter,
std::function<void(llvm::StringRef)> setter) = 0;
std::function<void(wpi::StringRef)> setter) = 0;
/**
* Add a NetworkTableValue property.
@@ -144,7 +144,7 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddValueProperty(
const llvm::Twine& key,
const wpi::Twine& key,
std::function<std::shared_ptr<nt::Value>()> getter,
std::function<void(std::shared_ptr<nt::Value>)> setter) = 0;
@@ -156,9 +156,9 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddSmallStringProperty(
const llvm::Twine& key,
std::function<llvm::StringRef(llvm::SmallVectorImpl<char>& buf)> getter,
std::function<void(llvm::StringRef)> setter) = 0;
const wpi::Twine& key,
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
std::function<void(wpi::StringRef)> setter) = 0;
/**
* Add a boolean array property (SmallVector form).
@@ -168,10 +168,10 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddSmallBooleanArrayProperty(
const llvm::Twine& key,
std::function<llvm::ArrayRef<int>(llvm::SmallVectorImpl<int>& buf)>
const wpi::Twine& key,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)>
getter,
std::function<void(llvm::ArrayRef<int>)> setter) = 0;
std::function<void(wpi::ArrayRef<int>)> setter) = 0;
/**
* Add a double array property (SmallVector form).
@@ -181,10 +181,10 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddSmallDoubleArrayProperty(
const llvm::Twine& key,
std::function<llvm::ArrayRef<double>(llvm::SmallVectorImpl<double>& buf)>
const wpi::Twine& key,
std::function<wpi::ArrayRef<double>(wpi::SmallVectorImpl<double>& buf)>
getter,
std::function<void(llvm::ArrayRef<double>)> setter) = 0;
std::function<void(wpi::ArrayRef<double>)> setter) = 0;
/**
* Add a string array property (SmallVector form).
@@ -194,11 +194,11 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddSmallStringArrayProperty(
const llvm::Twine& key,
const wpi::Twine& key,
std::function<
llvm::ArrayRef<std::string>(llvm::SmallVectorImpl<std::string>& buf)>
wpi::ArrayRef<std::string>(wpi::SmallVectorImpl<std::string>& buf)>
getter,
std::function<void(llvm::ArrayRef<std::string>)> setter) = 0;
std::function<void(wpi::ArrayRef<std::string>)> setter) = 0;
/**
* Add a raw property (SmallVector form).
@@ -208,9 +208,9 @@ class SendableBuilder {
* @param setter setter function (sets new value)
*/
virtual void AddSmallRawProperty(
const llvm::Twine& key,
std::function<llvm::StringRef(llvm::SmallVectorImpl<char>& buf)> getter,
std::function<void(llvm::StringRef)> setter) = 0;
const wpi::Twine& key,
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
std::function<void(wpi::StringRef)> setter) = 0;
};
} // namespace frc

View File

@@ -13,12 +13,12 @@
#include <utility>
#include <vector>
#include <llvm/ArrayRef.h>
#include <llvm/SmallVector.h>
#include <llvm/Twine.h>
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableValue.h>
#include <wpi/ArrayRef.h>
#include <wpi/SmallVector.h>
#include <wpi/Twine.h>
#include "SendableBuilder.h"
@@ -73,74 +73,74 @@ class SendableBuilderImpl : public SendableBuilder {
*/
void StopLiveWindowMode();
void SetSmartDashboardType(const llvm::Twine& type) override;
void SetSmartDashboardType(const wpi::Twine& type) override;
void SetSafeState(std::function<void()> func) override;
void SetUpdateTable(std::function<void()> func) override;
nt::NetworkTableEntry GetEntry(const llvm::Twine& key) override;
nt::NetworkTableEntry GetEntry(const wpi::Twine& key) override;
void AddBooleanProperty(const llvm::Twine& key, std::function<bool()> getter,
void AddBooleanProperty(const wpi::Twine& key, std::function<bool()> getter,
std::function<void(bool)> setter) override;
void AddDoubleProperty(const llvm::Twine& key, std::function<double()> getter,
void AddDoubleProperty(const wpi::Twine& key, std::function<double()> getter,
std::function<void(double)> setter) override;
void AddStringProperty(const llvm::Twine& key,
void AddStringProperty(const wpi::Twine& key,
std::function<std::string()> getter,
std::function<void(llvm::StringRef)> setter) override;
std::function<void(wpi::StringRef)> setter) override;
void AddBooleanArrayProperty(
const llvm::Twine& key, std::function<std::vector<int>()> getter,
std::function<void(llvm::ArrayRef<int>)> setter) override;
const wpi::Twine& key, std::function<std::vector<int>()> getter,
std::function<void(wpi::ArrayRef<int>)> setter) override;
void AddDoubleArrayProperty(
const llvm::Twine& key, std::function<std::vector<double>()> getter,
std::function<void(llvm::ArrayRef<double>)> setter) override;
const wpi::Twine& key, std::function<std::vector<double>()> getter,
std::function<void(wpi::ArrayRef<double>)> setter) override;
void AddStringArrayProperty(
const llvm::Twine& key, std::function<std::vector<std::string>()> getter,
std::function<void(llvm::ArrayRef<std::string>)> setter) override;
const wpi::Twine& key, std::function<std::vector<std::string>()> getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) override;
void AddRawProperty(const llvm::Twine& key,
void AddRawProperty(const wpi::Twine& key,
std::function<std::string()> getter,
std::function<void(llvm::StringRef)> setter) override;
std::function<void(wpi::StringRef)> setter) override;
void AddValueProperty(
const llvm::Twine& key,
const wpi::Twine& key,
std::function<std::shared_ptr<nt::Value>()> getter,
std::function<void(std::shared_ptr<nt::Value>)> setter) override;
void AddSmallStringProperty(
const llvm::Twine& key,
std::function<llvm::StringRef(llvm::SmallVectorImpl<char>& buf)> getter,
std::function<void(llvm::StringRef)> setter) override;
const wpi::Twine& key,
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
std::function<void(wpi::StringRef)> setter) override;
void AddSmallBooleanArrayProperty(
const llvm::Twine& key,
std::function<llvm::ArrayRef<int>(llvm::SmallVectorImpl<int>& buf)>
const wpi::Twine& key,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)>
getter,
std::function<void(llvm::ArrayRef<int>)> setter) override;
std::function<void(wpi::ArrayRef<int>)> setter) override;
void AddSmallDoubleArrayProperty(
const llvm::Twine& key,
std::function<llvm::ArrayRef<double>(llvm::SmallVectorImpl<double>& buf)>
const wpi::Twine& key,
std::function<wpi::ArrayRef<double>(wpi::SmallVectorImpl<double>& buf)>
getter,
std::function<void(llvm::ArrayRef<double>)> setter) override;
std::function<void(wpi::ArrayRef<double>)> setter) override;
void AddSmallStringArrayProperty(
const llvm::Twine& key,
const wpi::Twine& key,
std::function<
llvm::ArrayRef<std::string>(llvm::SmallVectorImpl<std::string>& buf)>
wpi::ArrayRef<std::string>(wpi::SmallVectorImpl<std::string>& buf)>
getter,
std::function<void(llvm::ArrayRef<std::string>)> setter) override;
std::function<void(wpi::ArrayRef<std::string>)> setter) override;
void AddSmallRawProperty(
const llvm::Twine& key,
std::function<llvm::StringRef(llvm::SmallVectorImpl<char>& buf)> getter,
std::function<void(llvm::StringRef)> setter) override;
const wpi::Twine& key,
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
std::function<void(wpi::StringRef)> setter) override;
private:
struct Property {
Property(nt::NetworkTable& table, const llvm::Twine& key)
Property(nt::NetworkTable& table, const wpi::Twine& key)
: entry(table.GetEntry(key)) {}
Property(const Property&) = delete;

View File

@@ -9,8 +9,8 @@
#include <memory>
#include <llvm/StringMap.h>
#include <llvm/StringRef.h>
#include <wpi/StringMap.h>
#include <wpi/StringRef.h>
#include "SmartDashboard/SendableChooserBase.h"
@@ -31,7 +31,7 @@ namespace frc {
*/
template <class T>
class SendableChooser : public SendableChooserBase {
llvm::StringMap<T> m_choices;
wpi::StringMap<T> m_choices;
template <class U>
static U _unwrap_smart_ptr(const U& value);
@@ -45,8 +45,8 @@ class SendableChooser : public SendableChooserBase {
public:
~SendableChooser() override = default;
void AddObject(llvm::StringRef name, T object);
void AddDefault(llvm::StringRef name, T object);
void AddObject(wpi::StringRef name, T object);
void AddDefault(wpi::StringRef name, T object);
auto GetSelected() -> decltype(_unwrap_smart_ptr(m_choices[""]));

View File

@@ -13,7 +13,7 @@
#include <utility>
#include <vector>
#include <llvm/StringRef.h>
#include <wpi/StringRef.h>
#include "SendableBuilder.h"
@@ -29,7 +29,7 @@ namespace frc {
* @param object the option
*/
template <class T>
void SendableChooser<T>::AddObject(llvm::StringRef name, T object) {
void SendableChooser<T>::AddObject(wpi::StringRef name, T object) {
m_choices[name] = std::move(object);
}
@@ -43,7 +43,7 @@ void SendableChooser<T>::AddObject(llvm::StringRef name, T object) {
* @param object the option
*/
template <class T>
void SendableChooser<T>::AddDefault(llvm::StringRef name, T object) {
void SendableChooser<T>::AddDefault(wpi::StringRef name, T object) {
m_defaultChoice = name;
AddObject(name, std::move(object));
}
@@ -83,7 +83,7 @@ void SendableChooser<T>::InitSendable(SendableBuilder& builder) {
keys.push_back(choice.first());
}
// Unlike std::map, llvm::StringMap elements
// Unlike std::map, wpi::StringMap elements
// are not sorted
std::sort(keys.begin(), keys.end());
@@ -92,7 +92,7 @@ void SendableChooser<T>::InitSendable(SendableBuilder& builder) {
nullptr);
builder.AddSmallStringProperty(
kDefault,
[=](const llvm::SmallVectorImpl<char>&) -> llvm::StringRef {
[=](const wpi::SmallVectorImpl<char>&) -> wpi::StringRef {
return m_defaultChoice;
},
nullptr);

View File

@@ -23,66 +23,66 @@ class SmartDashboard : public SensorBase {
public:
static void init();
static bool ContainsKey(llvm::StringRef key);
static bool ContainsKey(wpi::StringRef key);
static std::vector<std::string> GetKeys(int types = 0);
static void SetPersistent(llvm::StringRef key);
static void ClearPersistent(llvm::StringRef key);
static bool IsPersistent(llvm::StringRef key);
static void SetPersistent(wpi::StringRef key);
static void ClearPersistent(wpi::StringRef key);
static bool IsPersistent(wpi::StringRef key);
static void SetFlags(llvm::StringRef key, unsigned int flags);
static void ClearFlags(llvm::StringRef key, unsigned int flags);
static unsigned int GetFlags(llvm::StringRef key);
static void SetFlags(wpi::StringRef key, unsigned int flags);
static void ClearFlags(wpi::StringRef key, unsigned int flags);
static unsigned int GetFlags(wpi::StringRef key);
static void Delete(llvm::StringRef key);
static void Delete(wpi::StringRef key);
static void PutData(llvm::StringRef key, Sendable* data);
static void PutData(wpi::StringRef key, Sendable* data);
static void PutData(Sendable* value);
static Sendable* GetData(llvm::StringRef keyName);
static Sendable* GetData(wpi::StringRef keyName);
static bool PutBoolean(llvm::StringRef keyName, bool value);
static bool SetDefaultBoolean(llvm::StringRef key, bool defaultValue);
static bool GetBoolean(llvm::StringRef keyName, bool defaultValue);
static bool PutBoolean(wpi::StringRef keyName, bool value);
static bool SetDefaultBoolean(wpi::StringRef key, bool defaultValue);
static bool GetBoolean(wpi::StringRef keyName, bool defaultValue);
static bool PutNumber(llvm::StringRef keyName, double value);
static bool SetDefaultNumber(llvm::StringRef key, double defaultValue);
static double GetNumber(llvm::StringRef keyName, double defaultValue);
static bool PutNumber(wpi::StringRef keyName, double value);
static bool SetDefaultNumber(wpi::StringRef key, double defaultValue);
static double GetNumber(wpi::StringRef keyName, double defaultValue);
static bool PutString(llvm::StringRef keyName, llvm::StringRef value);
static bool SetDefaultString(llvm::StringRef key,
llvm::StringRef defaultValue);
static std::string GetString(llvm::StringRef keyName,
llvm::StringRef defaultValue);
static bool PutString(wpi::StringRef keyName, wpi::StringRef value);
static bool SetDefaultString(wpi::StringRef key,
wpi::StringRef defaultValue);
static std::string GetString(wpi::StringRef keyName,
wpi::StringRef defaultValue);
static bool PutBooleanArray(llvm::StringRef key, llvm::ArrayRef<int> value);
static bool SetDefaultBooleanArray(llvm::StringRef key,
llvm::ArrayRef<int> defaultValue);
static std::vector<int> GetBooleanArray(llvm::StringRef key,
llvm::ArrayRef<int> defaultValue);
static bool PutBooleanArray(wpi::StringRef key, wpi::ArrayRef<int> value);
static bool SetDefaultBooleanArray(wpi::StringRef key,
wpi::ArrayRef<int> defaultValue);
static std::vector<int> GetBooleanArray(wpi::StringRef key,
wpi::ArrayRef<int> defaultValue);
static bool PutNumberArray(llvm::StringRef key, llvm::ArrayRef<double> value);
static bool SetDefaultNumberArray(llvm::StringRef key,
llvm::ArrayRef<double> defaultValue);
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(
llvm::StringRef key, llvm::ArrayRef<double> defaultValue);
wpi::StringRef key, wpi::ArrayRef<double> defaultValue);
static bool PutStringArray(llvm::StringRef key,
llvm::ArrayRef<std::string> value);
static bool SetDefaultStringArray(llvm::StringRef key,
llvm::ArrayRef<std::string> defaultValue);
static bool PutStringArray(wpi::StringRef key,
wpi::ArrayRef<std::string> value);
static bool SetDefaultStringArray(wpi::StringRef key,
wpi::ArrayRef<std::string> defaultValue);
static std::vector<std::string> GetStringArray(
llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue);
wpi::StringRef key, wpi::ArrayRef<std::string> defaultValue);
static bool PutRaw(llvm::StringRef key, llvm::StringRef value);
static bool SetDefaultRaw(llvm::StringRef key, llvm::StringRef defaultValue);
static std::string GetRaw(llvm::StringRef key, llvm::StringRef defaultValue);
static bool PutRaw(wpi::StringRef key, wpi::StringRef value);
static bool SetDefaultRaw(wpi::StringRef key, wpi::StringRef defaultValue);
static std::string GetRaw(wpi::StringRef key, wpi::StringRef defaultValue);
static bool PutValue(llvm::StringRef keyName,
static bool PutValue(wpi::StringRef keyName,
std::shared_ptr<nt::Value> value);
static bool SetDefaultValue(llvm::StringRef key,
static bool SetDefaultValue(wpi::StringRef key,
std::shared_ptr<nt::Value> defaultValue);
static std::shared_ptr<nt::Value> GetValue(llvm::StringRef keyName);
static std::shared_ptr<nt::Value> GetValue(wpi::StringRef keyName);
static void UpdateValues();

View File

@@ -7,8 +7,8 @@
#pragma once
#include <support/deprecated.h>
#include <support/mutex.h>
#include <wpi/deprecated.h>
#include <wpi/mutex.h>
#include "Base.h"

View File

@@ -15,9 +15,9 @@
#include <string>
#include <llvm/StringRef.h>
#include <llvm/Twine.h>
#include <support/deprecated.h>
#include <wpi/StringRef.h>
#include <wpi/Twine.h>
#include <wpi/deprecated.h>
#define wpi_assert(condition) \
wpi_assert_impl(condition, #condition, "", __FILE__, __LINE__, __FUNCTION__)
@@ -36,20 +36,20 @@
wpi_assertNotEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, \
__FUNCTION__)
bool wpi_assert_impl(bool conditionValue, const llvm::Twine& conditionText,
const llvm::Twine& message, llvm::StringRef fileName,
int lineNumber, llvm::StringRef funcName);
bool wpi_assert_impl(bool conditionValue, const wpi::Twine& conditionText,
const wpi::Twine& message, wpi::StringRef fileName,
int lineNumber, wpi::StringRef funcName);
bool wpi_assertEqual_impl(int valueA, int valueB,
const llvm::Twine& valueAString,
const llvm::Twine& valueBString,
const llvm::Twine& message, llvm::StringRef fileName,
int lineNumber, llvm::StringRef funcName);
const wpi::Twine& valueAString,
const wpi::Twine& valueBString,
const wpi::Twine& message, wpi::StringRef fileName,
int lineNumber, wpi::StringRef funcName);
bool wpi_assertNotEqual_impl(int valueA, int valueB,
const llvm::Twine& valueAString,
const llvm::Twine& valueBString,
const llvm::Twine& message,
llvm::StringRef fileName, int lineNumber,
llvm::StringRef funcName);
const wpi::Twine& valueAString,
const wpi::Twine& valueBString,
const wpi::Twine& message,
wpi::StringRef fileName, int lineNumber,
wpi::StringRef funcName);
void wpi_suspendOnAssertEnabled(bool enabled);