[wpiutil] SendableBuilder: Add PublishConst methods (#5158)

This commit is contained in:
Starlight220
2023-10-02 18:23:11 +03:00
committed by GitHub
parent 1fec8596a4
commit 3eb372c25a
5 changed files with 385 additions and 0 deletions

View File

@@ -59,6 +59,14 @@ class SendableBuilder {
std::function<bool()> getter,
std::function<void(bool)> setter) = 0;
/**
* Add a constant boolean property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstBoolean(std::string_view key, bool value) = 0;
/**
* Add an integer property.
*
@@ -70,6 +78,14 @@ class SendableBuilder {
std::function<int64_t()> getter,
std::function<void(int64_t)> setter) = 0;
/**
* Add a constant integer property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstInteger(std::string_view key, int64_t value) = 0;
/**
* Add a float property.
*
@@ -81,6 +97,14 @@ class SendableBuilder {
std::function<float()> getter,
std::function<void(float)> setter) = 0;
/**
* Add a constant float property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstFloat(std::string_view key, float value) = 0;
/**
* Add a double property.
*
@@ -92,6 +116,14 @@ class SendableBuilder {
std::function<double()> getter,
std::function<void(double)> setter) = 0;
/**
* Add a constant double property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstDouble(std::string_view key, double value) = 0;
/**
* Add a string property.
*
@@ -103,6 +135,15 @@ class SendableBuilder {
std::string_view key, std::function<std::string()> getter,
std::function<void(std::string_view)> setter) = 0;
/**
* Add a constant string property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstString(std::string_view key,
std::string_view value) = 0;
/**
* Add a boolean array property.
*
@@ -114,6 +155,15 @@ class SendableBuilder {
std::string_view key, std::function<std::vector<int>()> getter,
std::function<void(std::span<const int>)> setter) = 0;
/**
* Add a constant boolean array property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstBooleanArray(std::string_view key,
std::span<const int> value) = 0;
/**
* Add an integer array property.
*
@@ -125,6 +175,15 @@ class SendableBuilder {
std::string_view key, std::function<std::vector<int64_t>()> getter,
std::function<void(std::span<const int64_t>)> setter) = 0;
/**
* Add a constant integer array property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstIntegerArray(std::string_view key,
std::span<const int64_t> value) = 0;
/**
* Add a float array property.
*
@@ -136,6 +195,15 @@ class SendableBuilder {
std::string_view key, std::function<std::vector<float>()> getter,
std::function<void(std::span<const float>)> setter) = 0;
/**
* Add a constant float array property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstFloatArray(std::string_view key,
std::span<const float> value) = 0;
/**
* Add a double array property.
*
@@ -147,6 +215,15 @@ class SendableBuilder {
std::string_view key, std::function<std::vector<double>()> getter,
std::function<void(std::span<const double>)> setter) = 0;
/**
* Add a constant double array property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstDoubleArray(std::string_view key,
std::span<const double> value) = 0;
/**
* Add a string array property.
*
@@ -158,6 +235,15 @@ class SendableBuilder {
std::string_view key, std::function<std::vector<std::string>()> getter,
std::function<void(std::span<const std::string>)> setter) = 0;
/**
* Add a constant string array property.
*
* @param key property name
* @param value the value
*/
virtual void PublishConstStringArray(std::string_view key,
std::span<const std::string> value) = 0;
/**
* Add a raw property.
*
@@ -171,6 +257,17 @@ class SendableBuilder {
std::function<std::vector<uint8_t>()> getter,
std::function<void(std::span<const uint8_t>)> setter) = 0;
/**
* Add a constant raw property.
*
* @param key property name
* @param typeString type string
* @param value the value
*/
virtual void PublishConstRaw(std::string_view key,
std::string_view typeString,
std::span<const uint8_t> value) = 0;
/**
* Add a string property (SmallString form).
*