[ntcore] NetworkTables 4 (#3217)

This commit is contained in:
Peter Johnson
2022-10-08 10:01:31 -07:00
committed by GitHub
parent 90cfa00115
commit 77301b126c
380 changed files with 34573 additions and 22095 deletions

View File

@@ -59,6 +59,28 @@ class SendableBuilder {
std::function<bool()> getter,
std::function<void(bool)> setter) = 0;
/**
* Add an integer property.
*
* @param key property name
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddIntegerProperty(std::string_view key,
std::function<int64_t()> getter,
std::function<void(int64_t)> setter) = 0;
/**
* Add a float property.
*
* @param key property name
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddFloatProperty(std::string_view key,
std::function<float()> getter,
std::function<void(float)> setter) = 0;
/**
* Add a double property.
*
@@ -92,6 +114,28 @@ class SendableBuilder {
std::string_view key, std::function<std::vector<int>()> getter,
std::function<void(wpi::span<const int>)> setter) = 0;
/**
* Add an integer array property.
*
* @param key property name
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddIntegerArrayProperty(
std::string_view key, std::function<std::vector<int64_t>()> getter,
std::function<void(wpi::span<const int64_t>)> setter) = 0;
/**
* Add a float array property.
*
* @param key property name
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddFloatArrayProperty(
std::string_view key, std::function<std::vector<float>()> getter,
std::function<void(wpi::span<const float>)> setter) = 0;
/**
* Add a double array property.
*
@@ -117,13 +161,15 @@ class SendableBuilder {
/**
* Add a raw property.
*
* @param key property name
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
* @param key property name
* @param typeString type string
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddRawProperty(std::string_view key,
std::function<std::string()> getter,
std::function<void(std::string_view)> setter) = 0;
virtual void AddRawProperty(
std::string_view key, std::string_view typeString,
std::function<std::vector<uint8_t>()> getter,
std::function<void(wpi::span<const uint8_t>)> setter) = 0;
/**
* Add a string property (SmallString form).
@@ -150,6 +196,33 @@ class SendableBuilder {
getter,
std::function<void(wpi::span<const int>)> setter) = 0;
/**
* Add an integer array property (SmallVector form).
*
* @param key property name
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddSmallIntegerArrayProperty(
std::string_view key,
std::function<
wpi::span<const int64_t>(wpi::SmallVectorImpl<int64_t>& buf)>
getter,
std::function<void(wpi::span<const int64_t>)> setter) = 0;
/**
* Add a float array property (SmallVector form).
*
* @param key property name
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddSmallFloatArrayProperty(
std::string_view key,
std::function<wpi::span<const float>(wpi::SmallVectorImpl<float>& buf)>
getter,
std::function<void(wpi::span<const float>)> setter) = 0;
/**
* Add a double array property (SmallVector form).
*
@@ -181,13 +254,15 @@ class SendableBuilder {
* Add a raw property (SmallVector form).
*
* @param key property name
* @param typeString type string
* @param getter getter function (returns current value)
* @param setter setter function (sets new value)
*/
virtual void AddSmallRawProperty(
std::string_view key,
std::function<std::string_view(wpi::SmallVectorImpl<char>& buf)> getter,
std::function<void(std::string_view)> setter) = 0;
std::string_view key, std::string_view typeString,
std::function<wpi::span<uint8_t>(wpi::SmallVectorImpl<uint8_t>& buf)>
getter,
std::function<void(wpi::span<const uint8_t>)> setter) = 0;
/**
* Gets the kind of backend being used.