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:
Peter Johnson
2016-11-01 22:33:12 -07:00
committed by GitHub
parent 36ad45c07d
commit 59267da72b
318 changed files with 988 additions and 10 deletions

View File

@@ -7,6 +7,8 @@
#include "Buttons/Button.h"
using namespace frc;
/**
* Specifies the command to run when a button is first pressed.
*

View File

@@ -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) {}

View File

@@ -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) {

View File

@@ -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) {}

View File

@@ -7,6 +7,8 @@
#include "Buttons/InternalButton.h"
using namespace frc;
InternalButton::InternalButton(bool inverted)
: m_pressed(inverted), m_inverted(inverted) {}

View File

@@ -7,6 +7,8 @@
#include "Buttons/JoystickButton.h"
using namespace frc;
JoystickButton::JoystickButton(GenericHID* joystick, int buttonNumber)
: m_joystick(joystick), m_buttonNumber(buttonNumber) {}

View File

@@ -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???

View File

@@ -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) {}

View File

@@ -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) {}

View File

@@ -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) {

View File

@@ -12,6 +12,8 @@
#include "Buttons/ReleasedButtonScheduler.h"
#include "Buttons/ToggleButtonScheduler.h"
using namespace frc;
bool Trigger::Grab() {
if (Get()) {
return true;

View File

@@ -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";

View File

@@ -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

View File

@@ -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) {}

View File

@@ -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) {

View File

@@ -9,6 +9,8 @@
#include "PIDController.h"
using namespace frc;
/**
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
* values.

View File

@@ -10,6 +10,8 @@
#include <cstdio>
#include <sstream>
using namespace frc;
PrintCommand::PrintCommand(const std::string& message)
: Command(((std::stringstream&)(std::stringstream("Print \"") << message
<< "\""))

View File

@@ -16,6 +16,8 @@
#include "HLUsageReporting.h"
#include "WPIErrors.h"
using namespace frc;
Scheduler::Scheduler() { HLUsageReporting::ReportScheduler(); }
/**

View File

@@ -7,6 +7,8 @@
#include "Commands/StartCommand.h"
using namespace frc;
StartCommand::StartCommand(Command* commandToStart) : Command("StartCommand") {
m_commandToFork = commandToStart;
}

View File

@@ -11,6 +11,8 @@
#include "Commands/Scheduler.h"
#include "WPIErrors.h"
using namespace frc;
/**
* Creates a subsystem with the given name.
*

View File

@@ -9,6 +9,8 @@
#include <sstream>
using namespace frc;
WaitCommand::WaitCommand(double timeout)
: Command(
((std::stringstream&)(std::stringstream("Wait(") << timeout << ")"))

View File

@@ -9,6 +9,8 @@
#include "Commands/CommandGroup.h"
using namespace frc;
WaitForChildren::WaitForChildren(double timeout)
: Command("WaitForChildren", timeout) {}

View File

@@ -9,6 +9,8 @@
#include "Timer.h"
using namespace frc;
/**
* A {@link WaitCommand} will wait until a certain match time before finishing.
*

View File

@@ -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;

View File

@@ -16,6 +16,8 @@
#define WPI_ERRORS_DEFINE_STRINGS
#include "WPIErrors.h"
using namespace frc;
priority_mutex ErrorBase::_globalErrorMutex;
Error ErrorBase::_globalError;

View File

@@ -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) {

View File

@@ -10,6 +10,8 @@
#include <cassert>
#include <cmath>
using namespace frc;
/**
* Create a linear FIR or IIR filter.
*

View File

@@ -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.

View File

@@ -7,6 +7,8 @@
#include "HLUsageReporting.h"
using namespace frc;
HLUsageReportingInterface* HLUsageReporting::impl = nullptr;
void HLUsageReporting::SetImplementation(HLUsageReportingInterface* i) {

View File

@@ -12,6 +12,8 @@
#include "networktables/NetworkTable.h"
using namespace frc;
/**
* Get an instance of the LiveWindow main class.
*

View File

@@ -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) {}

View File

@@ -7,6 +7,8 @@
#include "PIDSource.h"
using namespace frc;
/**
* Set which parameter you are using as a process control variable.
*

View File

@@ -10,6 +10,8 @@
#include "ErrorBase.h"
#include "WPIErrors.h"
using namespace frc;
priority_recursive_mutex Resource::m_createLock;
/**

View File

@@ -9,6 +9,8 @@
#include "Base.h"
using namespace frc;
std::shared_ptr<RobotStateInterface> RobotState::impl;
void RobotState::SetImplementation(RobotStateInterface& i) {

View File

@@ -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";

View File

@@ -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;

View File

@@ -9,6 +9,8 @@
#include <Utility.h>
using namespace frc;
void Potentiometer::SetPIDSourceType(PIDSourceType pidSource) {
if (wpi_assert(pidSource == PIDSourceType::kDisplacement)) {
m_pidSource = pidSource;