mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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'; }
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()),
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) +
|
||||
|
||||
@@ -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(); });
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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); }
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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&) {}
|
||||
|
||||
@@ -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(']'));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user