WPILibC++ 2024.3.2
wpi::SendableBuilder Class Referenceabstract

Helper class for building Sendable dashboard representations. More...

#include <wpi/sendable/SendableBuilder.h>

Inheritance diagram for wpi::SendableBuilder:
nt::NTSendableBuilder frc::SendableBuilderImpl

Public Types

enum  BackendKind { kUnknown , kNetworkTables }
 The backend kinds used for the sendable builder. More...
 

Public Member Functions

virtual ~SendableBuilder ()=default
 
virtual void SetSmartDashboardType (std::string_view type)=0
 Set the string representation of the named data type that will be used by the smart dashboard for this sendable. More...
 
virtual void SetActuator (bool value)=0
 Set a flag indicating if this sendable should be treated as an actuator. More...
 
virtual void SetSafeState (std::function< void()> func)=0
 Set the function that should be called to set the Sendable into a safe state. More...
 
virtual void AddBooleanProperty (std::string_view key, std::function< bool()> getter, std::function< void(bool)> setter)=0
 Add a boolean property. More...
 
virtual void PublishConstBoolean (std::string_view key, bool value)=0
 Add a constant boolean property. More...
 
virtual void AddIntegerProperty (std::string_view key, std::function< int64_t()> getter, std::function< void(int64_t)> setter)=0
 Add an integer property. More...
 
virtual void PublishConstInteger (std::string_view key, int64_t value)=0
 Add a constant integer property. More...
 
virtual void AddFloatProperty (std::string_view key, std::function< float()> getter, std::function< void(float)> setter)=0
 Add a float property. More...
 
virtual void PublishConstFloat (std::string_view key, float value)=0
 Add a constant float property. More...
 
virtual void AddDoubleProperty (std::string_view key, std::function< double()> getter, std::function< void(double)> setter)=0
 Add a double property. More...
 
virtual void PublishConstDouble (std::string_view key, double value)=0
 Add a constant double property. More...
 
virtual void AddStringProperty (std::string_view key, std::function< std::string()> getter, std::function< void(std::string_view)> setter)=0
 Add a string property. More...
 
virtual void PublishConstString (std::string_view key, std::string_view value)=0
 Add a constant string property. More...
 
virtual void AddBooleanArrayProperty (std::string_view key, std::function< std::vector< int >()> getter, std::function< void(std::span< const int >)> setter)=0
 Add a boolean array property. More...
 
virtual void PublishConstBooleanArray (std::string_view key, std::span< const int > value)=0
 Add a constant boolean array property. More...
 
virtual void AddIntegerArrayProperty (std::string_view key, std::function< std::vector< int64_t >()> getter, std::function< void(std::span< const int64_t >)> setter)=0
 Add an integer array property. More...
 
virtual void PublishConstIntegerArray (std::string_view key, std::span< const int64_t > value)=0
 Add a constant integer array property. More...
 
virtual void AddFloatArrayProperty (std::string_view key, std::function< std::vector< float >()> getter, std::function< void(std::span< const float >)> setter)=0
 Add a float array property. More...
 
virtual void PublishConstFloatArray (std::string_view key, std::span< const float > value)=0
 Add a constant float array property. More...
 
virtual void AddDoubleArrayProperty (std::string_view key, std::function< std::vector< double >()> getter, std::function< void(std::span< const double >)> setter)=0
 Add a double array property. More...
 
virtual void PublishConstDoubleArray (std::string_view key, std::span< const double > value)=0
 Add a constant double array property. More...
 
virtual void AddStringArrayProperty (std::string_view key, std::function< std::vector< std::string >()> getter, std::function< void(std::span< const std::string >)> setter)=0
 Add a string array property. More...
 
virtual void PublishConstStringArray (std::string_view key, std::span< const std::string > value)=0
 Add a constant string array property. More...
 
virtual 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)=0
 Add a raw property. More...
 
virtual void PublishConstRaw (std::string_view key, std::string_view typeString, std::span< const uint8_t > value)=0
 Add a constant raw property. More...
 
virtual void AddSmallStringProperty (std::string_view key, std::function< std::string_view(wpi::SmallVectorImpl< char > &buf)> getter, std::function< void(std::string_view)> setter)=0
 Add a string property (SmallString form). More...
 
virtual 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)=0
 Add a boolean array property (SmallVector form). More...
 
virtual 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)=0
 Add an integer array property (SmallVector form). More...
 
virtual 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)=0
 Add a float array property (SmallVector form). More...
 
virtual 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)=0
 Add a double array property (SmallVector form). More...
 
virtual 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)=0
 Add a string array property (SmallVector form). More...
 
virtual 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)=0
 Add a raw property (SmallVector form). More...
 
virtual BackendKind GetBackendKind () const =0
 Gets the kind of backend being used. More...
 
virtual bool IsPublished () const =0
 Return whether this sendable has been published. More...
 
virtual void Update ()=0
 Update the published values by calling the getters for all properties. More...
 
virtual void ClearProperties ()=0
 Clear properties. More...
 

Detailed Description

Helper class for building Sendable dashboard representations.

Member Enumeration Documentation

◆ BackendKind

The backend kinds used for the sendable builder.

Enumerator
kUnknown 

Unknown.

kNetworkTables 

NetworkTables.

Constructor & Destructor Documentation

◆ ~SendableBuilder()

virtual wpi::SendableBuilder::~SendableBuilder ( )
virtualdefault

Member Function Documentation

◆ AddBooleanArrayProperty()

virtual void wpi::SendableBuilder::AddBooleanArrayProperty ( std::string_view  key,
std::function< std::vector< int >()>  getter,
std::function< void(std::span< const int >)>  setter 
)
pure virtual

Add a boolean array property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddBooleanProperty()

virtual void wpi::SendableBuilder::AddBooleanProperty ( std::string_view  key,
std::function< bool()>  getter,
std::function< void(bool)>  setter 
)
pure virtual

Add a boolean property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddDoubleArrayProperty()

virtual void wpi::SendableBuilder::AddDoubleArrayProperty ( std::string_view  key,
std::function< std::vector< double >()>  getter,
std::function< void(std::span< const double >)>  setter 
)
pure virtual

Add a double array property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddDoubleProperty()

virtual void wpi::SendableBuilder::AddDoubleProperty ( std::string_view  key,
std::function< double()>  getter,
std::function< void(double)>  setter 
)
pure virtual

Add a double property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddFloatArrayProperty()

virtual void wpi::SendableBuilder::AddFloatArrayProperty ( std::string_view  key,
std::function< std::vector< float >()>  getter,
std::function< void(std::span< const float >)>  setter 
)
pure virtual

Add a float array property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddFloatProperty()

virtual void wpi::SendableBuilder::AddFloatProperty ( std::string_view  key,
std::function< float()>  getter,
std::function< void(float)>  setter 
)
pure virtual

Add a float property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddIntegerArrayProperty()

virtual void wpi::SendableBuilder::AddIntegerArrayProperty ( std::string_view  key,
std::function< std::vector< int64_t >()>  getter,
std::function< void(std::span< const int64_t >)>  setter 
)
pure virtual

Add an integer array property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddIntegerProperty()

virtual void wpi::SendableBuilder::AddIntegerProperty ( std::string_view  key,
std::function< int64_t()>  getter,
std::function< void(int64_t)>  setter 
)
pure virtual

Add an integer property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddRawProperty()

virtual void wpi::SendableBuilder::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 
)
pure virtual

Add a raw property.

Parameters
keyproperty name
typeStringtype string
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddSmallBooleanArrayProperty()

virtual void wpi::SendableBuilder::AddSmallBooleanArrayProperty ( std::string_view  key,
std::function< std::span< const int >(wpi::SmallVectorImpl< int > &buf)>  getter,
std::function< void(std::span< const int >)>  setter 
)
pure virtual

Add a boolean array property (SmallVector form).

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

◆ AddSmallDoubleArrayProperty()

virtual void wpi::SendableBuilder::AddSmallDoubleArrayProperty ( std::string_view  key,
std::function< std::span< const double >(wpi::SmallVectorImpl< double > &buf)>  getter,
std::function< void(std::span< const double >)>  setter 
)
pure virtual

Add a double array property (SmallVector form).

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

◆ AddSmallFloatArrayProperty()

virtual void wpi::SendableBuilder::AddSmallFloatArrayProperty ( std::string_view  key,
std::function< std::span< const float >(wpi::SmallVectorImpl< float > &buf)>  getter,
std::function< void(std::span< const float >)>  setter 
)
pure virtual

Add a float array property (SmallVector form).

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

◆ AddSmallIntegerArrayProperty()

virtual void wpi::SendableBuilder::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 
)
pure virtual

Add an integer array property (SmallVector form).

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

◆ AddSmallRawProperty()

virtual void wpi::SendableBuilder::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 
)
pure virtual

Add a raw property (SmallVector form).

Parameters
keyproperty name
typeStringtype string
gettergetter function (returns current value)
settersetter function (sets new value)

◆ AddSmallStringArrayProperty()

virtual void wpi::SendableBuilder::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 
)
pure virtual

Add a string array property (SmallVector form).

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

◆ AddSmallStringProperty()

virtual void wpi::SendableBuilder::AddSmallStringProperty ( std::string_view  key,
std::function< std::string_view(wpi::SmallVectorImpl< char > &buf)>  getter,
std::function< void(std::string_view)>  setter 
)
pure virtual

Add a string property (SmallString form).

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

◆ AddStringArrayProperty()

virtual void wpi::SendableBuilder::AddStringArrayProperty ( std::string_view  key,
std::function< std::vector< std::string >()>  getter,
std::function< void(std::span< const std::string >)>  setter 
)
pure virtual

Add a string array property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ AddStringProperty()

virtual void wpi::SendableBuilder::AddStringProperty ( std::string_view  key,
std::function< std::string()>  getter,
std::function< void(std::string_view)>  setter 
)
pure virtual

Add a string property.

Parameters
keyproperty name
gettergetter function (returns current value)
settersetter function (sets new value)

Implemented in frc::SendableBuilderImpl.

◆ ClearProperties()

virtual void wpi::SendableBuilder::ClearProperties ( )
pure virtual

Clear properties.

Implemented in frc::SendableBuilderImpl.

◆ GetBackendKind()

virtual BackendKind wpi::SendableBuilder::GetBackendKind ( ) const
pure virtual

Gets the kind of backend being used.

Returns
Backend kind

Implemented in nt::NTSendableBuilder.

◆ IsPublished()

virtual bool wpi::SendableBuilder::IsPublished ( ) const
pure virtual

Return whether this sendable has been published.

Returns
True if it has been published, false if not.

Implemented in frc::SendableBuilderImpl.

◆ PublishConstBoolean()

virtual void wpi::SendableBuilder::PublishConstBoolean ( std::string_view  key,
bool  value 
)
pure virtual

Add a constant boolean property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstBooleanArray()

virtual void wpi::SendableBuilder::PublishConstBooleanArray ( std::string_view  key,
std::span< const int >  value 
)
pure virtual

Add a constant boolean array property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstDouble()

virtual void wpi::SendableBuilder::PublishConstDouble ( std::string_view  key,
double  value 
)
pure virtual

Add a constant double property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstDoubleArray()

virtual void wpi::SendableBuilder::PublishConstDoubleArray ( std::string_view  key,
std::span< const double >  value 
)
pure virtual

Add a constant double array property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstFloat()

virtual void wpi::SendableBuilder::PublishConstFloat ( std::string_view  key,
float  value 
)
pure virtual

Add a constant float property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstFloatArray()

virtual void wpi::SendableBuilder::PublishConstFloatArray ( std::string_view  key,
std::span< const float >  value 
)
pure virtual

Add a constant float array property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstInteger()

virtual void wpi::SendableBuilder::PublishConstInteger ( std::string_view  key,
int64_t  value 
)
pure virtual

Add a constant integer property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstIntegerArray()

virtual void wpi::SendableBuilder::PublishConstIntegerArray ( std::string_view  key,
std::span< const int64_t >  value 
)
pure virtual

Add a constant integer array property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstRaw()

virtual void wpi::SendableBuilder::PublishConstRaw ( std::string_view  key,
std::string_view  typeString,
std::span< const uint8_t >  value 
)
pure virtual

Add a constant raw property.

Parameters
keyproperty name
typeStringtype string
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstString()

virtual void wpi::SendableBuilder::PublishConstString ( std::string_view  key,
std::string_view  value 
)
pure virtual

Add a constant string property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ PublishConstStringArray()

virtual void wpi::SendableBuilder::PublishConstStringArray ( std::string_view  key,
std::span< const std::string >  value 
)
pure virtual

Add a constant string array property.

Parameters
keyproperty name
valuethe value

Implemented in frc::SendableBuilderImpl.

◆ SetActuator()

virtual void wpi::SendableBuilder::SetActuator ( bool  value)
pure virtual

Set a flag indicating if this sendable should be treated as an actuator.

By default this flag is false.

Parameters
valuetrue if actuator, false if not

Implemented in frc::SendableBuilderImpl.

◆ SetSafeState()

virtual void wpi::SendableBuilder::SetSafeState ( std::function< void()>  func)
pure virtual

Set the function that should be called to set the Sendable into a safe state.

This is called when entering and exiting Live Window mode.

Parameters
funcfunction

Implemented in frc::SendableBuilderImpl.

◆ SetSmartDashboardType()

virtual void wpi::SendableBuilder::SetSmartDashboardType ( std::string_view  type)
pure virtual

Set the string representation of the named data type that will be used by the smart dashboard for this sendable.

Parameters
typedata type

Implemented in frc::SendableBuilderImpl.

◆ Update()

virtual void wpi::SendableBuilder::Update ( )
pure virtual

Update the published values by calling the getters for all properties.

Implemented in frc::SendableBuilderImpl.


The documentation for this class was generated from the following file: