Use wpi::span instead of wpi::ArrayRef across all libraries (#3414)

- Remove ArrayRef.h
- Add SpanExtras.h for a couple of convenience functions
This commit is contained in:
Peter Johnson
2021-06-06 19:51:14 -07:00
committed by GitHub
parent 2abbbd9e70
commit 64f5413253
167 changed files with 974 additions and 1433 deletions

View File

@@ -51,7 +51,7 @@ void AddressableLED::SetLength(int length) {
static_assert(sizeof(AddressableLED::LEDData) == sizeof(HAL_AddressableLEDData),
"LED Structs MUST be the same size");
void AddressableLED::SetData(wpi::ArrayRef<LEDData> ledData) {
void AddressableLED::SetData(wpi::span<const LEDData> ledData) {
int32_t status = 0;
HAL_WriteAddressableLEDData(m_handle, ledData.begin(), ledData.size(),
&status);

View File

@@ -260,7 +260,8 @@ void SPI::FreeAuto() {
FRC_CheckErrorStatus(status, "Port {}", m_port);
}
void SPI::SetAutoTransmitData(wpi::ArrayRef<uint8_t> dataToSend, int zeroSize) {
void SPI::SetAutoTransmitData(wpi::span<const uint8_t> dataToSend,
int zeroSize) {
int32_t status = 0;
HAL_SetSPIAutoTransmitData(m_port, dataToSend.data(), dataToSend.size(),
zeroSize, &status);

View File

@@ -42,7 +42,7 @@ double RobotDriveBase::ApplyDeadband(double value, double deadband) {
}
}
void RobotDriveBase::Normalize(wpi::MutableArrayRef<double> wheelSpeeds) {
void RobotDriveBase::Normalize(wpi::span<double> wheelSpeeds) {
double maxMagnitude = std::abs(wheelSpeeds[0]);
for (size_t i = 1; i < wheelSpeeds.size(); i++) {
double temp = std::abs(wheelSpeeds[i]);

View File

@@ -110,17 +110,17 @@ SimpleWidget& ShuffleboardContainer::Add(std::string_view title,
}
SimpleWidget& ShuffleboardContainer::Add(std::string_view title,
wpi::ArrayRef<bool> defaultValue) {
wpi::span<const bool> defaultValue) {
return Add(title, nt::Value::MakeBooleanArray(defaultValue));
}
SimpleWidget& ShuffleboardContainer::Add(std::string_view title,
wpi::ArrayRef<double> defaultValue) {
wpi::span<const double> defaultValue) {
return Add(title, nt::Value::MakeDoubleArray(defaultValue));
}
SimpleWidget& ShuffleboardContainer::Add(
std::string_view title, wpi::ArrayRef<std::string> defaultValue) {
std::string_view title, wpi::span<const std::string> defaultValue) {
return Add(title, nt::Value::MakeStringArray(defaultValue));
}
@@ -254,17 +254,17 @@ SimpleWidget& ShuffleboardContainer::AddPersistent(
}
SimpleWidget& ShuffleboardContainer::AddPersistent(
std::string_view title, wpi::ArrayRef<bool> defaultValue) {
std::string_view title, wpi::span<const bool> defaultValue) {
return AddPersistent(title, nt::Value::MakeBooleanArray(defaultValue));
}
SimpleWidget& ShuffleboardContainer::AddPersistent(
std::string_view title, wpi::ArrayRef<double> defaultValue) {
std::string_view title, wpi::span<const double> defaultValue) {
return AddPersistent(title, nt::Value::MakeDoubleArray(defaultValue));
}
SimpleWidget& ShuffleboardContainer::AddPersistent(
std::string_view title, wpi::ArrayRef<std::string> defaultValue) {
std::string_view title, wpi::span<const std::string> defaultValue) {
return AddPersistent(title, nt::Value::MakeStringArray(defaultValue));
}

View File

@@ -28,12 +28,12 @@ FieldObject2d& FieldObject2d::operator=(FieldObject2d&& rhs) {
}
void FieldObject2d::SetPose(const Pose2d& pose) {
SetPoses(wpi::makeArrayRef(pose));
SetPoses({pose});
}
void FieldObject2d::SetPose(units::meter_t x, units::meter_t y,
Rotation2d rotation) {
SetPoses(wpi::makeArrayRef(Pose2d{x, y, rotation}));
SetPoses({{x, y, rotation}});
}
Pose2d FieldObject2d::GetPose() const {
@@ -45,14 +45,14 @@ Pose2d FieldObject2d::GetPose() const {
return m_poses[0];
}
void FieldObject2d::SetPoses(wpi::ArrayRef<Pose2d> poses) {
void FieldObject2d::SetPoses(wpi::span<const Pose2d> poses) {
std::scoped_lock lock(m_mutex);
m_poses.assign(poses.begin(), poses.end());
UpdateEntry();
}
void FieldObject2d::SetPoses(std::initializer_list<Pose2d> poses) {
SetPoses(wpi::makeArrayRef(poses.begin(), poses.end()));
SetPoses({poses.begin(), poses.end()});
}
void FieldObject2d::SetTrajectory(const Trajectory& trajectory) {
@@ -71,7 +71,7 @@ std::vector<Pose2d> FieldObject2d::GetPoses() const {
return std::vector<Pose2d>(m_poses.begin(), m_poses.end());
}
wpi::ArrayRef<Pose2d> FieldObject2d::GetPoses(
wpi::span<const Pose2d> FieldObject2d::GetPoses(
wpi::SmallVectorImpl<Pose2d>& out) const {
std::scoped_lock lock(m_mutex);
UpdateFromEntry();

View File

@@ -177,7 +177,7 @@ void SendableBuilderImpl::AddStringProperty(
void SendableBuilderImpl::AddBooleanArrayProperty(
std::string_view key, std::function<std::vector<int>()> getter,
std::function<void(wpi::ArrayRef<int>)> setter) {
std::function<void(wpi::span<const int>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -203,7 +203,7 @@ void SendableBuilderImpl::AddBooleanArrayProperty(
void SendableBuilderImpl::AddDoubleArrayProperty(
std::string_view key, std::function<std::vector<double>()> getter,
std::function<void(wpi::ArrayRef<double>)> setter) {
std::function<void(wpi::span<const double>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -229,7 +229,7 @@ void SendableBuilderImpl::AddDoubleArrayProperty(
void SendableBuilderImpl::AddStringArrayProperty(
std::string_view key, std::function<std::vector<std::string>()> getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) {
std::function<void(wpi::span<const std::string>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -331,8 +331,8 @@ void SendableBuilderImpl::AddSmallStringProperty(
void SendableBuilderImpl::AddSmallBooleanArrayProperty(
std::string_view key,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)> getter,
std::function<void(wpi::ArrayRef<int>)> setter) {
std::function<wpi::span<const int>(wpi::SmallVectorImpl<int>& buf)> getter,
std::function<void(wpi::span<const int>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -359,9 +359,9 @@ void SendableBuilderImpl::AddSmallBooleanArrayProperty(
void SendableBuilderImpl::AddSmallDoubleArrayProperty(
std::string_view key,
std::function<wpi::ArrayRef<double>(wpi::SmallVectorImpl<double>& buf)>
std::function<wpi::span<const double>(wpi::SmallVectorImpl<double>& buf)>
getter,
std::function<void(wpi::ArrayRef<double>)> setter) {
std::function<void(wpi::span<const double>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,
@@ -389,9 +389,9 @@ void SendableBuilderImpl::AddSmallDoubleArrayProperty(
void SendableBuilderImpl::AddSmallStringArrayProperty(
std::string_view key,
std::function<
wpi::ArrayRef<std::string>(wpi::SmallVectorImpl<std::string>& buf)>
wpi::span<const std::string>(wpi::SmallVectorImpl<std::string>& buf)>
getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) {
std::function<void(wpi::span<const std::string>)> setter) {
m_properties.emplace_back(*m_table, key);
if (getter) {
m_properties.back().update = [=](nt::NetworkTableEntry entry,

View File

@@ -170,52 +170,52 @@ std::string SmartDashboard::GetString(std::string_view keyName,
}
bool SmartDashboard::PutBooleanArray(std::string_view key,
wpi::ArrayRef<int> value) {
wpi::span<const int> value) {
return Singleton::GetInstance().table->GetEntry(key).SetBooleanArray(value);
}
bool SmartDashboard::SetDefaultBooleanArray(std::string_view key,
wpi::ArrayRef<int> defaultValue) {
wpi::span<const int> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultBooleanArray(
defaultValue);
}
std::vector<int> SmartDashboard::GetBooleanArray(
std::string_view key, wpi::ArrayRef<int> defaultValue) {
std::string_view key, wpi::span<const int> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).GetBooleanArray(
defaultValue);
}
bool SmartDashboard::PutNumberArray(std::string_view key,
wpi::ArrayRef<double> value) {
wpi::span<const double> value) {
return Singleton::GetInstance().table->GetEntry(key).SetDoubleArray(value);
}
bool SmartDashboard::SetDefaultNumberArray(std::string_view key,
wpi::ArrayRef<double> defaultValue) {
bool SmartDashboard::SetDefaultNumberArray(
std::string_view key, wpi::span<const double> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultDoubleArray(
defaultValue);
}
std::vector<double> SmartDashboard::GetNumberArray(
std::string_view key, wpi::ArrayRef<double> defaultValue) {
std::string_view key, wpi::span<const double> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).GetDoubleArray(
defaultValue);
}
bool SmartDashboard::PutStringArray(std::string_view key,
wpi::ArrayRef<std::string> value) {
wpi::span<const std::string> value) {
return Singleton::GetInstance().table->GetEntry(key).SetStringArray(value);
}
bool SmartDashboard::SetDefaultStringArray(
std::string_view key, wpi::ArrayRef<std::string> defaultValue) {
std::string_view key, wpi::span<const std::string> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).SetDefaultStringArray(
defaultValue);
}
std::vector<std::string> SmartDashboard::GetStringArray(
std::string_view key, wpi::ArrayRef<std::string> defaultValue) {
std::string_view key, wpi::span<const std::string> defaultValue) {
return Singleton::GetInstance().table->GetEntry(key).GetStringArray(
defaultValue);
}

View File

@@ -9,7 +9,7 @@
#include <hal/AddressableLEDTypes.h>
#include <hal/Types.h>
#include <units/time.h>
#include <wpi/ArrayRef.h>
#include <wpi/span.h>
#include "util/Color.h"
#include "util/Color8Bit.h"
@@ -107,7 +107,7 @@ class AddressableLED {
*
* @param ledData the buffer to write
*/
void SetData(wpi::ArrayRef<LEDData> ledData);
void SetData(wpi::span<const LEDData> ledData);
/**
* Sets the led output data.

View File

@@ -10,8 +10,8 @@
#include <hal/SPITypes.h>
#include <units/time.h>
#include <wpi/ArrayRef.h>
#include <wpi/deprecated.h>
#include <wpi/span.h>
namespace frc {
@@ -173,7 +173,7 @@ class SPI {
* @param dataToSend data to send (maximum 16 bytes)
* @param zeroSize number of zeros to send after the data
*/
void SetAutoTransmitData(wpi::ArrayRef<uint8_t> dataToSend, int zeroSize);
void SetAutoTransmitData(wpi::span<const uint8_t> dataToSend, int zeroSize);
/**
* Start running the automatic SPI transfer engine at a periodic rate.

View File

@@ -7,7 +7,7 @@
#include <memory>
#include <string>
#include <wpi/ArrayRef.h>
#include <wpi/span.h>
#include "frc/MotorSafety.h"
@@ -82,7 +82,7 @@ class RobotDriveBase : public MotorSafety {
* Normalize all wheel speeds if the magnitude of any wheel is greater than
* 1.0.
*/
static void Normalize(wpi::MutableArrayRef<double> wheelSpeeds);
static void Normalize(wpi::span<double> wheelSpeeds);
double m_deadband = 0.02;
double m_maxOutput = 1.0;

View File

@@ -12,9 +12,9 @@
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableValue.h>
#include <wpi/ArrayRef.h>
#include <wpi/SmallSet.h>
#include <wpi/StringMap.h>
#include <wpi/span.h>
#include "frc/shuffleboard/BuiltInLayouts.h"
#include "frc/shuffleboard/LayoutType.h"
@@ -228,19 +228,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
* container with the given title
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
*/
SimpleWidget& Add(std::string_view title, wpi::ArrayRef<bool> defaultValue);
/**
* Adds a widget to this container to display the given data.
*
* @param title the title of the widget
* @param defaultValue the default value of the widget
* @return a widget to display the sendable data
* @throws IllegalArgumentException if a widget already exists in this
* container with the given title
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
*/
SimpleWidget& Add(std::string_view title, wpi::ArrayRef<double> defaultValue);
SimpleWidget& Add(std::string_view title, wpi::span<const bool> defaultValue);
/**
* Adds a widget to this container to display the given data.
@@ -253,7 +241,20 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
*/
SimpleWidget& Add(std::string_view title,
wpi::ArrayRef<std::string> defaultValue);
wpi::span<const double> defaultValue);
/**
* Adds a widget to this container to display the given data.
*
* @param title the title of the widget
* @param defaultValue the default value of the widget
* @return a widget to display the sendable data
* @throws IllegalArgumentException if a widget already exists in this
* container with the given title
* @see #addPersistent(String, Object) add(String title, Object defaultValue)
*/
SimpleWidget& Add(std::string_view title,
wpi::span<const std::string> defaultValue);
/**
* Adds a widget to this container. The widget will display the data provided
@@ -432,7 +433,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
* @see #add(String, Object) add(String title, Object defaultValue)
*/
SimpleWidget& AddPersistent(std::string_view title,
wpi::ArrayRef<bool> defaultValue);
wpi::span<const bool> defaultValue);
/**
* Adds a widget to this container to display a simple piece of data.
@@ -447,7 +448,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
* @see #add(String, Object) add(String title, Object defaultValue)
*/
SimpleWidget& AddPersistent(std::string_view title,
wpi::ArrayRef<double> defaultValue);
wpi::span<const double> defaultValue);
/**
* Adds a widget to this container to display a simple piece of data.
@@ -462,7 +463,7 @@ class ShuffleboardContainer : public virtual ShuffleboardValue {
* @see #add(String, Object) add(String title, Object defaultValue)
*/
SimpleWidget& AddPersistent(std::string_view title,
wpi::ArrayRef<std::string> defaultValue);
wpi::span<const std::string> defaultValue);
void EnableIfActuator() override;

View File

@@ -12,9 +12,9 @@
#include <networktables/NetworkTableEntry.h>
#include <units/length.h>
#include <wpi/ArrayRef.h>
#include <wpi/SmallVector.h>
#include <wpi/mutex.h>
#include <wpi/span.h>
#include "frc/geometry/Pose2d.h"
#include "frc/geometry/Rotation2d.h"
@@ -66,7 +66,7 @@ class FieldObject2d {
*
* @param poses array of 2D poses
*/
void SetPoses(wpi::ArrayRef<Pose2d> poses);
void SetPoses(wpi::span<const Pose2d> poses);
/**
* Set multiple poses from an array of Pose objects.
@@ -97,9 +97,9 @@ class FieldObject2d {
*
* @param obj Object entry
* @param out output SmallVector to hold 2D poses
* @return ArrayRef referring to output SmallVector
* @return span referring to output SmallVector
*/
wpi::ArrayRef<Pose2d> GetPoses(wpi::SmallVectorImpl<Pose2d>& out) const;
wpi::span<const Pose2d> GetPoses(wpi::SmallVectorImpl<Pose2d>& out) const;
private:
void UpdateEntry(bool setDefault = false);

View File

@@ -13,8 +13,8 @@
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableValue.h>
#include <wpi/ArrayRef.h>
#include <wpi/SmallVector.h>
#include <wpi/span.h>
namespace frc {
@@ -107,7 +107,7 @@ class SendableBuilder {
*/
virtual void AddBooleanArrayProperty(
std::string_view key, std::function<std::vector<int>()> getter,
std::function<void(wpi::ArrayRef<int>)> setter) = 0;
std::function<void(wpi::span<const int>)> setter) = 0;
/**
* Add a double array property.
@@ -118,7 +118,7 @@ class SendableBuilder {
*/
virtual void AddDoubleArrayProperty(
std::string_view key, std::function<std::vector<double>()> getter,
std::function<void(wpi::ArrayRef<double>)> setter) = 0;
std::function<void(wpi::span<const double>)> setter) = 0;
/**
* Add a string array property.
@@ -129,7 +129,7 @@ class SendableBuilder {
*/
virtual void AddStringArrayProperty(
std::string_view key, std::function<std::vector<std::string>()> getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) = 0;
std::function<void(wpi::span<const std::string>)> setter) = 0;
/**
* Add a raw property.
@@ -174,8 +174,9 @@ class SendableBuilder {
*/
virtual void AddSmallBooleanArrayProperty(
std::string_view key,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)> getter,
std::function<void(wpi::ArrayRef<int>)> setter) = 0;
std::function<wpi::span<const int>(wpi::SmallVectorImpl<int>& buf)>
getter,
std::function<void(wpi::span<const int>)> setter) = 0;
/**
* Add a double array property (SmallVector form).
@@ -186,9 +187,9 @@ class SendableBuilder {
*/
virtual void AddSmallDoubleArrayProperty(
std::string_view key,
std::function<wpi::ArrayRef<double>(wpi::SmallVectorImpl<double>& buf)>
std::function<wpi::span<const double>(wpi::SmallVectorImpl<double>& buf)>
getter,
std::function<void(wpi::ArrayRef<double>)> setter) = 0;
std::function<void(wpi::span<const double>)> setter) = 0;
/**
* Add a string array property (SmallVector form).
@@ -200,9 +201,9 @@ class SendableBuilder {
virtual void AddSmallStringArrayProperty(
std::string_view key,
std::function<
wpi::ArrayRef<std::string>(wpi::SmallVectorImpl<std::string>& buf)>
wpi::span<const std::string>(wpi::SmallVectorImpl<std::string>& buf)>
getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) = 0;
std::function<void(wpi::span<const std::string>)> setter) = 0;
/**
* Add a raw property (SmallVector form).

View File

@@ -14,8 +14,8 @@
#include <networktables/NetworkTable.h>
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableValue.h>
#include <wpi/ArrayRef.h>
#include <wpi/SmallVector.h>
#include <wpi/span.h>
#include "frc/smartdashboard/SendableBuilder.h"
@@ -104,15 +104,15 @@ class SendableBuilderImpl : public SendableBuilder {
void AddBooleanArrayProperty(
std::string_view key, std::function<std::vector<int>()> getter,
std::function<void(wpi::ArrayRef<int>)> setter) override;
std::function<void(wpi::span<const int>)> setter) override;
void AddDoubleArrayProperty(
std::string_view key, std::function<std::vector<double>()> getter,
std::function<void(wpi::ArrayRef<double>)> setter) override;
std::function<void(wpi::span<const double>)> setter) override;
void AddStringArrayProperty(
std::string_view key, std::function<std::vector<std::string>()> getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) override;
std::function<void(wpi::span<const std::string>)> setter) override;
void AddRawProperty(std::string_view key, std::function<std::string()> getter,
std::function<void(std::string_view)> setter) override;
@@ -128,21 +128,22 @@ class SendableBuilderImpl : public SendableBuilder {
void AddSmallBooleanArrayProperty(
std::string_view key,
std::function<wpi::ArrayRef<int>(wpi::SmallVectorImpl<int>& buf)> getter,
std::function<void(wpi::ArrayRef<int>)> setter) override;
std::function<wpi::span<const int>(wpi::SmallVectorImpl<int>& buf)>
getter,
std::function<void(wpi::span<const int>)> setter) override;
void AddSmallDoubleArrayProperty(
std::string_view key,
std::function<wpi::ArrayRef<double>(wpi::SmallVectorImpl<double>& buf)>
std::function<wpi::span<const double>(wpi::SmallVectorImpl<double>& buf)>
getter,
std::function<void(wpi::ArrayRef<double>)> setter) override;
std::function<void(wpi::span<const double>)> setter) override;
void AddSmallStringArrayProperty(
std::string_view key,
std::function<
wpi::ArrayRef<std::string>(wpi::SmallVectorImpl<std::string>& buf)>
wpi::span<const std::string>(wpi::SmallVectorImpl<std::string>& buf)>
getter,
std::function<void(wpi::ArrayRef<std::string>)> setter) override;
std::function<void(wpi::span<const std::string>)> setter) override;
void AddSmallRawProperty(
std::string_view key,

View File

@@ -11,6 +11,7 @@
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableValue.h>
#include <wpi/span.h>
#include "frc/smartdashboard/ListenerExecutor.h"
#include "frc/smartdashboard/Sendable.h"
@@ -243,7 +244,7 @@ class SmartDashboard : public Sendable, public SendableHelper<SmartDashboard> {
* std::vector<bool> is special-cased in C++. 0 is false, any
* non-zero value is true.
*/
static bool PutBooleanArray(std::string_view key, wpi::ArrayRef<int> value);
static bool PutBooleanArray(std::string_view key, wpi::span<const int> value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -253,7 +254,7 @@ class SmartDashboard : public Sendable, public SendableHelper<SmartDashboard> {
* @returns False if the table key exists with a different type
*/
static bool SetDefaultBooleanArray(std::string_view key,
wpi::ArrayRef<int> defaultValue);
wpi::span<const int> defaultValue);
/**
* Returns the boolean array the key maps to.
@@ -274,7 +275,7 @@ class SmartDashboard : public Sendable, public SendableHelper<SmartDashboard> {
* non-zero value is true.
*/
static std::vector<int> GetBooleanArray(std::string_view key,
wpi::ArrayRef<int> defaultValue);
wpi::span<const int> defaultValue);
/**
* Put a number array in the table.
@@ -283,7 +284,8 @@ class SmartDashboard : public Sendable, public SendableHelper<SmartDashboard> {
* @param value The value that will be assigned.
* @return False if the table key already exists with a different type
*/
static bool PutNumberArray(std::string_view key, wpi::ArrayRef<double> value);
static bool PutNumberArray(std::string_view key,
wpi::span<const double> value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -293,7 +295,7 @@ class SmartDashboard : public Sendable, public SendableHelper<SmartDashboard> {
* @returns False if the table key exists with a different type
*/
static bool SetDefaultNumberArray(std::string_view key,
wpi::ArrayRef<double> defaultValue);
wpi::span<const double> defaultValue);
/**
* Returns the number array the key maps to.
@@ -309,8 +311,8 @@ class SmartDashboard : public Sendable, public SendableHelper<SmartDashboard> {
* @note This makes a copy of the array. If the overhead of this is a concern,
* use GetValue() instead.
*/
static std::vector<double> GetNumberArray(std::string_view key,
wpi::ArrayRef<double> defaultValue);
static std::vector<double> GetNumberArray(
std::string_view key, wpi::span<const double> defaultValue);
/**
* Put a string array in the table.
@@ -320,7 +322,7 @@ class SmartDashboard : public Sendable, public SendableHelper<SmartDashboard> {
* @return False if the table key already exists with a different type
*/
static bool PutStringArray(std::string_view key,
wpi::ArrayRef<std::string> value);
wpi::span<const std::string> value);
/**
* Gets the current value in the table, setting it if it does not exist.
@@ -330,7 +332,7 @@ class SmartDashboard : public Sendable, public SendableHelper<SmartDashboard> {
* @returns False if the table key exists with a different type
*/
static bool SetDefaultStringArray(std::string_view key,
wpi::ArrayRef<std::string> defaultValue);
wpi::span<const std::string> defaultValue);
/**
* Returns the string array the key maps to.
@@ -347,7 +349,7 @@ class SmartDashboard : public Sendable, public SendableHelper<SmartDashboard> {
* use GetValue() instead.
*/
static std::vector<std::string> GetStringArray(
std::string_view key, wpi::ArrayRef<std::string> defaultValue);
std::string_view key, wpi::span<const std::string> defaultValue);
/**
* Put a raw value (byte array) in the table.