40  void SetTable(std::shared_ptr<nt::NetworkTable> table);
 
   46  std::shared_ptr<nt::NetworkTable> 
GetTable() 
override;
 
  100                          std::function<
void(
bool)> setter) 
override;
 
  105                          std::function<
void(int64_t)> setter) 
override;
 
  110                        std::function<
void(
float)> setter) 
override;
 
  115                         std::function<
void(
double)> setter) 
override;
 
  120                         std::function<std::string()> getter,
 
  121                         std::function<
void(std::string_view)> setter) 
override;
 
  124                          std::string_view value) 
override;
 
  127      std::string_view key, std::function<std::vector<int>()> getter,
 
  128      std::function<
void(std::span<const int>)> setter) 
override;
 
  131                                std::span<const int> value) 
override;
 
  134      std::string_view key, std::function<std::vector<int64_t>()> getter,
 
  135      std::function<
void(std::span<const int64_t>)> setter) 
override;
 
  138                                std::span<const int64_t> value) 
override;
 
  141      std::string_view key, std::function<std::vector<float>()> getter,
 
  142      std::function<
void(std::span<const float>)> setter) 
override;
 
  145                              std::span<const float> value) 
override;
 
  148      std::string_view key, std::function<std::vector<double>()> getter,
 
  149      std::function<
void(std::span<const double>)> setter) 
override;
 
  152                               std::span<const double> value) 
override;
 
  155      std::string_view key, std::function<std::vector<std::string>()> getter,
 
  156      std::function<
void(std::span<const std::string>)> setter) 
override;
 
  159                               std::span<const std::string> value) 
override;
 
  162      std::string_view key, std::string_view typeString,
 
  163      std::function<std::vector<uint8_t>()> getter,
 
  164      std::function<
void(std::span<const uint8_t>)> setter) 
override;
 
  167                       std::span<const uint8_t> value) 
override;
 
  170      std::string_view key,
 
  172      std::function<
void(std::string_view)> setter) 
override;
 
  175      std::string_view key,
 
  178      std::function<
void(std::span<const int>)> setter) 
override;
 
  181      std::string_view key,
 
  185      std::function<
void(std::span<const int64_t>)> setter) 
override;
 
  188      std::string_view key,
 
  191      std::function<
void(std::span<const float>)> setter) 
override;
 
  194      std::string_view key,
 
  197      std::function<
void(std::span<const double>)> setter) 
override;
 
  200      std::string_view key,
 
  204      std::function<
void(std::span<const std::string>)> setter) 
override;
 
  207      std::string_view key, std::string_view typeString,
 
  210      std::function<
void(std::span<const uint8_t>)> setter) 
override;
 
  214    virtual ~Property() = 
default;
 
  215    virtual void Update(
bool controllable, int64_t time) = 0;
 
  218  template <
typename Topic>
 
  219  struct PropertyImpl : 
public Property {
 
  220    void Update(
bool controllable, int64_t time) 
override;
 
  222    using Publisher = 
typename Topic::PublisherType;
 
  223    using Subscriber = 
typename Topic::SubscriberType;
 
  226    std::function<void(Publisher& pub, int64_t time)> updateNetwork;
 
  227    std::function<void(Subscriber& sub)> updateLocal;
 
  230  template <
typename Topic, 
typename Getter, 
typename Setter>
 
  231  void AddPropertyImpl(Topic topic, Getter getter, Setter setter);
 
  233  template <
typename Topic, 
typename Value>
 
  234  void PublishConstImpl(Topic topic, Value value);
 
  236  template <
typename T, 
size_t Size, 
typename Topic, 
typename Getter,
 
  238  void AddSmallPropertyImpl(Topic topic, Getter getter, Setter setter);
 
  240  std::vector<std::unique_ptr<Property>> m_properties;
 
  241  std::function<void()> m_safeState;
 
  243  std::shared_ptr<nt::NetworkTable> m_table;
 
  244  bool m_controllable = 
false;
 
  245  bool m_actuator = 
false;
 
 
This file defines the SmallVector class.
 
Implementation detail for SendableBuilder.
Definition SendableBuilderImpl.h:27
 
void AddSmallRawProperty(std::string_view key, std::string_view typeString, std::function< std::span< uint8_t >(wpi::SmallVectorImpl< uint8_t > &buf)> getter, std::function< void(std::span< const uint8_t >)> setter) override
 
void AddDoubleProperty(std::string_view key, std::function< double()> getter, std::function< void(double)> setter) override
Add a double property.
 
void PublishConstInteger(std::string_view key, int64_t value) override
Add a constant integer property.
 
void AddIntegerProperty(std::string_view key, std::function< int64_t()> getter, std::function< void(int64_t)> setter) override
Add an integer property.
 
void SetSmartDashboardType(std::string_view type) override
Set the string representation of the named data type that will be used by the smart dashboard for thi...
 
void SetSafeState(std::function< void()> func) override
Set the function that should be called to set the Sendable into a safe state.
 
void AddDoubleArrayProperty(std::string_view key, std::function< std::vector< double >()> getter, std::function< void(std::span< const double >)> setter) override
Add a double array property.
 
void AddSmallFloatArrayProperty(std::string_view key, std::function< std::span< const float >(wpi::SmallVectorImpl< float > &buf)> getter, std::function< void(std::span< const float >)> setter) override
 
bool IsActuator() const
Return whether this sendable should be treated as an actuator.
 
void StartListeners()
Hook setters for all properties.
 
void AddSmallDoubleArrayProperty(std::string_view key, std::function< std::span< const double >(wpi::SmallVectorImpl< double > &buf)> getter, std::function< void(std::span< const double >)> setter) override
 
void AddBooleanProperty(std::string_view key, std::function< bool()> getter, std::function< void(bool)> setter) override
Add a boolean property.
 
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
Add a raw property.
 
void AddStringProperty(std::string_view key, std::function< std::string()> getter, std::function< void(std::string_view)> setter) override
Add a string property.
 
void PublishConstDouble(std::string_view key, double value) override
Add a constant double property.
 
void StopLiveWindowMode()
Stop LiveWindow mode by unhooking the setters for all properties.
 
void AddSmallStringArrayProperty(std::string_view key, std::function< std::span< const std::string >(wpi::SmallVectorImpl< std::string > &buf)> getter, std::function< void(std::span< const std::string >)> setter) override
 
void PublishConstString(std::string_view key, std::string_view value) override
Add a constant string property.
 
void AddSmallStringProperty(std::string_view key, std::function< std::string_view(wpi::SmallVectorImpl< char > &buf)> getter, std::function< void(std::string_view)> setter) override
 
nt::Topic GetTopic(std::string_view key) override
Add a property without getters or setters.
 
SendableBuilderImpl()=default
 
void SetTable(std::shared_ptr< nt::NetworkTable > table)
Set the network table.
 
std::shared_ptr< nt::NetworkTable > GetTable() override
Get the network table.
 
SendableBuilderImpl & operator=(SendableBuilderImpl &&)=default
 
void AddSmallBooleanArrayProperty(std::string_view key, std::function< std::span< const int >(wpi::SmallVectorImpl< int > &buf)> getter, std::function< void(std::span< const int >)> setter) override
 
void PublishConstDoubleArray(std::string_view key, std::span< const double > value) override
Add a constant double array property.
 
void SetActuator(bool value) override
Set a flag indicating if this sendable should be treated as an actuator.
 
void AddSmallIntegerArrayProperty(std::string_view key, std::function< std::span< const int64_t >(wpi::SmallVectorImpl< int64_t > &buf)> getter, std::function< void(std::span< const int64_t >)> setter) override
 
void PublishConstBooleanArray(std::string_view key, std::span< const int > value) override
Add a constant boolean array property.
 
~SendableBuilderImpl() override=default
 
void AddBooleanArrayProperty(std::string_view key, std::function< std::vector< int >()> getter, std::function< void(std::span< const int >)> setter) override
Add a boolean array property.
 
void Update() override
Synchronize with network table values by calling the getters for all properties and setters when the ...
 
void PublishConstStringArray(std::string_view key, std::span< const std::string > value) override
Add a constant string array property.
 
void AddStringArrayProperty(std::string_view key, std::function< std::vector< std::string >()> getter, std::function< void(std::span< const std::string >)> setter) override
Add a string array property.
 
void PublishConstFloat(std::string_view key, float value) override
Add a constant float property.
 
void StartLiveWindowMode()
Start LiveWindow mode by hooking the setters for all properties.
 
void AddFloatProperty(std::string_view key, std::function< float()> getter, std::function< void(float)> setter) override
Add a float property.
 
SendableBuilderImpl(SendableBuilderImpl &&)=default
 
void AddIntegerArrayProperty(std::string_view key, std::function< std::vector< int64_t >()> getter, std::function< void(std::span< const int64_t >)> setter) override
Add an integer array property.
 
bool IsPublished() const override
Return whether this sendable has an associated table.
 
void PublishConstBoolean(std::string_view key, bool value) override
Add a constant boolean property.
 
void PublishConstFloatArray(std::string_view key, std::span< const float > value) override
Add a constant float array property.
 
void PublishConstRaw(std::string_view key, std::string_view typeString, std::span< const uint8_t > value) override
Add a constant raw property.
 
void SetUpdateTable(wpi::unique_function< void()> func) override
Set the function that should be called to update the network table for things other than properties.
 
void AddFloatArrayProperty(std::string_view key, std::function< std::vector< float >()> getter, std::function< void(std::span< const float >)> setter) override
Add a float array property.
 
void StopListeners()
Unhook setters for all properties.
 
void ClearProperties() override
Clear properties.
 
void PublishConstIntegerArray(std::string_view key, std::span< const int64_t > value) override
Add a constant integer array property.
 
NetworkTables Boolean publisher.
Definition BooleanTopic.h:127
 
Helper class for building Sendable dashboard representations for NetworkTables.
Definition NTSendableBuilder.h:22
 
NetworkTables String publisher.
Definition StringTopic.h:184
 
NetworkTables Topic.
Definition Topic.h:28
 
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition sha1.h:30
 
unique_function is a type-erasing functor similar to std::function.
Definition FunctionExtras.h:57