mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Upgrade to C++20 (#4239)
* Use explicit this capture required by C++20 * Use C++20 span * Replace wpi::numbers with std::numbers * Fix C++20 clang-tidy warning false positive in fmt * Remove ciso646 include since C++20 removed that header * Fix global-buffer-overflow asan warnings in ntcore tests * Add DIOSetProxy constructor to HAL * Upgrade MSVC compiler to 2022 * Bump native-utils to 2023.2.7 (changes to std=c++20) Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
This commit is contained in:
@@ -7,8 +7,6 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "ntcore_cpp.h"
|
||||
|
||||
namespace nt {
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "networktables/ConnectionListener.h"
|
||||
#include "networktables/NetworkTableInstance.h"
|
||||
#include "ntcore_cpp.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
@@ -97,7 +98,7 @@ class GenericSubscriber : public Subscriber {
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
std::vector<uint8_t> GetRaw(wpi::span<const uint8_t> defaultValue) const;
|
||||
std::vector<uint8_t> GetRaw(std::span<const uint8_t> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist
|
||||
@@ -113,7 +114,7 @@ class GenericSubscriber : public Subscriber {
|
||||
* because std::vector<bool> is special-cased in C++. 0 is false, any
|
||||
* non-zero value is true.
|
||||
*/
|
||||
std::vector<int> GetBooleanArray(wpi::span<const int> defaultValue) const;
|
||||
std::vector<int> GetBooleanArray(std::span<const int> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a integer array. If the entry does not exist
|
||||
@@ -126,7 +127,7 @@ class GenericSubscriber : public Subscriber {
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<int64_t> GetIntegerArray(
|
||||
wpi::span<const int64_t> defaultValue) const;
|
||||
std::span<const int64_t> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a float array. If the entry does not exist
|
||||
@@ -138,7 +139,7 @@ class GenericSubscriber : public Subscriber {
|
||||
* @note This makes a copy of the array. If the overhead of this is a
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<float> GetFloatArray(wpi::span<const float> defaultValue) const;
|
||||
std::vector<float> GetFloatArray(std::span<const float> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a double array. If the entry does not exist
|
||||
@@ -151,7 +152,7 @@ class GenericSubscriber : public Subscriber {
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<double> GetDoubleArray(
|
||||
wpi::span<const double> defaultValue) const;
|
||||
std::span<const double> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a string array. If the entry does not exist
|
||||
@@ -164,7 +165,7 @@ class GenericSubscriber : public Subscriber {
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<std::string> GetStringArray(
|
||||
wpi::span<const std::string> defaultValue) const;
|
||||
std::span<const std::string> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to ReadQueue.
|
||||
@@ -265,7 +266,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetRaw(wpi::span<const uint8_t> value, int64_t time = 0);
|
||||
bool SetRaw(std::span<const uint8_t> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -274,7 +275,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetBooleanArray(wpi::span<const bool> value, int64_t time = 0);
|
||||
bool SetBooleanArray(std::span<const bool> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -283,7 +284,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetBooleanArray(wpi::span<const int> value, int64_t time = 0);
|
||||
bool SetBooleanArray(std::span<const int> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -292,7 +293,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetIntegerArray(wpi::span<const int64_t> value, int64_t time = 0);
|
||||
bool SetIntegerArray(std::span<const int64_t> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -301,7 +302,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetFloatArray(wpi::span<const float> value, int64_t time = 0);
|
||||
bool SetFloatArray(std::span<const float> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -310,7 +311,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDoubleArray(wpi::span<const double> value, int64_t time = 0);
|
||||
bool SetDoubleArray(std::span<const double> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -319,7 +320,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetStringArray(wpi::span<const std::string> value, int64_t time = 0);
|
||||
bool SetStringArray(std::span<const std::string> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Publish a default value.
|
||||
@@ -376,7 +377,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultRaw(wpi::span<const uint8_t> defaultValue);
|
||||
bool SetDefaultRaw(std::span<const uint8_t> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -384,7 +385,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultBooleanArray(wpi::span<const int> defaultValue);
|
||||
bool SetDefaultBooleanArray(std::span<const int> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -392,7 +393,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultIntegerArray(wpi::span<const int64_t> defaultValue);
|
||||
bool SetDefaultIntegerArray(std::span<const int64_t> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -400,7 +401,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultFloatArray(wpi::span<const float> defaultValue);
|
||||
bool SetDefaultFloatArray(std::span<const float> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -408,7 +409,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultDoubleArray(wpi::span<const double> defaultValue);
|
||||
bool SetDefaultDoubleArray(std::span<const double> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -416,7 +417,7 @@ class GenericPublisher : public Publisher {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultStringArray(wpi::span<const std::string> defaultValue);
|
||||
bool SetDefaultStringArray(std::span<const std::string> defaultValue);
|
||||
|
||||
/**
|
||||
* Get the corresponding topic.
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
@@ -43,32 +44,32 @@ inline std::string GenericSubscriber::GetString(
|
||||
}
|
||||
|
||||
inline std::vector<uint8_t> GenericSubscriber::GetRaw(
|
||||
wpi::span<const uint8_t> defaultValue) const {
|
||||
std::span<const uint8_t> defaultValue) const {
|
||||
return ::nt::GetRaw(m_subHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<int> GenericSubscriber::GetBooleanArray(
|
||||
wpi::span<const int> defaultValue) const {
|
||||
std::span<const int> defaultValue) const {
|
||||
return ::nt::GetBooleanArray(m_subHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<int64_t> GenericSubscriber::GetIntegerArray(
|
||||
wpi::span<const int64_t> defaultValue) const {
|
||||
std::span<const int64_t> defaultValue) const {
|
||||
return ::nt::GetIntegerArray(m_subHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<float> GenericSubscriber::GetFloatArray(
|
||||
wpi::span<const float> defaultValue) const {
|
||||
std::span<const float> defaultValue) const {
|
||||
return ::nt::GetFloatArray(m_subHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<double> GenericSubscriber::GetDoubleArray(
|
||||
wpi::span<const double> defaultValue) const {
|
||||
std::span<const double> defaultValue) const {
|
||||
return ::nt::GetDoubleArray(m_subHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<std::string> GenericSubscriber::GetStringArray(
|
||||
wpi::span<const std::string> defaultValue) const {
|
||||
std::span<const std::string> defaultValue) const {
|
||||
return ::nt::GetStringArray(m_subHandle, defaultValue);
|
||||
}
|
||||
|
||||
@@ -107,37 +108,37 @@ inline bool GenericPublisher::SetString(std::string_view value, int64_t time) {
|
||||
return nt::SetString(m_pubHandle, value, time);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetRaw(wpi::span<const uint8_t> value,
|
||||
inline bool GenericPublisher::SetRaw(std::span<const uint8_t> value,
|
||||
int64_t time) {
|
||||
return nt::SetRaw(m_pubHandle, value, time);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetBooleanArray(wpi::span<const bool> value,
|
||||
inline bool GenericPublisher::SetBooleanArray(std::span<const bool> value,
|
||||
int64_t time) {
|
||||
return SetEntryValue(m_pubHandle, Value::MakeBooleanArray(value, time));
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetBooleanArray(wpi::span<const int> value,
|
||||
inline bool GenericPublisher::SetBooleanArray(std::span<const int> value,
|
||||
int64_t time) {
|
||||
return nt::SetBooleanArray(m_pubHandle, value, time);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetIntegerArray(wpi::span<const int64_t> value,
|
||||
inline bool GenericPublisher::SetIntegerArray(std::span<const int64_t> value,
|
||||
int64_t time) {
|
||||
return nt::SetIntegerArray(m_pubHandle, value, time);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetFloatArray(wpi::span<const float> value,
|
||||
inline bool GenericPublisher::SetFloatArray(std::span<const float> value,
|
||||
int64_t time) {
|
||||
return nt::SetFloatArray(m_pubHandle, value, time);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetDoubleArray(wpi::span<const double> value,
|
||||
inline bool GenericPublisher::SetDoubleArray(std::span<const double> value,
|
||||
int64_t time) {
|
||||
return nt::SetDoubleArray(m_pubHandle, value, time);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetStringArray(wpi::span<const std::string> value,
|
||||
inline bool GenericPublisher::SetStringArray(std::span<const std::string> value,
|
||||
int64_t time) {
|
||||
return nt::SetStringArray(m_pubHandle, value, time);
|
||||
}
|
||||
@@ -167,32 +168,32 @@ inline bool GenericPublisher::SetDefaultString(std::string_view defaultValue) {
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetDefaultRaw(
|
||||
wpi::span<const uint8_t> defaultValue) {
|
||||
std::span<const uint8_t> defaultValue) {
|
||||
return nt::SetDefaultRaw(m_pubHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetDefaultBooleanArray(
|
||||
wpi::span<const int> defaultValue) {
|
||||
std::span<const int> defaultValue) {
|
||||
return nt::SetDefaultBooleanArray(m_pubHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetDefaultIntegerArray(
|
||||
wpi::span<const int64_t> defaultValue) {
|
||||
std::span<const int64_t> defaultValue) {
|
||||
return nt::SetDefaultIntegerArray(m_pubHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetDefaultFloatArray(
|
||||
wpi::span<const float> defaultValue) {
|
||||
std::span<const float> defaultValue) {
|
||||
return nt::SetDefaultFloatArray(m_pubHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetDefaultDoubleArray(
|
||||
wpi::span<const double> defaultValue) {
|
||||
std::span<const double> defaultValue) {
|
||||
return nt::SetDefaultDoubleArray(m_pubHandle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool GenericPublisher::SetDefaultStringArray(
|
||||
wpi::span<const std::string> defaultValue) {
|
||||
std::span<const std::string> defaultValue) {
|
||||
return nt::SetDefaultStringArray(m_pubHandle, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "networktables/NetworkTableInstance.h"
|
||||
#include "ntcore_cpp.h"
|
||||
|
||||
@@ -30,8 +29,8 @@ class MultiSubscriber final {
|
||||
* @param options subscriber options
|
||||
*/
|
||||
MultiSubscriber(NetworkTableInstance inst,
|
||||
wpi::span<const std::string_view> prefixes,
|
||||
wpi::span<const PubSubOption> options = {});
|
||||
std::span<const std::string_view> prefixes,
|
||||
std::span<const PubSubOption> options = {});
|
||||
|
||||
MultiSubscriber(const MultiSubscriber&) = delete;
|
||||
MultiSubscriber& operator=(const MultiSubscriber&) = delete;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
namespace nt {
|
||||
|
||||
inline MultiSubscriber::MultiSubscriber(
|
||||
NetworkTableInstance inst, wpi::span<const std::string_view> prefixes,
|
||||
wpi::span<const PubSubOption> options)
|
||||
NetworkTableInstance inst, std::span<const std::string_view> prefixes,
|
||||
std::span<const PubSubOption> options)
|
||||
: m_handle{::nt::SubscribeMultiple(inst.GetHandle(), prefixes, options)} {}
|
||||
|
||||
inline MultiSubscriber::MultiSubscriber(MultiSubscriber&& rhs)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
@@ -13,7 +14,6 @@
|
||||
|
||||
#include <wpi/StringMap.h>
|
||||
#include <wpi/mutex.h>
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "networktables/NetworkTableEntry.h"
|
||||
#include "ntcore_c.h"
|
||||
@@ -400,7 +400,7 @@ class NetworkTable final {
|
||||
* std::vector<bool> is special-cased in C++. 0 is false, any
|
||||
* non-zero value is true.
|
||||
*/
|
||||
bool PutBooleanArray(std::string_view key, wpi::span<const int> value);
|
||||
bool PutBooleanArray(std::string_view key, std::span<const int> value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
@@ -410,7 +410,7 @@ class NetworkTable final {
|
||||
* @return False if the table key exists with a different type
|
||||
*/
|
||||
bool SetDefaultBooleanArray(std::string_view key,
|
||||
wpi::span<const int> defaultValue);
|
||||
std::span<const int> defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the boolean array the key maps to. If the key does not exist or is
|
||||
@@ -429,7 +429,7 @@ class NetworkTable final {
|
||||
* non-zero value is true.
|
||||
*/
|
||||
std::vector<int> GetBooleanArray(std::string_view key,
|
||||
wpi::span<const int> defaultValue) const;
|
||||
std::span<const int> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Put a number array in the table
|
||||
@@ -438,7 +438,7 @@ class NetworkTable final {
|
||||
* @param value the value that will be assigned
|
||||
* @return False if the table key already exists with a different type
|
||||
*/
|
||||
bool PutNumberArray(std::string_view key, wpi::span<const double> value);
|
||||
bool PutNumberArray(std::string_view key, std::span<const double> value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
@@ -448,7 +448,7 @@ class NetworkTable final {
|
||||
* @returns False if the table key exists with a different type
|
||||
*/
|
||||
bool SetDefaultNumberArray(std::string_view key,
|
||||
wpi::span<const double> defaultValue);
|
||||
std::span<const double> defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the number array the key maps to. If the key does not exist or is
|
||||
@@ -463,7 +463,7 @@ class NetworkTable final {
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<double> GetNumberArray(
|
||||
std::string_view key, wpi::span<const double> defaultValue) const;
|
||||
std::string_view key, std::span<const double> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Put a string array in the table
|
||||
@@ -472,7 +472,7 @@ class NetworkTable final {
|
||||
* @param value the value that will be assigned
|
||||
* @return False if the table key already exists with a different type
|
||||
*/
|
||||
bool PutStringArray(std::string_view key, wpi::span<const std::string> value);
|
||||
bool PutStringArray(std::string_view key, std::span<const std::string> value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
@@ -482,7 +482,7 @@ class NetworkTable final {
|
||||
* @returns False if the table key exists with a different type
|
||||
*/
|
||||
bool SetDefaultStringArray(std::string_view key,
|
||||
wpi::span<const std::string> defaultValue);
|
||||
std::span<const std::string> defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the string array the key maps to. If the key does not exist or is
|
||||
@@ -497,7 +497,7 @@ class NetworkTable final {
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<std::string> GetStringArray(
|
||||
std::string_view key, wpi::span<const std::string> defaultValue) const;
|
||||
std::string_view key, std::span<const std::string> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Put a raw value (byte array) in the table
|
||||
@@ -506,7 +506,7 @@ class NetworkTable final {
|
||||
* @param value the value that will be assigned
|
||||
* @return False if the table key already exists with a different type
|
||||
*/
|
||||
bool PutRaw(std::string_view key, wpi::span<const uint8_t> value);
|
||||
bool PutRaw(std::string_view key, std::span<const uint8_t> value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
@@ -516,7 +516,7 @@ class NetworkTable final {
|
||||
* @return False if the table key exists with a different type
|
||||
*/
|
||||
bool SetDefaultRaw(std::string_view key,
|
||||
wpi::span<const uint8_t> defaultValue);
|
||||
std::span<const uint8_t> defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the raw value (byte array) the key maps to. If the key does not
|
||||
@@ -531,7 +531,7 @@ class NetworkTable final {
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<uint8_t> GetRaw(std::string_view key,
|
||||
wpi::span<const uint8_t> defaultValue) const;
|
||||
std::span<const uint8_t> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Put a value in the table
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "networktables/NetworkTableType.h"
|
||||
#include "networktables/NetworkTableValue.h"
|
||||
@@ -170,7 +170,7 @@ class NetworkTableEntry final {
|
||||
* @param defaultValue the value to be returned if no value is found
|
||||
* @return the entry's value or the given default value
|
||||
*/
|
||||
std::vector<uint8_t> GetRaw(wpi::span<const uint8_t> defaultValue) const;
|
||||
std::vector<uint8_t> GetRaw(std::span<const uint8_t> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a boolean array. If the entry does not exist
|
||||
@@ -186,7 +186,7 @@ class NetworkTableEntry final {
|
||||
* because std::vector<bool> is special-cased in C++. 0 is false, any
|
||||
* non-zero value is true.
|
||||
*/
|
||||
std::vector<int> GetBooleanArray(wpi::span<const int> defaultValue) const;
|
||||
std::vector<int> GetBooleanArray(std::span<const int> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a integer array. If the entry does not exist
|
||||
@@ -199,7 +199,7 @@ class NetworkTableEntry final {
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<int64_t> GetIntegerArray(
|
||||
wpi::span<const int64_t> defaultValue) const;
|
||||
std::span<const int64_t> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a float array. If the entry does not exist
|
||||
@@ -211,7 +211,7 @@ class NetworkTableEntry final {
|
||||
* @note This makes a copy of the array. If the overhead of this is a
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<float> GetFloatArray(wpi::span<const float> defaultValue) const;
|
||||
std::vector<float> GetFloatArray(std::span<const float> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a double array. If the entry does not exist
|
||||
@@ -224,7 +224,7 @@ class NetworkTableEntry final {
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<double> GetDoubleArray(
|
||||
wpi::span<const double> defaultValue) const;
|
||||
std::span<const double> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Gets the entry's value as a string array. If the entry does not exist
|
||||
@@ -237,7 +237,7 @@ class NetworkTableEntry final {
|
||||
* concern, use GetValue() instead.
|
||||
*/
|
||||
std::vector<std::string> GetStringArray(
|
||||
wpi::span<const std::string> defaultValue) const;
|
||||
std::span<const std::string> defaultValue) const;
|
||||
|
||||
/**
|
||||
* Get an array of all value changes since the last call to ReadQueue.
|
||||
@@ -303,7 +303,7 @@ class NetworkTableEntry final {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultRaw(wpi::span<const uint8_t> defaultValue);
|
||||
bool SetDefaultRaw(std::span<const uint8_t> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -311,7 +311,7 @@ class NetworkTableEntry final {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultBooleanArray(wpi::span<const int> defaultValue);
|
||||
bool SetDefaultBooleanArray(std::span<const int> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -319,7 +319,7 @@ class NetworkTableEntry final {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultIntegerArray(wpi::span<const int64_t> defaultValue);
|
||||
bool SetDefaultIntegerArray(std::span<const int64_t> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -327,7 +327,7 @@ class NetworkTableEntry final {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultFloatArray(wpi::span<const float> defaultValue);
|
||||
bool SetDefaultFloatArray(std::span<const float> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -335,7 +335,7 @@ class NetworkTableEntry final {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultDoubleArray(wpi::span<const double> defaultValue);
|
||||
bool SetDefaultDoubleArray(std::span<const double> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value if it does not exist.
|
||||
@@ -343,7 +343,7 @@ class NetworkTableEntry final {
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDefaultStringArray(wpi::span<const std::string> defaultValue);
|
||||
bool SetDefaultStringArray(std::span<const std::string> defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -405,7 +405,7 @@ class NetworkTableEntry final {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetRaw(wpi::span<const uint8_t> value, int64_t time = 0);
|
||||
bool SetRaw(std::span<const uint8_t> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -414,7 +414,7 @@ class NetworkTableEntry final {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetBooleanArray(wpi::span<const bool> value, int64_t time = 0);
|
||||
bool SetBooleanArray(std::span<const bool> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -423,7 +423,7 @@ class NetworkTableEntry final {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetBooleanArray(wpi::span<const int> value, int64_t time = 0);
|
||||
bool SetBooleanArray(std::span<const int> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -432,7 +432,7 @@ class NetworkTableEntry final {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetIntegerArray(wpi::span<const int64_t> value, int64_t time = 0);
|
||||
bool SetIntegerArray(std::span<const int64_t> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -441,7 +441,7 @@ class NetworkTableEntry final {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetFloatArray(wpi::span<const float> value, int64_t time = 0);
|
||||
bool SetFloatArray(std::span<const float> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -450,7 +450,7 @@ class NetworkTableEntry final {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetDoubleArray(wpi::span<const double> value, int64_t time = 0);
|
||||
bool SetDoubleArray(std::span<const double> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets the entry's value.
|
||||
@@ -459,7 +459,7 @@ class NetworkTableEntry final {
|
||||
* @param time the timestamp to set (0 = nt::Now())
|
||||
* @return False if the entry exists with a different type
|
||||
*/
|
||||
bool SetStringArray(wpi::span<const std::string> value, int64_t time = 0);
|
||||
bool SetStringArray(std::span<const std::string> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Sets flags.
|
||||
|
||||
@@ -70,32 +70,32 @@ inline std::string NetworkTableEntry::GetString(
|
||||
}
|
||||
|
||||
inline std::vector<uint8_t> NetworkTableEntry::GetRaw(
|
||||
wpi::span<const uint8_t> defaultValue) const {
|
||||
std::span<const uint8_t> defaultValue) const {
|
||||
return nt::GetRaw(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<int> NetworkTableEntry::GetBooleanArray(
|
||||
wpi::span<const int> defaultValue) const {
|
||||
std::span<const int> defaultValue) const {
|
||||
return nt::GetBooleanArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<int64_t> NetworkTableEntry::GetIntegerArray(
|
||||
wpi::span<const int64_t> defaultValue) const {
|
||||
std::span<const int64_t> defaultValue) const {
|
||||
return nt::GetIntegerArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<float> NetworkTableEntry::GetFloatArray(
|
||||
wpi::span<const float> defaultValue) const {
|
||||
std::span<const float> defaultValue) const {
|
||||
return nt::GetFloatArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<double> NetworkTableEntry::GetDoubleArray(
|
||||
wpi::span<const double> defaultValue) const {
|
||||
std::span<const double> defaultValue) const {
|
||||
return nt::GetDoubleArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline std::vector<std::string> NetworkTableEntry::GetStringArray(
|
||||
wpi::span<const std::string> defaultValue) const {
|
||||
std::span<const std::string> defaultValue) const {
|
||||
return nt::GetStringArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@@ -128,32 +128,32 @@ inline bool NetworkTableEntry::SetDefaultString(std::string_view defaultValue) {
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetDefaultRaw(
|
||||
wpi::span<const uint8_t> defaultValue) {
|
||||
std::span<const uint8_t> defaultValue) {
|
||||
return nt::SetDefaultRaw(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetDefaultBooleanArray(
|
||||
wpi::span<const int> defaultValue) {
|
||||
std::span<const int> defaultValue) {
|
||||
return nt::SetDefaultBooleanArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetDefaultIntegerArray(
|
||||
wpi::span<const int64_t> defaultValue) {
|
||||
std::span<const int64_t> defaultValue) {
|
||||
return nt::SetDefaultIntegerArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetDefaultFloatArray(
|
||||
wpi::span<const float> defaultValue) {
|
||||
std::span<const float> defaultValue) {
|
||||
return nt::SetDefaultFloatArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetDefaultDoubleArray(
|
||||
wpi::span<const double> defaultValue) {
|
||||
std::span<const double> defaultValue) {
|
||||
return nt::SetDefaultDoubleArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetDefaultStringArray(
|
||||
wpi::span<const std::string> defaultValue) {
|
||||
std::span<const std::string> defaultValue) {
|
||||
return nt::SetDefaultStringArray(m_handle, defaultValue);
|
||||
}
|
||||
|
||||
@@ -181,38 +181,38 @@ inline bool NetworkTableEntry::SetString(std::string_view value, int64_t time) {
|
||||
return nt::SetString(m_handle, value, time);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetRaw(wpi::span<const uint8_t> value,
|
||||
inline bool NetworkTableEntry::SetRaw(std::span<const uint8_t> value,
|
||||
int64_t time) {
|
||||
return nt::SetRaw(m_handle, value, time);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetBooleanArray(wpi::span<const bool> value,
|
||||
inline bool NetworkTableEntry::SetBooleanArray(std::span<const bool> value,
|
||||
int64_t time) {
|
||||
return SetEntryValue(m_handle, Value::MakeBooleanArray(value, time));
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetBooleanArray(wpi::span<const int> value,
|
||||
inline bool NetworkTableEntry::SetBooleanArray(std::span<const int> value,
|
||||
int64_t time) {
|
||||
return nt::SetBooleanArray(m_handle, value, time);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetIntegerArray(wpi::span<const int64_t> value,
|
||||
inline bool NetworkTableEntry::SetIntegerArray(std::span<const int64_t> value,
|
||||
int64_t time) {
|
||||
return nt::SetIntegerArray(m_handle, value, time);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetFloatArray(wpi::span<const float> value,
|
||||
inline bool NetworkTableEntry::SetFloatArray(std::span<const float> value,
|
||||
int64_t time) {
|
||||
return nt::SetFloatArray(m_handle, value, time);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetDoubleArray(wpi::span<const double> value,
|
||||
inline bool NetworkTableEntry::SetDoubleArray(std::span<const double> value,
|
||||
int64_t time) {
|
||||
return nt::SetDoubleArray(m_handle, value, time);
|
||||
}
|
||||
|
||||
inline bool NetworkTableEntry::SetStringArray(
|
||||
wpi::span<const std::string> value, int64_t time) {
|
||||
std::span<const std::string> value, int64_t time) {
|
||||
return nt::SetStringArray(m_handle, value, time);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "networktables/NetworkTable.h"
|
||||
#include "networktables/NetworkTableEntry.h"
|
||||
#include "ntcore_c.h"
|
||||
@@ -283,7 +282,7 @@ class NetworkTableInstance final {
|
||||
* @return Array of topic handles.
|
||||
*/
|
||||
std::vector<Topic> GetTopics(std::string_view prefix,
|
||||
wpi::span<std::string_view> types);
|
||||
std::span<std::string_view> types);
|
||||
|
||||
/**
|
||||
* Get Topic Information about multiple topics.
|
||||
@@ -336,7 +335,7 @@ class NetworkTableInstance final {
|
||||
* @return Array of topic information.
|
||||
*/
|
||||
std::vector<TopicInfo> GetTopicInfo(std::string_view prefix,
|
||||
wpi::span<std::string_view> types);
|
||||
std::span<std::string_view> types);
|
||||
|
||||
/**
|
||||
* Gets the entry for a key.
|
||||
@@ -466,7 +465,7 @@ class NetworkTableInstance final {
|
||||
* @param servers array of server address and port pairs
|
||||
*/
|
||||
void SetServer(
|
||||
wpi::span<const std::pair<std::string_view, unsigned int>> servers);
|
||||
std::span<const std::pair<std::string_view, unsigned int>> servers);
|
||||
|
||||
/**
|
||||
* Sets server addresses and port for client (without restarting client).
|
||||
@@ -475,7 +474,7 @@ class NetworkTableInstance final {
|
||||
* @param servers array of server names
|
||||
* @param port port to communicate over (0 = default)
|
||||
*/
|
||||
void SetServer(wpi::span<const std::string_view> servers,
|
||||
void SetServer(std::span<const std::string_view> servers,
|
||||
unsigned int port = 0);
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ inline std::vector<Topic> NetworkTableInstance::GetTopics(
|
||||
}
|
||||
|
||||
inline std::vector<Topic> NetworkTableInstance::GetTopics(
|
||||
std::string_view prefix, wpi::span<std::string_view> types) {
|
||||
std::string_view prefix, std::span<std::string_view> types) {
|
||||
auto handles = ::nt::GetTopics(m_handle, prefix, types);
|
||||
return {handles.begin(), handles.end()};
|
||||
}
|
||||
@@ -74,7 +74,7 @@ inline std::vector<TopicInfo> NetworkTableInstance::GetTopicInfo(
|
||||
}
|
||||
|
||||
inline std::vector<TopicInfo> NetworkTableInstance::GetTopicInfo(
|
||||
std::string_view prefix, wpi::span<std::string_view> types) {
|
||||
std::string_view prefix, std::span<std::string_view> types) {
|
||||
return ::nt::GetTopicInfo(m_handle, prefix, types);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ inline void NetworkTableInstance::SetServer(const char* server_name,
|
||||
}
|
||||
|
||||
inline void NetworkTableInstance::SetServer(
|
||||
wpi::span<const std::pair<std::string_view, unsigned int>> servers) {
|
||||
std::span<const std::pair<std::string_view, unsigned int>> servers) {
|
||||
::nt::SetServer(m_handle, servers);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,13 @@
|
||||
#include <cassert>
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "ntcore_c.h"
|
||||
|
||||
namespace nt {
|
||||
@@ -235,7 +234,7 @@ class Value final {
|
||||
*
|
||||
* @return The raw value.
|
||||
*/
|
||||
wpi::span<const uint8_t> GetRaw() const {
|
||||
std::span<const uint8_t> GetRaw() const {
|
||||
assert(m_val.type == NT_RAW);
|
||||
return {m_val.data.v_raw.data, m_val.data.v_raw.size};
|
||||
}
|
||||
@@ -245,7 +244,7 @@ class Value final {
|
||||
*
|
||||
* @return The boolean array value.
|
||||
*/
|
||||
wpi::span<const int> GetBooleanArray() const {
|
||||
std::span<const int> GetBooleanArray() const {
|
||||
assert(m_val.type == NT_BOOLEAN_ARRAY);
|
||||
return {m_val.data.arr_boolean.arr, m_val.data.arr_boolean.size};
|
||||
}
|
||||
@@ -255,7 +254,7 @@ class Value final {
|
||||
*
|
||||
* @return The integer array value.
|
||||
*/
|
||||
wpi::span<const int64_t> GetIntegerArray() const {
|
||||
std::span<const int64_t> GetIntegerArray() const {
|
||||
assert(m_val.type == NT_INTEGER_ARRAY);
|
||||
return {m_val.data.arr_int.arr, m_val.data.arr_int.size};
|
||||
}
|
||||
@@ -265,7 +264,7 @@ class Value final {
|
||||
*
|
||||
* @return The float array value.
|
||||
*/
|
||||
wpi::span<const float> GetFloatArray() const {
|
||||
std::span<const float> GetFloatArray() const {
|
||||
assert(m_val.type == NT_FLOAT_ARRAY);
|
||||
return {m_val.data.arr_float.arr, m_val.data.arr_float.size};
|
||||
}
|
||||
@@ -275,7 +274,7 @@ class Value final {
|
||||
*
|
||||
* @return The double array value.
|
||||
*/
|
||||
wpi::span<const double> GetDoubleArray() const {
|
||||
std::span<const double> GetDoubleArray() const {
|
||||
assert(m_val.type == NT_DOUBLE_ARRAY);
|
||||
return {m_val.data.arr_double.arr, m_val.data.arr_double.size};
|
||||
}
|
||||
@@ -285,7 +284,7 @@ class Value final {
|
||||
*
|
||||
* @return The string array value.
|
||||
*/
|
||||
wpi::span<const std::string> GetStringArray() const {
|
||||
std::span<const std::string> GetStringArray() const {
|
||||
assert(m_val.type == NT_STRING_ARRAY);
|
||||
return *static_cast<std::vector<std::string>*>(m_storage.get());
|
||||
}
|
||||
@@ -397,7 +396,7 @@ class Value final {
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
static Value MakeRaw(wpi::span<const uint8_t> value, int64_t time = 0) {
|
||||
static Value MakeRaw(std::span<const uint8_t> value, int64_t time = 0) {
|
||||
Value val{NT_RAW, time, private_init{}};
|
||||
auto data =
|
||||
std::make_shared<std::vector<uint8_t>>(value.begin(), value.end());
|
||||
@@ -434,7 +433,7 @@ class Value final {
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
static Value MakeBooleanArray(wpi::span<const bool> value, int64_t time = 0);
|
||||
static Value MakeBooleanArray(std::span<const bool> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Creates a boolean array entry value.
|
||||
@@ -446,7 +445,7 @@ class Value final {
|
||||
*/
|
||||
static Value MakeBooleanArray(std::initializer_list<bool> value,
|
||||
int64_t time = 0) {
|
||||
return MakeBooleanArray(wpi::span(value.begin(), value.end()), time);
|
||||
return MakeBooleanArray(std::span(value.begin(), value.end()), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -457,7 +456,7 @@ class Value final {
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
static Value MakeBooleanArray(wpi::span<const int> value, int64_t time = 0);
|
||||
static Value MakeBooleanArray(std::span<const int> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Creates a boolean array entry value.
|
||||
@@ -469,7 +468,7 @@ class Value final {
|
||||
*/
|
||||
static Value MakeBooleanArray(std::initializer_list<int> value,
|
||||
int64_t time = 0) {
|
||||
return MakeBooleanArray(wpi::span(value.begin(), value.end()), time);
|
||||
return MakeBooleanArray(std::span(value.begin(), value.end()), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,7 +479,7 @@ class Value final {
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
static Value MakeIntegerArray(wpi::span<const int64_t> value,
|
||||
static Value MakeIntegerArray(std::span<const int64_t> value,
|
||||
int64_t time = 0);
|
||||
|
||||
/**
|
||||
@@ -493,7 +492,7 @@ class Value final {
|
||||
*/
|
||||
static Value MakeIntegerArray(std::initializer_list<int64_t> value,
|
||||
int64_t time = 0) {
|
||||
return MakeIntegerArray(wpi::span(value.begin(), value.end()), time);
|
||||
return MakeIntegerArray(std::span(value.begin(), value.end()), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -504,7 +503,7 @@ class Value final {
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
static Value MakeFloatArray(wpi::span<const float> value, int64_t time = 0);
|
||||
static Value MakeFloatArray(std::span<const float> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Creates a float array entry value.
|
||||
@@ -516,7 +515,7 @@ class Value final {
|
||||
*/
|
||||
static Value MakeFloatArray(std::initializer_list<float> value,
|
||||
int64_t time = 0) {
|
||||
return MakeFloatArray(wpi::span(value.begin(), value.end()), time);
|
||||
return MakeFloatArray(std::span(value.begin(), value.end()), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -527,7 +526,7 @@ class Value final {
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
static Value MakeDoubleArray(wpi::span<const double> value, int64_t time = 0);
|
||||
static Value MakeDoubleArray(std::span<const double> value, int64_t time = 0);
|
||||
|
||||
/**
|
||||
* Creates a double array entry value.
|
||||
@@ -539,7 +538,7 @@ class Value final {
|
||||
*/
|
||||
static Value MakeDoubleArray(std::initializer_list<double> value,
|
||||
int64_t time = 0) {
|
||||
return MakeDoubleArray(wpi::span(value.begin(), value.end()), time);
|
||||
return MakeDoubleArray(std::span(value.begin(), value.end()), time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -550,7 +549,7 @@ class Value final {
|
||||
* time)
|
||||
* @return The entry value
|
||||
*/
|
||||
static Value MakeStringArray(wpi::span<const std::string> value,
|
||||
static Value MakeStringArray(std::span<const std::string> value,
|
||||
int64_t time = 0);
|
||||
|
||||
/**
|
||||
@@ -563,7 +562,7 @@ class Value final {
|
||||
*/
|
||||
static Value MakeStringArray(std::initializer_list<std::string> value,
|
||||
int64_t time = 0) {
|
||||
return MakeStringArray(wpi::span(value.begin(), value.end()), time);
|
||||
return MakeStringArray(std::span(value.begin(), value.end()), time);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
@@ -170,7 +171,7 @@ class Topic {
|
||||
* @return subscriber
|
||||
*/
|
||||
[[nodiscard]] GenericSubscriber GenericSubscribe(
|
||||
wpi::span<const PubSubOption> options = {});
|
||||
std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Create a new subscriber to the topic.
|
||||
@@ -187,7 +188,7 @@ class Topic {
|
||||
* @return subscriber
|
||||
*/
|
||||
[[nodiscard]] GenericSubscriber GenericSubscribe(
|
||||
std::string_view typeString, wpi::span<const PubSubOption> options = {});
|
||||
std::string_view typeString, std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic.
|
||||
@@ -206,7 +207,7 @@ class Topic {
|
||||
* @return publisher
|
||||
*/
|
||||
[[nodiscard]] GenericPublisher GenericPublish(
|
||||
std::string_view typeString, wpi::span<const PubSubOption> options = {});
|
||||
std::string_view typeString, std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Create a new publisher to the topic, with type string and initial
|
||||
@@ -228,7 +229,7 @@ class Topic {
|
||||
*/
|
||||
[[nodiscard]] GenericPublisher GenericPublishEx(
|
||||
std::string_view typeString, const wpi::json& properties,
|
||||
wpi::span<const PubSubOption> options = {});
|
||||
std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Create a new generic entry for the topic.
|
||||
@@ -249,7 +250,7 @@ class Topic {
|
||||
* @return entry
|
||||
*/
|
||||
[[nodiscard]] GenericEntry GetGenericEntry(
|
||||
wpi::span<const PubSubOption> options = {});
|
||||
std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Create a new generic entry for the topic.
|
||||
@@ -271,7 +272,7 @@ class Topic {
|
||||
* @return entry
|
||||
*/
|
||||
[[nodiscard]] GenericEntry GetGenericEntry(
|
||||
std::string_view typeString, wpi::span<const PubSubOption> options = {});
|
||||
std::string_view typeString, std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Equality operator. Returns true if both instances refer to the same
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "ntcore_cpp.h"
|
||||
|
||||
namespace nt {
|
||||
@@ -83,7 +82,7 @@ class TopicListener final {
|
||||
* @param listener Listener function
|
||||
*/
|
||||
TopicListener(NetworkTableInstance inst,
|
||||
wpi::span<const std::string_view> prefixes, unsigned int mask,
|
||||
std::span<const std::string_view> prefixes, unsigned int mask,
|
||||
std::function<void(const TopicNotification&)> listener);
|
||||
|
||||
/**
|
||||
@@ -183,7 +182,7 @@ class TopicListenerPoller final {
|
||||
* @param mask Bitmask of TopicListenerFlags values
|
||||
* @return Listener handle
|
||||
*/
|
||||
NT_TopicListener Add(wpi::span<const std::string_view> prefixes,
|
||||
NT_TopicListener Add(std::span<const std::string_view> prefixes,
|
||||
unsigned int mask);
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <span>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "networktables/MultiSubscriber.h"
|
||||
#include "networktables/NetworkTableEntry.h"
|
||||
#include "networktables/NetworkTableInstance.h"
|
||||
@@ -20,7 +19,7 @@
|
||||
namespace nt {
|
||||
|
||||
inline TopicListener::TopicListener(
|
||||
NetworkTableInstance inst, wpi::span<const std::string_view> prefixes,
|
||||
NetworkTableInstance inst, std::span<const std::string_view> prefixes,
|
||||
unsigned int mask, std::function<void(const TopicNotification&)> listener)
|
||||
: m_handle{AddTopicListener(inst.GetHandle(), prefixes, mask, listener)} {}
|
||||
|
||||
@@ -81,7 +80,7 @@ inline TopicListenerPoller::~TopicListenerPoller() {
|
||||
}
|
||||
|
||||
inline NT_TopicListener TopicListenerPoller::Add(
|
||||
wpi::span<const std::string_view> prefixes, unsigned int mask) {
|
||||
std::span<const std::string_view> prefixes, unsigned int mask) {
|
||||
return nt::AddPolledTopicListener(m_handle, prefixes, mask);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
#include <cassert>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "networktables/NetworkTableValue.h"
|
||||
#include "ntcore_c.h"
|
||||
#include "ntcore_cpp_types.h"
|
||||
@@ -482,7 +481,7 @@ std::vector<NT_Topic> GetTopics(NT_Inst inst, std::string_view prefix,
|
||||
* @return Array of topic handles.
|
||||
*/
|
||||
std::vector<NT_Topic> GetTopics(NT_Inst inst, std::string_view prefix,
|
||||
wpi::span<const std::string_view> types);
|
||||
std::span<const std::string_view> types);
|
||||
|
||||
/**
|
||||
* Get Topic Information about multiple topics.
|
||||
@@ -515,7 +514,7 @@ std::vector<TopicInfo> GetTopicInfo(NT_Inst inst, std::string_view prefix,
|
||||
* @return Array of topic information.
|
||||
*/
|
||||
std::vector<TopicInfo> GetTopicInfo(NT_Inst inst, std::string_view prefix,
|
||||
wpi::span<const std::string_view> types);
|
||||
std::span<const std::string_view> types);
|
||||
|
||||
/**
|
||||
* Gets Topic Information.
|
||||
@@ -665,7 +664,7 @@ bool SetTopicProperties(NT_Topic topic, const wpi::json& update);
|
||||
* @return Subscriber handle
|
||||
*/
|
||||
NT_Subscriber Subscribe(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
wpi::span<const PubSubOption> options = {});
|
||||
std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Stops subscriber.
|
||||
@@ -684,7 +683,7 @@ void Unsubscribe(NT_Subscriber sub);
|
||||
* @return Publisher handle
|
||||
*/
|
||||
NT_Publisher Publish(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
wpi::span<const PubSubOption> options = {});
|
||||
std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Creates a new publisher to a topic.
|
||||
@@ -698,7 +697,7 @@ NT_Publisher Publish(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
*/
|
||||
NT_Publisher PublishEx(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
const wpi::json& properties,
|
||||
wpi::span<const PubSubOption> options = {});
|
||||
std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Stops publisher.
|
||||
@@ -717,7 +716,7 @@ void Unpublish(NT_Handle pubentry);
|
||||
* @return Entry handle
|
||||
*/
|
||||
NT_Entry GetEntry(NT_Topic topic, NT_Type type, std::string_view typeStr,
|
||||
wpi::span<const PubSubOption> options = {});
|
||||
std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Stops entry subscriber/publisher.
|
||||
@@ -759,8 +758,8 @@ NT_Topic GetTopicFromHandle(NT_Handle pubsubentry);
|
||||
* @return subscriber handle
|
||||
*/
|
||||
NT_MultiSubscriber SubscribeMultiple(
|
||||
NT_Inst inst, wpi::span<const std::string_view> prefixes,
|
||||
wpi::span<const PubSubOption> options = {});
|
||||
NT_Inst inst, std::span<const std::string_view> prefixes,
|
||||
std::span<const PubSubOption> options = {});
|
||||
|
||||
/**
|
||||
* Unsubscribes a multi-subscriber.
|
||||
@@ -786,7 +785,7 @@ void UnsubscribeMultiple(NT_MultiSubscriber sub);
|
||||
* @param callback Listener function
|
||||
*/
|
||||
NT_TopicListener AddTopicListener(
|
||||
NT_Inst inst, wpi::span<const std::string_view> prefixes, unsigned int mask,
|
||||
NT_Inst inst, std::span<const std::string_view> prefixes, unsigned int mask,
|
||||
std::function<void(const TopicNotification&)> callback);
|
||||
|
||||
/**
|
||||
@@ -841,7 +840,7 @@ std::vector<TopicNotification> ReadTopicListenerQueue(
|
||||
* @return Listener handle
|
||||
*/
|
||||
NT_TopicListener AddPolledTopicListener(
|
||||
NT_TopicListenerPoller poller, wpi::span<const std::string_view> prefixes,
|
||||
NT_TopicListenerPoller poller, std::span<const std::string_view> prefixes,
|
||||
unsigned int mask);
|
||||
|
||||
/**
|
||||
@@ -1102,7 +1101,7 @@ void SetServer(NT_Inst inst, const char* server_name, unsigned int port);
|
||||
*/
|
||||
void SetServer(
|
||||
NT_Inst inst,
|
||||
wpi::span<const std::pair<std::string_view, unsigned int>> servers);
|
||||
std::span<const std::pair<std::string_view, unsigned int>> servers);
|
||||
|
||||
/**
|
||||
* Sets server addresses and port for client (without restarting client).
|
||||
|
||||
Reference in New Issue
Block a user