mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpiutil] SendableBuilder: Add PublishConst methods (#5158)
This commit is contained in:
@@ -141,6 +141,14 @@ void SendableBuilderImpl::AddPropertyImpl(Topic topic, Getter getter,
|
||||
m_properties.emplace_back(std::move(prop));
|
||||
}
|
||||
|
||||
template <typename Topic, typename Value>
|
||||
void SendableBuilderImpl::PublishConstImpl(Topic topic, Value value) {
|
||||
auto prop = std::make_unique<PropertyImpl<Topic>>();
|
||||
prop->pub = topic.Publish();
|
||||
prop->pub.Set(value);
|
||||
m_properties.emplace_back(std::move(prop));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddBooleanProperty(std::string_view key,
|
||||
std::function<bool()> getter,
|
||||
std::function<void(bool)> setter) {
|
||||
@@ -148,6 +156,11 @@ void SendableBuilderImpl::AddBooleanProperty(std::string_view key,
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstBoolean(std::string_view key,
|
||||
bool value) {
|
||||
PublishConstImpl(m_table->GetBooleanTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddIntegerProperty(
|
||||
std::string_view key, std::function<int64_t()> getter,
|
||||
std::function<void(int64_t)> setter) {
|
||||
@@ -155,6 +168,11 @@ void SendableBuilderImpl::AddIntegerProperty(
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstInteger(std::string_view key,
|
||||
int64_t value) {
|
||||
PublishConstImpl(m_table->GetIntegerTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddFloatProperty(std::string_view key,
|
||||
std::function<float()> getter,
|
||||
std::function<void(float)> setter) {
|
||||
@@ -162,6 +180,10 @@ void SendableBuilderImpl::AddFloatProperty(std::string_view key,
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstFloat(std::string_view key, float value) {
|
||||
PublishConstImpl(m_table->GetFloatTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddDoubleProperty(
|
||||
std::string_view key, std::function<double()> getter,
|
||||
std::function<void(double)> setter) {
|
||||
@@ -169,6 +191,11 @@ void SendableBuilderImpl::AddDoubleProperty(
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstDouble(std::string_view key,
|
||||
double value) {
|
||||
PublishConstImpl(m_table->GetDoubleTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddStringProperty(
|
||||
std::string_view key, std::function<std::string()> getter,
|
||||
std::function<void(std::string_view)> setter) {
|
||||
@@ -176,6 +203,11 @@ void SendableBuilderImpl::AddStringProperty(
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstString(std::string_view key,
|
||||
std::string_view value) {
|
||||
PublishConstImpl(m_table->GetStringTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddBooleanArrayProperty(
|
||||
std::string_view key, std::function<std::vector<int>()> getter,
|
||||
std::function<void(std::span<const int>)> setter) {
|
||||
@@ -183,6 +215,11 @@ void SendableBuilderImpl::AddBooleanArrayProperty(
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstBooleanArray(std::string_view key,
|
||||
std::span<const int> value) {
|
||||
PublishConstImpl(m_table->GetBooleanArrayTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddIntegerArrayProperty(
|
||||
std::string_view key, std::function<std::vector<int64_t>()> getter,
|
||||
std::function<void(std::span<const int64_t>)> setter) {
|
||||
@@ -190,6 +227,11 @@ void SendableBuilderImpl::AddIntegerArrayProperty(
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstIntegerArray(
|
||||
std::string_view key, std::span<const int64_t> value) {
|
||||
PublishConstImpl(m_table->GetIntegerArrayTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddFloatArrayProperty(
|
||||
std::string_view key, std::function<std::vector<float>()> getter,
|
||||
std::function<void(std::span<const float>)> setter) {
|
||||
@@ -197,6 +239,11 @@ void SendableBuilderImpl::AddFloatArrayProperty(
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstFloatArray(std::string_view key,
|
||||
std::span<const float> value) {
|
||||
PublishConstImpl(m_table->GetFloatArrayTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddDoubleArrayProperty(
|
||||
std::string_view key, std::function<std::vector<double>()> getter,
|
||||
std::function<void(std::span<const double>)> setter) {
|
||||
@@ -204,6 +251,11 @@ void SendableBuilderImpl::AddDoubleArrayProperty(
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstDoubleArray(
|
||||
std::string_view key, std::span<const double> value) {
|
||||
PublishConstImpl(m_table->GetDoubleArrayTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddStringArrayProperty(
|
||||
std::string_view key, std::function<std::vector<std::string>()> getter,
|
||||
std::function<void(std::span<const std::string>)> setter) {
|
||||
@@ -211,6 +263,11 @@ void SendableBuilderImpl::AddStringArrayProperty(
|
||||
std::move(setter));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstStringArray(
|
||||
std::string_view key, std::span<const std::string> value) {
|
||||
PublishConstImpl(m_table->GetStringArrayTopic(key), value);
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::AddRawProperty(
|
||||
std::string_view key, std::string_view typeString,
|
||||
std::function<std::vector<uint8_t>()> getter,
|
||||
@@ -235,6 +292,16 @@ void SendableBuilderImpl::AddRawProperty(
|
||||
m_properties.emplace_back(std::move(prop));
|
||||
}
|
||||
|
||||
void SendableBuilderImpl::PublishConstRaw(std::string_view key,
|
||||
std::string_view typeString,
|
||||
std::span<const uint8_t> value) {
|
||||
auto topic = m_table->GetRawTopic(key);
|
||||
auto prop = std::make_unique<PropertyImpl<nt::RawTopic>>();
|
||||
prop->pub = topic.Publish(typeString);
|
||||
prop->pub.Set(value);
|
||||
m_properties.emplace_back(std::move(prop));
|
||||
}
|
||||
|
||||
template <typename T, size_t Size, typename Topic, typename Getter,
|
||||
typename Setter>
|
||||
void SendableBuilderImpl::AddSmallPropertyImpl(Topic topic, Getter getter,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -57,6 +57,7 @@ import java.util.function.LongConsumer;
|
||||
import java.util.function.LongSupplier;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@SuppressWarnings("PMD.CompareObjectsWithEquals")
|
||||
public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
@FunctionalInterface
|
||||
private interface TimedConsumer<T> {
|
||||
@@ -328,6 +329,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstBoolean(String key, boolean value) {
|
||||
Property<BooleanPublisher, BooleanSubscriber> property = new Property<>();
|
||||
BooleanTopic topic = m_table.getBooleanTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an integer property.
|
||||
*
|
||||
@@ -355,6 +365,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstInteger(String key, long value) {
|
||||
Property<IntegerPublisher, IntegerSubscriber> property = new Property<>();
|
||||
IntegerTopic topic = m_table.getIntegerTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a float property.
|
||||
*
|
||||
@@ -382,6 +401,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstFloat(String key, float value) {
|
||||
Property<FloatPublisher, FloatSubscriber> property = new Property<>();
|
||||
FloatTopic topic = m_table.getFloatTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a double property.
|
||||
*
|
||||
@@ -409,6 +437,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstDouble(String key, double value) {
|
||||
Property<DoublePublisher, DoubleSubscriber> property = new Property<>();
|
||||
DoubleTopic topic = m_table.getDoubleTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a string property.
|
||||
*
|
||||
@@ -436,6 +473,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstString(String key, String value) {
|
||||
Property<StringPublisher, StringSubscriber> property = new Property<>();
|
||||
StringTopic topic = m_table.getStringTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a boolean array property.
|
||||
*
|
||||
@@ -465,6 +511,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstBooleanArray(String key, boolean[] value) {
|
||||
Property<BooleanArrayPublisher, BooleanArraySubscriber> property = new Property<>();
|
||||
BooleanArrayTopic topic = m_table.getBooleanArrayTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an integer array property.
|
||||
*
|
||||
@@ -494,6 +549,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstIntegerArray(String key, long[] value) {
|
||||
Property<IntegerArrayPublisher, IntegerArraySubscriber> property = new Property<>();
|
||||
IntegerArrayTopic topic = m_table.getIntegerArrayTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a float array property.
|
||||
*
|
||||
@@ -523,6 +587,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstFloatArray(String key, float[] value) {
|
||||
Property<FloatArrayPublisher, FloatArraySubscriber> property = new Property<>();
|
||||
FloatArrayTopic topic = m_table.getFloatArrayTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a double array property.
|
||||
*
|
||||
@@ -552,6 +625,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstDoubleArray(String key, double[] value) {
|
||||
Property<DoubleArrayPublisher, DoubleArraySubscriber> property = new Property<>();
|
||||
DoubleArrayTopic topic = m_table.getDoubleArrayTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a string array property.
|
||||
*
|
||||
@@ -581,6 +663,15 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstStringArray(String key, String[] value) {
|
||||
Property<StringArrayPublisher, StringArraySubscriber> property = new Property<>();
|
||||
StringArrayTopic topic = m_table.getStringArrayTopic(key);
|
||||
property.m_pub = topic.publish();
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a raw property.
|
||||
*
|
||||
@@ -610,4 +701,13 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
}
|
||||
m_properties.add(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishConstRaw(String key, String typestring, byte[] value) {
|
||||
Property<RawPublisher, RawSubscriber> property = new Property<>();
|
||||
RawTopic topic = m_table.getRawTopic(key);
|
||||
property.m_pub = topic.publish(typestring);
|
||||
property.m_pub.set(value);
|
||||
m_properties.add(property);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addBooleanProperty(String key, BooleanSupplier getter, BooleanConsumer setter);
|
||||
|
||||
/**
|
||||
* Add a constant boolean property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstBoolean(String key, boolean value);
|
||||
|
||||
/**
|
||||
* Add an integer property.
|
||||
*
|
||||
@@ -64,6 +72,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addIntegerProperty(String key, LongSupplier getter, LongConsumer setter);
|
||||
|
||||
/**
|
||||
* Add a constant integer property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstInteger(String key, long value);
|
||||
|
||||
/**
|
||||
* Add a float property.
|
||||
*
|
||||
@@ -73,6 +89,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addFloatProperty(String key, FloatSupplier getter, FloatConsumer setter);
|
||||
|
||||
/**
|
||||
* Add a constant float property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstFloat(String key, float value);
|
||||
|
||||
/**
|
||||
* Add a double property.
|
||||
*
|
||||
@@ -82,6 +106,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addDoubleProperty(String key, DoubleSupplier getter, DoubleConsumer setter);
|
||||
|
||||
/**
|
||||
* Add a constant double property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstDouble(String key, double value);
|
||||
|
||||
/**
|
||||
* Add a string property.
|
||||
*
|
||||
@@ -91,6 +123,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addStringProperty(String key, Supplier<String> getter, Consumer<String> setter);
|
||||
|
||||
/**
|
||||
* Add a constant string property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstString(String key, String value);
|
||||
|
||||
/**
|
||||
* Add a boolean array property.
|
||||
*
|
||||
@@ -100,6 +140,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addBooleanArrayProperty(String key, Supplier<boolean[]> getter, Consumer<boolean[]> setter);
|
||||
|
||||
/**
|
||||
* Add a constant boolean array property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstBooleanArray(String key, boolean[] value);
|
||||
|
||||
/**
|
||||
* Add an integer array property.
|
||||
*
|
||||
@@ -109,6 +157,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addIntegerArrayProperty(String key, Supplier<long[]> getter, Consumer<long[]> setter);
|
||||
|
||||
/**
|
||||
* Add a constant integer property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstIntegerArray(String key, long[] value);
|
||||
|
||||
/**
|
||||
* Add a float array property.
|
||||
*
|
||||
@@ -118,6 +174,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addFloatArrayProperty(String key, Supplier<float[]> getter, Consumer<float[]> setter);
|
||||
|
||||
/**
|
||||
* Add a constant float array property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstFloatArray(String key, float[] value);
|
||||
|
||||
/**
|
||||
* Add a double array property.
|
||||
*
|
||||
@@ -127,6 +191,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addDoubleArrayProperty(String key, Supplier<double[]> getter, Consumer<double[]> setter);
|
||||
|
||||
/**
|
||||
* Add a constant double array property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstDoubleArray(String key, double[] value);
|
||||
|
||||
/**
|
||||
* Add a string array property.
|
||||
*
|
||||
@@ -136,6 +208,14 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
*/
|
||||
void addStringArrayProperty(String key, Supplier<String[]> getter, Consumer<String[]> setter);
|
||||
|
||||
/**
|
||||
* Add a constant string array property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstStringArray(String key, String[] value);
|
||||
|
||||
/**
|
||||
* Add a raw property.
|
||||
*
|
||||
@@ -147,6 +227,15 @@ public interface SendableBuilder extends AutoCloseable {
|
||||
void addRawProperty(
|
||||
String key, String typeString, Supplier<byte[]> getter, Consumer<byte[]> setter);
|
||||
|
||||
/**
|
||||
* Add a constant raw property.
|
||||
*
|
||||
* @param key property name
|
||||
* @param typeString type string
|
||||
* @param value the value
|
||||
*/
|
||||
void publishConstRaw(String key, String typeString, byte[] value);
|
||||
|
||||
/**
|
||||
* Gets the kind of backend being used.
|
||||
*
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user