mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
Namespace all wpilibc functions/classes into "frc" namespace. (#311)
Base.h provides a backwards compatibility shim (enabled unless NAMESPACED_WPILIB is defined) that does a "using namespace frc". However, as some header files do not include Base.h, this may be a breaking change in some corner cases (with an easy fix). Fixes #218.
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "Buttons/Button.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Specifies the command to run when a button is first pressed.
|
||||
*
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "Commands/Scheduler.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
ButtonScheduler::ButtonScheduler(bool last, Trigger* button, Command* orders)
|
||||
: m_pressedLast(last), m_button(button), m_command(orders) {}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "Buttons/Button.h"
|
||||
#include "Commands/Command.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
CancelButtonScheduler::CancelButtonScheduler(bool last, Trigger* button,
|
||||
Command* orders)
|
||||
: ButtonScheduler(last, button, orders) {
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "Buttons/Button.h"
|
||||
#include "Commands/Command.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
HeldButtonScheduler::HeldButtonScheduler(bool last, Trigger* button,
|
||||
Command* orders)
|
||||
: ButtonScheduler(last, button, orders) {}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "Buttons/InternalButton.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
InternalButton::InternalButton(bool inverted)
|
||||
: m_pressed(inverted), m_inverted(inverted) {}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "Buttons/JoystickButton.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
JoystickButton::JoystickButton(GenericHID* joystick, int buttonNumber)
|
||||
: m_joystick(joystick), m_buttonNumber(buttonNumber) {}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "networktables/NetworkTable.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
NetworkButton::NetworkButton(const std::string& tableName,
|
||||
const std::string& field)
|
||||
: // TODO how is this supposed to work???
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "Buttons/Button.h"
|
||||
#include "Commands/Command.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
PressedButtonScheduler::PressedButtonScheduler(bool last, Trigger* button,
|
||||
Command* orders)
|
||||
: ButtonScheduler(last, button, orders) {}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "Buttons/Button.h"
|
||||
#include "Commands/Command.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
ReleasedButtonScheduler::ReleasedButtonScheduler(bool last, Trigger* button,
|
||||
Command* orders)
|
||||
: ButtonScheduler(last, button, orders) {}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "Buttons/Button.h"
|
||||
#include "Commands/Command.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
ToggleButtonScheduler::ToggleButtonScheduler(bool last, Trigger* button,
|
||||
Command* orders)
|
||||
: ButtonScheduler(last, button, orders) {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "Buttons/ReleasedButtonScheduler.h"
|
||||
#include "Buttons/ToggleButtonScheduler.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
bool Trigger::Grab() {
|
||||
if (Get()) {
|
||||
return true;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "Timer.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
static const std::string kName = "name";
|
||||
static const std::string kRunning = "running";
|
||||
static const std::string kIsParented = "isParented";
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Creates a new {@link CommandGroup CommandGroup} with the given name.
|
||||
* @param name the name for this command group
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "Commands/Command.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
CommandGroupEntry::CommandGroupEntry(Command* command, Sequence state,
|
||||
double timeout)
|
||||
: m_timeout(timeout), m_command(command), m_state(state) {}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
PIDCommand::PIDCommand(const std::string& name, double p, double i, double d,
|
||||
double f, double period)
|
||||
: Command(name) {
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "PIDController.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
|
||||
* values.
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <cstdio>
|
||||
#include <sstream>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
PrintCommand::PrintCommand(const std::string& message)
|
||||
: Command(((std::stringstream&)(std::stringstream("Print \"") << message
|
||||
<< "\""))
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "HLUsageReporting.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
Scheduler::Scheduler() { HLUsageReporting::ReportScheduler(); }
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "Commands/StartCommand.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
StartCommand::StartCommand(Command* commandToStart) : Command("StartCommand") {
|
||||
m_commandToFork = commandToStart;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "Commands/Scheduler.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Creates a subsystem with the given name.
|
||||
*
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
WaitCommand::WaitCommand(double timeout)
|
||||
: Command(
|
||||
((std::stringstream&)(std::stringstream("Wait(") << timeout << ")"))
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "Commands/CommandGroup.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
WaitForChildren::WaitForChildren(double timeout)
|
||||
: Command("WaitForChildren", timeout) {}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "Timer.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* A {@link WaitCommand} will wait until a certain match time before finishing.
|
||||
*
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "Timer.h"
|
||||
#include "Utility.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
void Error::Clone(const Error& error) {
|
||||
m_code = error.m_code;
|
||||
m_message = error.m_message;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#define WPI_ERRORS_DEFINE_STRINGS
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
priority_mutex ErrorBase::_globalErrorMutex;
|
||||
Error ErrorBase::_globalError;
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "Filters/Filter.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
Filter::Filter(std::shared_ptr<PIDSource> source) { m_source = source; }
|
||||
|
||||
void Filter::SetPIDSourceType(PIDSourceType pidSource) {
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Create a linear FIR or IIR filter.
|
||||
*
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Get the PIDOutput for the PIDSource base object. Can be set to return
|
||||
* angle or rate using SetPIDSourceType(). Defaults to angle.
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "HLUsageReporting.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
HLUsageReportingInterface* HLUsageReporting::impl = nullptr;
|
||||
|
||||
void HLUsageReporting::SetImplementation(HLUsageReportingInterface* i) {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include "networktables/NetworkTable.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Get an instance of the LiveWindow main class.
|
||||
*
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "Commands/Scheduler.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
void LiveWindowStatusListener::ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value,
|
||||
bool isNew) {}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "PIDSource.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Set which parameter you are using as a process control variable.
|
||||
*
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "ErrorBase.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
priority_recursive_mutex Resource::m_createLock;
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
std::shared_ptr<RobotStateInterface> RobotState::impl;
|
||||
|
||||
void RobotState::SetImplementation(RobotStateInterface& i) {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "SmartDashboard/SendableChooser.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
static const std::string kDefault = "default";
|
||||
static const std::string kOptions = "options";
|
||||
static const std::string kSelected = "selected";
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "WPIErrors.h"
|
||||
#include "networktables/NetworkTable.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
std::shared_ptr<ITable> SmartDashboard::m_table;
|
||||
std::map<std::shared_ptr<ITable>, Sendable*> SmartDashboard::m_tablesToData;
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <Utility.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
void Potentiometer::SetPIDSourceType(PIDSourceType pidSource) {
|
||||
if (wpi_assert(pidSource == PIDSourceType::kDisplacement)) {
|
||||
m_pidSource = pidSource;
|
||||
|
||||
Reference in New Issue
Block a user