mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpilibc] Use std::string_view instead of Twine (#3380)
Use fmtlib where needed for string formatting into std::string_view.
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <string_view>
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include <hal/Types.h>
|
||||
#include <units/time.h>
|
||||
#include <wpi/Twine.h>
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/mutex.h>
|
||||
|
||||
@@ -71,7 +71,7 @@ class Notifier {
|
||||
*
|
||||
* @param name Name
|
||||
*/
|
||||
void SetName(const wpi::Twine& name);
|
||||
void SetName(std::string_view name);
|
||||
|
||||
/**
|
||||
* Change the handler function.
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <wpi/StringRef.h>
|
||||
#include <wpi/Twine.h>
|
||||
#include <string_view>
|
||||
|
||||
#include "frc/Tracer.h"
|
||||
|
||||
@@ -31,7 +29,7 @@ class ScopedTracer {
|
||||
* @param name The name of the epoch.
|
||||
* @param os A reference to the raw_ostream to print data to.
|
||||
*/
|
||||
ScopedTracer(wpi::Twine name, wpi::raw_ostream& os);
|
||||
ScopedTracer(std::string_view name, wpi::raw_ostream& os);
|
||||
~ScopedTracer();
|
||||
|
||||
ScopedTracer(const ScopedTracer&) = delete;
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <hal/Types.h>
|
||||
#include <wpi/StringRef.h>
|
||||
#include <wpi/Twine.h>
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
namespace frc {
|
||||
@@ -82,7 +81,7 @@ class SerialPort {
|
||||
* @param stopBits The number of stop bits to use as defined by the enum
|
||||
* StopBits.
|
||||
*/
|
||||
SerialPort(int baudRate, const wpi::Twine& portName, Port port = kOnboard,
|
||||
SerialPort(int baudRate, std::string_view portName, Port port = kOnboard,
|
||||
int dataBits = 8, Parity parity = kParity_None,
|
||||
StopBits stopBits = kStopBits_One);
|
||||
|
||||
@@ -148,7 +147,7 @@ class SerialPort {
|
||||
* @param buffer StringRef to the buffer to read the bytes from.
|
||||
* @return The number of bytes actually written into the port.
|
||||
*/
|
||||
int Write(wpi::StringRef buffer);
|
||||
int Write(std::string_view buffer);
|
||||
|
||||
/**
|
||||
* Configure the timeout of the serial port.
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <wpi/Twine.h>
|
||||
#include <string_view>
|
||||
|
||||
#include "frc/MotorSafety.h"
|
||||
#include "frc/PWM.h"
|
||||
@@ -66,7 +65,7 @@ class PWMMotorController : public MotorController,
|
||||
* @param channel The PWM channel that the controller is attached to. 0-9 are
|
||||
* on-board, 10-19 are on the MXP port
|
||||
*/
|
||||
PWMMotorController(const wpi::Twine& name, int channel);
|
||||
PWMMotorController(std::string_view name, int channel);
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardWidget.h"
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
@@ -24,7 +24,7 @@ class ShuffleboardContainer;
|
||||
*/
|
||||
class ComplexWidget final : public ShuffleboardWidget<ComplexWidget> {
|
||||
public:
|
||||
ComplexWidget(ShuffleboardContainer& parent, const wpi::Twine& title,
|
||||
ComplexWidget(ShuffleboardContainer& parent, std::string_view title,
|
||||
Sendable& sendable);
|
||||
|
||||
void EnableIfActuator() override;
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <networktables/NetworkTableValue.h>
|
||||
#include <wpi/StringMap.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardComponentBase.h"
|
||||
|
||||
@@ -26,8 +26,8 @@ class ShuffleboardContainer;
|
||||
template <typename Derived>
|
||||
class ShuffleboardComponent : public ShuffleboardComponentBase {
|
||||
public:
|
||||
ShuffleboardComponent(ShuffleboardContainer& parent, const wpi::Twine& title,
|
||||
const wpi::Twine& type = "");
|
||||
ShuffleboardComponent(ShuffleboardContainer& parent, std::string_view title,
|
||||
std::string_view type = "");
|
||||
|
||||
~ShuffleboardComponent() override = default;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardComponent.h"
|
||||
|
||||
@@ -13,8 +14,8 @@ namespace frc {
|
||||
|
||||
template <typename Derived>
|
||||
ShuffleboardComponent<Derived>::ShuffleboardComponent(
|
||||
ShuffleboardContainer& parent, const wpi::Twine& title,
|
||||
const wpi::Twine& type)
|
||||
ShuffleboardContainer& parent, std::string_view title,
|
||||
std::string_view type)
|
||||
: ShuffleboardValue(title),
|
||||
ShuffleboardComponentBase(parent, title, type) {}
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <networktables/NetworkTableValue.h>
|
||||
#include <wpi/StringMap.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardValue.h"
|
||||
|
||||
@@ -24,12 +24,11 @@ class ShuffleboardContainer;
|
||||
class ShuffleboardComponentBase : public virtual ShuffleboardValue {
|
||||
public:
|
||||
ShuffleboardComponentBase(ShuffleboardContainer& parent,
|
||||
const wpi::Twine& title,
|
||||
const wpi::Twine& type = "");
|
||||
std::string_view title, std::string_view type = "");
|
||||
|
||||
~ShuffleboardComponentBase() override = default;
|
||||
|
||||
void SetType(const wpi::Twine& type);
|
||||
void SetType(std::string_view type);
|
||||
|
||||
void BuildMetadata(std::shared_ptr<nt::NetworkTable> metaTable);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <networktables/NetworkTableEntry.h>
|
||||
@@ -14,7 +15,6 @@
|
||||
#include <wpi/ArrayRef.h>
|
||||
#include <wpi/SmallSet.h>
|
||||
#include <wpi/StringMap.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/shuffleboard/BuiltInLayouts.h"
|
||||
#include "frc/shuffleboard/LayoutType.h"
|
||||
@@ -38,7 +38,7 @@ class SimpleWidget;
|
||||
*/
|
||||
class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
public:
|
||||
explicit ShuffleboardContainer(const wpi::Twine& title);
|
||||
explicit ShuffleboardContainer(std::string_view title);
|
||||
|
||||
ShuffleboardContainer(ShuffleboardContainer&& rhs) = default;
|
||||
|
||||
@@ -58,7 +58,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @param layoutType the type of the layout, eg "List" or "Grid"
|
||||
* @return the layout
|
||||
*/
|
||||
ShuffleboardLayout& GetLayout(const wpi::Twine& title, BuiltInLayouts type);
|
||||
ShuffleboardLayout& GetLayout(std::string_view title, BuiltInLayouts type);
|
||||
|
||||
/**
|
||||
* Gets the layout with the given type and title, creating it if it does not
|
||||
@@ -68,8 +68,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @param layoutType the type of the layout, eg "List" or "Grid"
|
||||
* @return the layout
|
||||
*/
|
||||
ShuffleboardLayout& GetLayout(const wpi::Twine& title,
|
||||
const LayoutType& type);
|
||||
ShuffleboardLayout& GetLayout(std::string_view title, const LayoutType& type);
|
||||
|
||||
/**
|
||||
* Gets the layout with the given type and title, creating it if it does not
|
||||
@@ -84,8 +83,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return the layout
|
||||
* @see #GetLayout(String, LayoutType)
|
||||
*/
|
||||
ShuffleboardLayout& GetLayout(const wpi::Twine& title,
|
||||
const wpi::Twine& type);
|
||||
ShuffleboardLayout& GetLayout(std::string_view title, std::string_view type);
|
||||
|
||||
/**
|
||||
* Gets the already-defined layout in this container with the given title.
|
||||
@@ -102,7 +100,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return the layout with the given title
|
||||
* @throws if no layout has yet been defined with the given title
|
||||
*/
|
||||
ShuffleboardLayout& GetLayout(const wpi::Twine& title);
|
||||
ShuffleboardLayout& GetLayout(std::string_view title);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given sendable.
|
||||
@@ -113,7 +111,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this
|
||||
* container with the given title
|
||||
*/
|
||||
ComplexWidget& Add(const wpi::Twine& title, Sendable& sendable);
|
||||
ComplexWidget& Add(std::string_view title, Sendable& sendable);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given video stream.
|
||||
@@ -124,7 +122,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @throws IllegalArgumentException if a widget already exists in this
|
||||
* container with the given title
|
||||
*/
|
||||
ComplexWidget& Add(const wpi::Twine& title, const cs::VideoSource& video);
|
||||
ComplexWidget& Add(std::string_view title, const cs::VideoSource& video);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given sendable.
|
||||
@@ -157,7 +155,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* container with the given title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& Add(const wpi::Twine& title,
|
||||
SimpleWidget& Add(std::string_view title,
|
||||
std::shared_ptr<nt::Value> defaultValue);
|
||||
|
||||
/**
|
||||
@@ -170,7 +168,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* container with the given title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& Add(const wpi::Twine& title, bool defaultValue);
|
||||
SimpleWidget& Add(std::string_view title, bool defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given data.
|
||||
@@ -182,7 +180,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* container with the given title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& Add(const wpi::Twine& title, double defaultValue);
|
||||
SimpleWidget& Add(std::string_view title, double defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given data.
|
||||
@@ -194,7 +192,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* container with the given title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& Add(const wpi::Twine& title, int defaultValue);
|
||||
SimpleWidget& Add(std::string_view title, int defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given data.
|
||||
@@ -206,7 +204,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* container with the given title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& Add(const wpi::Twine& title, const wpi::Twine& defaultValue);
|
||||
SimpleWidget& Add(std::string_view title, std::string_view defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given data.
|
||||
@@ -218,7 +216,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* container with the given title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& Add(const wpi::Twine& title, const char* defaultValue);
|
||||
SimpleWidget& Add(std::string_view title, const char* defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given data.
|
||||
@@ -230,7 +228,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* container with the given title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& Add(const wpi::Twine& title, wpi::ArrayRef<bool> defaultValue);
|
||||
SimpleWidget& Add(std::string_view title, wpi::ArrayRef<bool> defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given data.
|
||||
@@ -242,8 +240,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* container with the given title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& Add(const wpi::Twine& title,
|
||||
wpi::ArrayRef<double> defaultValue);
|
||||
SimpleWidget& Add(std::string_view title, wpi::ArrayRef<double> defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display the given data.
|
||||
@@ -255,7 +252,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* container with the given title
|
||||
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& Add(const wpi::Twine& title,
|
||||
SimpleWidget& Add(std::string_view title,
|
||||
wpi::ArrayRef<std::string> defaultValue);
|
||||
|
||||
/**
|
||||
@@ -269,7 +266,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display data
|
||||
*/
|
||||
SuppliedValueWidget<std::string>& AddString(
|
||||
const wpi::Twine& title, std::function<std::string()> supplier);
|
||||
std::string_view title, std::function<std::string()> supplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided
|
||||
@@ -281,7 +278,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @param valueSupplier the supplier for values
|
||||
* @return a widget to display data
|
||||
*/
|
||||
SuppliedValueWidget<double>& AddNumber(const wpi::Twine& title,
|
||||
SuppliedValueWidget<double>& AddNumber(std::string_view title,
|
||||
std::function<double()> supplier);
|
||||
|
||||
/**
|
||||
@@ -294,7 +291,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @param valueSupplier the supplier for values
|
||||
* @return a widget to display data
|
||||
*/
|
||||
SuppliedValueWidget<bool>& AddBoolean(const wpi::Twine& title,
|
||||
SuppliedValueWidget<bool>& AddBoolean(std::string_view title,
|
||||
std::function<bool()> supplier);
|
||||
|
||||
/**
|
||||
@@ -308,7 +305,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display data
|
||||
*/
|
||||
SuppliedValueWidget<std::vector<std::string>>& AddStringArray(
|
||||
const wpi::Twine& title,
|
||||
std::string_view title,
|
||||
std::function<std::vector<std::string>()> supplier);
|
||||
|
||||
/**
|
||||
@@ -322,7 +319,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display data
|
||||
*/
|
||||
SuppliedValueWidget<std::vector<double>>& AddNumberArray(
|
||||
const wpi::Twine& title, std::function<std::vector<double>()> supplier);
|
||||
std::string_view title, std::function<std::vector<double>()> supplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided
|
||||
@@ -335,7 +332,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display data
|
||||
*/
|
||||
SuppliedValueWidget<std::vector<int>>& AddBooleanArray(
|
||||
const wpi::Twine& title, std::function<std::vector<int>()> supplier);
|
||||
std::string_view title, std::function<std::vector<int>()> supplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container. The widget will display the data provided
|
||||
@@ -347,8 +344,8 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @param valueSupplier the supplier for values
|
||||
* @return a widget to display data
|
||||
*/
|
||||
SuppliedValueWidget<wpi::StringRef>& AddRaw(
|
||||
const wpi::Twine& title, std::function<wpi::StringRef()> supplier);
|
||||
SuppliedValueWidget<std::string_view>& AddRaw(
|
||||
std::string_view title, std::function<std::string_view()> supplier);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display a simple piece of data.
|
||||
@@ -362,7 +359,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display the sendable data
|
||||
* @see #add(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& AddPersistent(const wpi::Twine& title,
|
||||
SimpleWidget& AddPersistent(std::string_view title,
|
||||
std::shared_ptr<nt::Value> defaultValue);
|
||||
|
||||
/**
|
||||
@@ -377,7 +374,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display the sendable data
|
||||
* @see #add(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& AddPersistent(const wpi::Twine& title, bool defaultValue);
|
||||
SimpleWidget& AddPersistent(std::string_view title, bool defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display a simple piece of data.
|
||||
@@ -391,7 +388,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display the sendable data
|
||||
* @see #add(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& AddPersistent(const wpi::Twine& title, double defaultValue);
|
||||
SimpleWidget& AddPersistent(std::string_view title, double defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display a simple piece of data.
|
||||
@@ -405,7 +402,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display the sendable data
|
||||
* @see #add(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& AddPersistent(const wpi::Twine& title, int defaultValue);
|
||||
SimpleWidget& AddPersistent(std::string_view title, int defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display a simple piece of data.
|
||||
@@ -419,8 +416,8 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display the sendable data
|
||||
* @see #add(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& AddPersistent(const wpi::Twine& title,
|
||||
const wpi::Twine& defaultValue);
|
||||
SimpleWidget& AddPersistent(std::string_view title,
|
||||
std::string_view defaultValue);
|
||||
|
||||
/**
|
||||
* Adds a widget to this container to display a simple piece of data.
|
||||
@@ -434,7 +431,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display the sendable data
|
||||
* @see #add(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& AddPersistent(const wpi::Twine& title,
|
||||
SimpleWidget& AddPersistent(std::string_view title,
|
||||
wpi::ArrayRef<bool> defaultValue);
|
||||
|
||||
/**
|
||||
@@ -449,7 +446,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display the sendable data
|
||||
* @see #add(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& AddPersistent(const wpi::Twine& title,
|
||||
SimpleWidget& AddPersistent(std::string_view title,
|
||||
wpi::ArrayRef<double> defaultValue);
|
||||
|
||||
/**
|
||||
@@ -464,7 +461,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
* @return a widget to display the sendable data
|
||||
* @see #add(String, Object) add(String title, Object defaultValue)
|
||||
*/
|
||||
SimpleWidget& AddPersistent(const wpi::Twine& title,
|
||||
SimpleWidget& AddPersistent(std::string_view title,
|
||||
wpi::ArrayRef<std::string> defaultValue);
|
||||
|
||||
void EnableIfActuator() override;
|
||||
@@ -484,7 +481,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
|
||||
*
|
||||
* @return True if title isn't in use; false otherwise.
|
||||
*/
|
||||
void CheckTitle(const wpi::Twine& title);
|
||||
void CheckTitle(std::string_view title);
|
||||
|
||||
friend class SimpleWidget;
|
||||
};
|
||||
@@ -505,7 +502,7 @@ inline frc::ComplexWidget& frc::ShuffleboardContainer::Add(
|
||||
}
|
||||
|
||||
inline frc::ComplexWidget& frc::ShuffleboardContainer::Add(
|
||||
const wpi::Twine& title, const cs::VideoSource& video) {
|
||||
std::string_view title, const cs::VideoSource& video) {
|
||||
return Add(title, frc::SendableCameraWrapper::Wrap(video));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardComponent.h"
|
||||
#include "frc/shuffleboard/ShuffleboardContainer.h"
|
||||
@@ -26,8 +26,8 @@ namespace frc {
|
||||
class ShuffleboardLayout : public ShuffleboardComponent<ShuffleboardLayout>,
|
||||
public ShuffleboardContainer {
|
||||
public:
|
||||
ShuffleboardLayout(ShuffleboardContainer& parent, const wpi::Twine& name,
|
||||
const wpi::Twine& type);
|
||||
ShuffleboardLayout(ShuffleboardContainer& parent, std::string_view name,
|
||||
std::string_view type);
|
||||
|
||||
void BuildInto(std::shared_ptr<nt::NetworkTable> parentTable,
|
||||
std::shared_ptr<nt::NetworkTable> metaTable) override;
|
||||
|
||||
@@ -6,26 +6,22 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/StringRef.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
class ShuffleboardValue {
|
||||
public:
|
||||
explicit ShuffleboardValue(const wpi::Twine& title) {
|
||||
wpi::SmallVector<char, 16> storage;
|
||||
m_title = title.toStringRef(storage);
|
||||
}
|
||||
explicit ShuffleboardValue(std::string_view title) : m_title(title) {}
|
||||
|
||||
virtual ~ShuffleboardValue() = default;
|
||||
|
||||
/**
|
||||
* Gets the title of this Shuffleboard value.
|
||||
*/
|
||||
wpi::StringRef GetTitle() const { return m_title; }
|
||||
const std::string& GetTitle() const { return m_title; }
|
||||
|
||||
/**
|
||||
* Builds the entries for this value.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/Twine.h>
|
||||
#include <string_view>
|
||||
|
||||
#include "frc/shuffleboard/BuiltInWidgets.h"
|
||||
#include "frc/shuffleboard/ShuffleboardComponent.h"
|
||||
@@ -28,7 +28,7 @@ const char* GetStringForWidgetType(BuiltInWidgets type);
|
||||
template <typename Derived>
|
||||
class ShuffleboardWidget : public ShuffleboardComponent<Derived> {
|
||||
public:
|
||||
ShuffleboardWidget(ShuffleboardContainer& parent, const wpi::Twine& title)
|
||||
ShuffleboardWidget(ShuffleboardContainer& parent, std::string_view title)
|
||||
: ShuffleboardValue(title),
|
||||
ShuffleboardComponent<Derived>(parent, title) {}
|
||||
|
||||
@@ -66,7 +66,7 @@ class ShuffleboardWidget : public ShuffleboardComponent<Derived> {
|
||||
* @param widgetType the type of the widget used to display the data
|
||||
* @return this widget object
|
||||
*/
|
||||
Derived& WithWidget(const wpi::Twine& widgetType) {
|
||||
Derived& WithWidget(std::string_view widgetType) {
|
||||
this->SetType(widgetType);
|
||||
return *static_cast<Derived*>(this);
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <networktables/NetworkTableEntry.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardWidget.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ class ShuffleboardContainer;
|
||||
*/
|
||||
class SimpleWidget final : public ShuffleboardWidget<SimpleWidget> {
|
||||
public:
|
||||
SimpleWidget(ShuffleboardContainer& parent, const wpi::Twine& title);
|
||||
SimpleWidget(ShuffleboardContainer& parent, std::string_view title);
|
||||
|
||||
/**
|
||||
* Gets the NetworkTable entry that contains the data for this widget.
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <networktables/NetworkTableEntry.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardComponent.h"
|
||||
#include "frc/shuffleboard/ShuffleboardComponent.inc"
|
||||
@@ -22,7 +22,7 @@ class ShuffleboardContainer;
|
||||
template <typename T>
|
||||
class SuppliedValueWidget : public ShuffleboardWidget<SuppliedValueWidget<T> > {
|
||||
public:
|
||||
SuppliedValueWidget(ShuffleboardContainer& parent, const wpi::Twine& title,
|
||||
SuppliedValueWidget(ShuffleboardContainer& parent, std::string_view title,
|
||||
std::function<T()> supplier,
|
||||
std::function<void(nt::NetworkTableEntry, T)> setter)
|
||||
: ShuffleboardValue(title),
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <networktables/NetworkTableEntry.h>
|
||||
#include <units/length.h>
|
||||
#include <wpi/Twine.h>
|
||||
#include <wpi/mutex.h>
|
||||
|
||||
#include "frc/geometry/Pose2d.h"
|
||||
@@ -76,7 +76,7 @@ class Field2d : public Sendable, public SendableHelper<Field2d> {
|
||||
*
|
||||
* @return Field object
|
||||
*/
|
||||
FieldObject2d* GetObject(const wpi::Twine& name);
|
||||
FieldObject2d* GetObject(std::string_view name);
|
||||
|
||||
/**
|
||||
* Get the robot object.
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -31,8 +32,7 @@ class FieldObject2d {
|
||||
struct private_init {};
|
||||
|
||||
public:
|
||||
FieldObject2d(std::string&& name, const private_init&)
|
||||
: m_name{std::move(name)} {}
|
||||
FieldObject2d(std::string_view name, const private_init&) : m_name{name} {}
|
||||
|
||||
FieldObject2d(FieldObject2d&& rhs);
|
||||
FieldObject2d& operator=(FieldObject2d&& rhs);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTableEntry.h>
|
||||
#include <units/angle.h>
|
||||
@@ -21,7 +22,7 @@ namespace frc {
|
||||
*/
|
||||
class MechanismLigament2d : public MechanismObject2d {
|
||||
public:
|
||||
MechanismLigament2d(const wpi::Twine& name, double length,
|
||||
MechanismLigament2d(std::string_view name, double length,
|
||||
units::degree_t angle, double lineWidth = 6,
|
||||
const frc::Color8Bit& color = {235, 137, 52});
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <wpi/StringMap.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -30,7 +30,7 @@ class MechanismObject2d {
|
||||
friend class Mechanism2d;
|
||||
|
||||
protected:
|
||||
explicit MechanismObject2d(const wpi::Twine& name);
|
||||
explicit MechanismObject2d(std::string_view name);
|
||||
|
||||
/**
|
||||
* Update all entries with new ones from a new table.
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTableEntry.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "MechanismObject2d.h"
|
||||
|
||||
@@ -24,7 +24,7 @@ class MechanismRoot2d : private MechanismObject2d {
|
||||
struct private_init {};
|
||||
|
||||
public:
|
||||
MechanismRoot2d(const wpi::Twine& name, double x, double y,
|
||||
MechanismRoot2d(std::string_view name, double x, double y,
|
||||
const private_init&);
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
@@ -14,7 +15,6 @@
|
||||
#include <networktables/NetworkTableValue.h>
|
||||
#include <wpi/ArrayRef.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -28,7 +28,7 @@ class SendableBuilder {
|
||||
*
|
||||
* @param type data type
|
||||
*/
|
||||
virtual void SetSmartDashboardType(const wpi::Twine& type) = 0;
|
||||
virtual void SetSmartDashboardType(std::string_view type) = 0;
|
||||
|
||||
/**
|
||||
* Set a flag indicating if this sendable should be treated as an actuator.
|
||||
@@ -63,7 +63,7 @@ class SendableBuilder {
|
||||
* @param key property name
|
||||
* @return Network table entry
|
||||
*/
|
||||
virtual nt::NetworkTableEntry GetEntry(const wpi::Twine& key) = 0;
|
||||
virtual nt::NetworkTableEntry GetEntry(std::string_view key) = 0;
|
||||
|
||||
/**
|
||||
* Add a boolean property.
|
||||
@@ -72,7 +72,7 @@ class SendableBuilder {
|
||||
* @param getter getter function (returns current value)
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddBooleanProperty(const wpi::Twine& key,
|
||||
virtual void AddBooleanProperty(std::string_view key,
|
||||
std::function<bool()> getter,
|
||||
std::function<void(bool)> setter) = 0;
|
||||
|
||||
@@ -83,7 +83,7 @@ class SendableBuilder {
|
||||
* @param getter getter function (returns current value)
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddDoubleProperty(const wpi::Twine& key,
|
||||
virtual void AddDoubleProperty(std::string_view key,
|
||||
std::function<double()> getter,
|
||||
std::function<void(double)> setter) = 0;
|
||||
|
||||
@@ -95,7 +95,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddStringProperty(
|
||||
const wpi::Twine& key, std::function<std::string()> getter,
|
||||
std::string_view key, std::function<std::string()> getter,
|
||||
std::function<void(wpi::StringRef)> setter) = 0;
|
||||
|
||||
/**
|
||||
@@ -106,7 +106,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddBooleanArrayProperty(
|
||||
const wpi::Twine& key, std::function<std::vector<int>()> getter,
|
||||
std::string_view key, std::function<std::vector<int>()> getter,
|
||||
std::function<void(wpi::ArrayRef<int>)> setter) = 0;
|
||||
|
||||
/**
|
||||
@@ -117,7 +117,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddDoubleArrayProperty(
|
||||
const wpi::Twine& key, std::function<std::vector<double>()> getter,
|
||||
std::string_view key, std::function<std::vector<double>()> getter,
|
||||
std::function<void(wpi::ArrayRef<double>)> setter) = 0;
|
||||
|
||||
/**
|
||||
@@ -128,7 +128,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddStringArrayProperty(
|
||||
const wpi::Twine& key, std::function<std::vector<std::string>()> getter,
|
||||
std::string_view key, std::function<std::vector<std::string>()> getter,
|
||||
std::function<void(wpi::ArrayRef<std::string>)> setter) = 0;
|
||||
|
||||
/**
|
||||
@@ -138,7 +138,7 @@ class SendableBuilder {
|
||||
* @param getter getter function (returns current value)
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddRawProperty(const wpi::Twine& key,
|
||||
virtual void AddRawProperty(std::string_view key,
|
||||
std::function<std::string()> getter,
|
||||
std::function<void(wpi::StringRef)> setter) = 0;
|
||||
|
||||
@@ -150,7 +150,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddValueProperty(
|
||||
const wpi::Twine& key, std::function<std::shared_ptr<nt::Value>()> getter,
|
||||
std::string_view key, std::function<std::shared_ptr<nt::Value>()> getter,
|
||||
std::function<void(std::shared_ptr<nt::Value>)> setter) = 0;
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddSmallStringProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
|
||||
std::function<void(wpi::StringRef)> setter) = 0;
|
||||
|
||||
@@ -173,7 +173,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddSmallBooleanArrayProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)> getter,
|
||||
std::function<void(wpi::ArrayRef<int>)> setter) = 0;
|
||||
|
||||
@@ -185,7 +185,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddSmallDoubleArrayProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<wpi::ArrayRef<double>(wpi::SmallVectorImpl<double>& buf)>
|
||||
getter,
|
||||
std::function<void(wpi::ArrayRef<double>)> setter) = 0;
|
||||
@@ -198,7 +198,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddSmallStringArrayProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<
|
||||
wpi::ArrayRef<std::string>(wpi::SmallVectorImpl<std::string>& buf)>
|
||||
getter,
|
||||
@@ -212,7 +212,7 @@ class SendableBuilder {
|
||||
* @param setter setter function (sets new value)
|
||||
*/
|
||||
virtual void AddSmallRawProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
|
||||
std::function<void(wpi::StringRef)> setter) = 0;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -15,7 +16,6 @@
|
||||
#include <networktables/NetworkTableValue.h>
|
||||
#include <wpi/ArrayRef.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableBuilder.h"
|
||||
|
||||
@@ -86,73 +86,72 @@ class SendableBuilderImpl : public SendableBuilder {
|
||||
*/
|
||||
void ClearProperties();
|
||||
|
||||
void SetSmartDashboardType(const wpi::Twine& type) override;
|
||||
void SetSmartDashboardType(std::string_view type) override;
|
||||
void SetActuator(bool value) override;
|
||||
void SetSafeState(std::function<void()> func) override;
|
||||
void SetUpdateTable(std::function<void()> func) override;
|
||||
nt::NetworkTableEntry GetEntry(const wpi::Twine& key) override;
|
||||
nt::NetworkTableEntry GetEntry(std::string_view key) override;
|
||||
|
||||
void AddBooleanProperty(const wpi::Twine& key, std::function<bool()> getter,
|
||||
void AddBooleanProperty(std::string_view key, std::function<bool()> getter,
|
||||
std::function<void(bool)> setter) override;
|
||||
|
||||
void AddDoubleProperty(const wpi::Twine& key, std::function<double()> getter,
|
||||
void AddDoubleProperty(std::string_view key, std::function<double()> getter,
|
||||
std::function<void(double)> setter) override;
|
||||
|
||||
void AddStringProperty(const wpi::Twine& key,
|
||||
void AddStringProperty(std::string_view key,
|
||||
std::function<std::string()> getter,
|
||||
std::function<void(wpi::StringRef)> setter) override;
|
||||
|
||||
void AddBooleanArrayProperty(
|
||||
const wpi::Twine& key, std::function<std::vector<int>()> getter,
|
||||
std::string_view key, std::function<std::vector<int>()> getter,
|
||||
std::function<void(wpi::ArrayRef<int>)> setter) override;
|
||||
|
||||
void AddDoubleArrayProperty(
|
||||
const wpi::Twine& key, std::function<std::vector<double>()> getter,
|
||||
std::string_view key, std::function<std::vector<double>()> getter,
|
||||
std::function<void(wpi::ArrayRef<double>)> setter) override;
|
||||
|
||||
void AddStringArrayProperty(
|
||||
const wpi::Twine& key, std::function<std::vector<std::string>()> getter,
|
||||
std::string_view key, std::function<std::vector<std::string>()> getter,
|
||||
std::function<void(wpi::ArrayRef<std::string>)> setter) override;
|
||||
|
||||
void AddRawProperty(const wpi::Twine& key,
|
||||
std::function<std::string()> getter,
|
||||
void AddRawProperty(std::string_view key, std::function<std::string()> getter,
|
||||
std::function<void(wpi::StringRef)> setter) override;
|
||||
|
||||
void AddValueProperty(
|
||||
const wpi::Twine& key, std::function<std::shared_ptr<nt::Value>()> getter,
|
||||
std::string_view key, std::function<std::shared_ptr<nt::Value>()> getter,
|
||||
std::function<void(std::shared_ptr<nt::Value>)> setter) override;
|
||||
|
||||
void AddSmallStringProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
|
||||
std::function<void(wpi::StringRef)> setter) override;
|
||||
|
||||
void AddSmallBooleanArrayProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)> getter,
|
||||
std::function<void(wpi::ArrayRef<int>)> setter) override;
|
||||
|
||||
void AddSmallDoubleArrayProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<wpi::ArrayRef<double>(wpi::SmallVectorImpl<double>& buf)>
|
||||
getter,
|
||||
std::function<void(wpi::ArrayRef<double>)> setter) override;
|
||||
|
||||
void AddSmallStringArrayProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<
|
||||
wpi::ArrayRef<std::string>(wpi::SmallVectorImpl<std::string>& buf)>
|
||||
getter,
|
||||
std::function<void(wpi::ArrayRef<std::string>)> setter) override;
|
||||
|
||||
void AddSmallRawProperty(
|
||||
const wpi::Twine& key,
|
||||
std::string_view key,
|
||||
std::function<wpi::StringRef(wpi::SmallVectorImpl<char>& buf)> getter,
|
||||
std::function<void(wpi::StringRef)> setter) override;
|
||||
|
||||
private:
|
||||
struct Property {
|
||||
Property(nt::NetworkTable& table, const wpi::Twine& key)
|
||||
Property(nt::NetworkTable& table, std::string_view key)
|
||||
: entry(table.GetEntry(key)) {}
|
||||
|
||||
Property(const Property&) = delete;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <wpi/Twine.h>
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "frc/smartdashboard/SendableRegistry.h"
|
||||
@@ -61,7 +61,7 @@ class SendableHelper {
|
||||
* @param name name
|
||||
*/
|
||||
WPI_DEPRECATED("use SendableRegistry::SetName()")
|
||||
void SetName(const wpi::Twine& name) {
|
||||
void SetName(std::string_view name) {
|
||||
SendableRegistry::GetInstance().SetName(static_cast<Derived*>(this), name);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class SendableHelper {
|
||||
* @param name device name
|
||||
*/
|
||||
WPI_DEPRECATED("use SendableRegistry::SetName()")
|
||||
void SetName(const wpi::Twine& subsystem, const wpi::Twine& name) {
|
||||
void SetName(std::string_view subsystem, std::string_view name) {
|
||||
SendableRegistry::GetInstance().SetName(static_cast<Derived*>(this),
|
||||
subsystem, name);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ class SendableHelper {
|
||||
* @param subsystem subsystem name
|
||||
*/
|
||||
WPI_DEPRECATED("use SendableRegistry::SetSubsystem()")
|
||||
void SetSubsystem(const wpi::Twine& subsystem) {
|
||||
void SetSubsystem(std::string_view subsystem) {
|
||||
SendableRegistry::GetInstance().SetSubsystem(static_cast<Derived*>(this),
|
||||
subsystem);
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class SendableHelper {
|
||||
* @param channel The channel number the device is plugged into
|
||||
*/
|
||||
WPI_DEPRECATED("use SendableRegistry::SetName()")
|
||||
void SetName(const wpi::Twine& moduleType, int channel) {
|
||||
void SetName(std::string_view moduleType, int channel) {
|
||||
SendableRegistry::GetInstance().SetName(static_cast<Derived*>(this),
|
||||
moduleType, channel);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ class SendableHelper {
|
||||
* PWM)
|
||||
*/
|
||||
WPI_DEPRECATED("use SendableRegistry::SetName()")
|
||||
void SetName(const wpi::Twine& moduleType, int moduleNumber, int channel) {
|
||||
void SetName(std::string_view moduleType, int moduleNumber, int channel) {
|
||||
SendableRegistry::GetInstance().SetName(static_cast<Derived*>(this),
|
||||
moduleType, moduleNumber, channel);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <networktables/NetworkTable.h>
|
||||
#include <wpi/STLExtras.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -41,7 +41,7 @@ class SendableRegistry {
|
||||
* @param sendable object to add
|
||||
* @param name component name
|
||||
*/
|
||||
void Add(Sendable* sendable, const wpi::Twine& name);
|
||||
void Add(Sendable* sendable, std::string_view name);
|
||||
|
||||
/**
|
||||
* Adds an object to the registry.
|
||||
@@ -51,7 +51,7 @@ class SendableRegistry {
|
||||
* the value
|
||||
* @param channel The channel number the device is plugged into
|
||||
*/
|
||||
void Add(Sendable* sendable, const wpi::Twine& moduleType, int channel);
|
||||
void Add(Sendable* sendable, std::string_view moduleType, int channel);
|
||||
|
||||
/**
|
||||
* Adds an object to the registry.
|
||||
@@ -62,7 +62,7 @@ class SendableRegistry {
|
||||
* @param moduleNumber The number of the particular module type
|
||||
* @param channel The channel number the device is plugged into
|
||||
*/
|
||||
void Add(Sendable* sendable, const wpi::Twine& moduleType, int moduleNumber,
|
||||
void Add(Sendable* sendable, std::string_view moduleType, int moduleNumber,
|
||||
int channel);
|
||||
|
||||
/**
|
||||
@@ -72,8 +72,8 @@ class SendableRegistry {
|
||||
* @param subsystem subsystem name
|
||||
* @param name component name
|
||||
*/
|
||||
void Add(Sendable* sendable, const wpi::Twine& subsystem,
|
||||
const wpi::Twine& name);
|
||||
void Add(Sendable* sendable, std::string_view subsystem,
|
||||
std::string_view name);
|
||||
|
||||
/**
|
||||
* Adds an object to the registry and LiveWindow.
|
||||
@@ -81,7 +81,7 @@ class SendableRegistry {
|
||||
* @param sendable object to add
|
||||
* @param name component name
|
||||
*/
|
||||
void AddLW(Sendable* sendable, const wpi::Twine& name);
|
||||
void AddLW(Sendable* sendable, std::string_view name);
|
||||
|
||||
/**
|
||||
* Adds an object to the registry and LiveWindow.
|
||||
@@ -91,7 +91,7 @@ class SendableRegistry {
|
||||
* the value
|
||||
* @param channel The channel number the device is plugged into
|
||||
*/
|
||||
void AddLW(Sendable* sendable, const wpi::Twine& moduleType, int channel);
|
||||
void AddLW(Sendable* sendable, std::string_view moduleType, int channel);
|
||||
|
||||
/**
|
||||
* Adds an object to the registry and LiveWindow.
|
||||
@@ -102,7 +102,7 @@ class SendableRegistry {
|
||||
* @param moduleNumber The number of the particular module type
|
||||
* @param channel The channel number the device is plugged into
|
||||
*/
|
||||
void AddLW(Sendable* sendable, const wpi::Twine& moduleType, int moduleNumber,
|
||||
void AddLW(Sendable* sendable, std::string_view moduleType, int moduleNumber,
|
||||
int channel);
|
||||
|
||||
/**
|
||||
@@ -112,8 +112,8 @@ class SendableRegistry {
|
||||
* @param subsystem subsystem name
|
||||
* @param name component name
|
||||
*/
|
||||
void AddLW(Sendable* sendable, const wpi::Twine& subsystem,
|
||||
const wpi::Twine& name);
|
||||
void AddLW(Sendable* sendable, std::string_view subsystem,
|
||||
std::string_view name);
|
||||
|
||||
/**
|
||||
* Adds a child object to an object. Adds the child object to the registry
|
||||
@@ -171,7 +171,7 @@ class SendableRegistry {
|
||||
* @param sendable object
|
||||
* @param name name
|
||||
*/
|
||||
void SetName(Sendable* sendable, const wpi::Twine& name);
|
||||
void SetName(Sendable* sendable, std::string_view name);
|
||||
|
||||
/**
|
||||
* Sets the name of an object with a channel number.
|
||||
@@ -181,7 +181,7 @@ class SendableRegistry {
|
||||
* the value
|
||||
* @param channel The channel number the device is plugged into
|
||||
*/
|
||||
void SetName(Sendable* sendable, const wpi::Twine& moduleType, int channel);
|
||||
void SetName(Sendable* sendable, std::string_view moduleType, int channel);
|
||||
|
||||
/**
|
||||
* Sets the name of an object with a module and channel number.
|
||||
@@ -192,7 +192,7 @@ class SendableRegistry {
|
||||
* @param moduleNumber The number of the particular module type
|
||||
* @param channel The channel number the device is plugged into
|
||||
*/
|
||||
void SetName(Sendable* sendable, const wpi::Twine& moduleType,
|
||||
void SetName(Sendable* sendable, std::string_view moduleType,
|
||||
int moduleNumber, int channel);
|
||||
|
||||
/**
|
||||
@@ -202,8 +202,8 @@ class SendableRegistry {
|
||||
* @param subsystem subsystem name
|
||||
* @param name device name
|
||||
*/
|
||||
void SetName(Sendable* sendable, const wpi::Twine& subsystem,
|
||||
const wpi::Twine& name);
|
||||
void SetName(Sendable* sendable, std::string_view subsystem,
|
||||
std::string_view name);
|
||||
|
||||
/**
|
||||
* Gets the subsystem name of an object.
|
||||
@@ -219,7 +219,7 @@ class SendableRegistry {
|
||||
* @param sendable object
|
||||
* @param subsystem subsystem name
|
||||
*/
|
||||
void SetSubsystem(Sendable* sendable, const wpi::Twine& subsystem);
|
||||
void SetSubsystem(Sendable* sendable, std::string_view subsystem);
|
||||
|
||||
/**
|
||||
* Gets a unique handle for setting/getting data with SetData() and GetData().
|
||||
|
||||
Reference in New Issue
Block a user