[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

@@ -96,44 +96,73 @@ class SendableBuilderImpl : public nt::NTSendableBuilder {
void AddBooleanProperty(std::string_view key, std::function<bool()> getter,
std::function<void(bool)> setter) override;
void PublishConstBoolean(std::string_view key, bool value) override;
void AddIntegerProperty(std::string_view key, std::function<int64_t()> getter,
std::function<void(int64_t)> setter) override;
void PublishConstInteger(std::string_view key, int64_t value) override;
void AddFloatProperty(std::string_view key, std::function<float()> getter,
std::function<void(float)> setter) override;
void PublishConstFloat(std::string_view key, float value) override;
void AddDoubleProperty(std::string_view key, std::function<double()> getter,
std::function<void(double)> setter) override;
void PublishConstDouble(std::string_view key, double value) override;
void AddStringProperty(std::string_view key,
std::function<std::string()> getter,
std::function<void(std::string_view)> setter) override;
void PublishConstString(std::string_view key,
std::string_view value) override;
void AddBooleanArrayProperty(
std::string_view key, std::function<std::vector<int>()> getter,
std::function<void(std::span<const int>)> setter) override;
void PublishConstBooleanArray(std::string_view key,
std::span<const int> value) override;
void AddIntegerArrayProperty(
std::string_view key, std::function<std::vector<int64_t>()> getter,
std::function<void(std::span<const int64_t>)> setter) override;
void PublishConstIntegerArray(std::string_view key,
std::span<const int64_t> value) override;
void AddFloatArrayProperty(
std::string_view key, std::function<std::vector<float>()> getter,
std::function<void(std::span<const float>)> setter) override;
void PublishConstFloatArray(std::string_view key,
std::span<const float> value) override;
void AddDoubleArrayProperty(
std::string_view key, std::function<std::vector<double>()> getter,
std::function<void(std::span<const double>)> setter) override;
void PublishConstDoubleArray(std::string_view key,
std::span<const double> value) override;
void AddStringArrayProperty(
std::string_view key, std::function<std::vector<std::string>()> getter,
std::function<void(std::span<const std::string>)> setter) override;
void PublishConstStringArray(std::string_view key,
std::span<const std::string> value) override;
void AddRawProperty(
std::string_view key, std::string_view typeString,
std::function<std::vector<uint8_t>()> getter,
std::function<void(std::span<const uint8_t>)> setter) override;
void PublishConstRaw(std::string_view key, std::string_view typeString,
std::span<const uint8_t> value) override;
void AddSmallStringProperty(
std::string_view key,
std::function<std::string_view(wpi::SmallVectorImpl<char>& buf)> getter,
@@ -198,6 +227,9 @@ class SendableBuilderImpl : public nt::NTSendableBuilder {
template <typename Topic, typename Getter, typename Setter>
void AddPropertyImpl(Topic topic, Getter getter, Setter setter);
template <typename Topic, typename Value>
void PublishConstImpl(Topic topic, Value value);
template <typename T, size_t Size, typename Topic, typename Getter,
typename Setter>
void AddSmallPropertyImpl(Topic topic, Getter getter, Setter setter);