WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
frc::SendableBuilderImpl Class Reference

Implementation detail for SendableBuilder. More...

#include <frc/smartdashboard/SendableBuilderImpl.h>

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

Public Member Functions

 SendableBuilderImpl ()=default
 
 ~SendableBuilderImpl () override=default
 
 SendableBuilderImpl (SendableBuilderImpl &&)=default
 
SendableBuilderImploperator= (SendableBuilderImpl &&)=default
 
void SetTable (std::shared_ptr< nt::NetworkTable > table)
 Set the network table.
 
std::shared_ptr< nt::NetworkTableGetTable () override
 Get the network table.
 
bool IsPublished () const override
 Return whether this sendable has an associated table.
 
bool IsActuator () const
 Return whether this sendable should be treated as an actuator.
 
void Update () override
 Synchronize with network table values by calling the getters for all properties and setters when the network table value has changed.
 
void StartListeners ()
 Hook setters for all properties.
 
void StopListeners ()
 Unhook setters for all properties.
 
void StartLiveWindowMode ()
 Start LiveWindow mode by hooking the setters for all properties.
 
void StopLiveWindowMode ()
 Stop LiveWindow mode by unhooking the setters for all properties.
 
void ClearProperties () override
 Clear properties.
 
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 this sendable.
 
void SetActuator (bool value) override
 Set a flag indicating if this sendable should be treated as an actuator.
 
void SetSafeState (std::function< void()> func) override
 Set the function that should be called to set the Sendable into a safe state.
 
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.
 
nt::Topic GetTopic (std::string_view key) override
 Add a property without getters or setters.
 
void AddBooleanProperty (std::string_view key, std::function< bool()> getter, std::function< void(bool)> setter) override
 Add a boolean property.
 
void PublishConstBoolean (std::string_view key, bool value) override
 Add a constant boolean property.
 
void AddIntegerProperty (std::string_view key, std::function< int64_t()> getter, std::function< void(int64_t)> setter) override
 Add an integer property.
 
void PublishConstInteger (std::string_view key, int64_t value) override
 Add a constant integer property.
 
void AddFloatProperty (std::string_view key, std::function< float()> getter, std::function< void(float)> setter) override
 Add a float property.
 
void PublishConstFloat (std::string_view key, float value) override
 Add a constant float property.
 
void AddDoubleProperty (std::string_view key, std::function< double()> getter, std::function< void(double)> setter) override
 Add a double property.
 
void PublishConstDouble (std::string_view key, double value) override
 Add a constant double 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 PublishConstString (std::string_view key, std::string_view value) override
 Add a constant string property.
 
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 PublishConstBooleanArray (std::string_view key, std::span< const int > value) override
 Add a constant boolean array property.
 
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.
 
void PublishConstIntegerArray (std::string_view key, std::span< const int64_t > value) override
 Add a constant integer array property.
 
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 PublishConstFloatArray (std::string_view key, std::span< const float > value) override
 Add a constant float array property.
 
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 PublishConstDoubleArray (std::string_view key, std::span< const double > value) override
 Add a constant double 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 PublishConstStringArray (std::string_view key, std::span< const std::string > value) override
 Add a constant string array 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 PublishConstRaw (std::string_view key, std::string_view typeString, std::span< const uint8_t > value) override
 Add a constant raw 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
 
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 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 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
 
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 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 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
 
- Public Member Functions inherited from nt::NTSendableBuilder
BackendKind GetBackendKind () const override
 Gets the kind of backend being used.
 
- Public Member Functions inherited from wpi::SendableBuilder
virtual ~SendableBuilder ()=default
 
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).
 
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).
 
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).
 
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).
 
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).
 
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).
 
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).
 

Additional Inherited Members

- Public Types inherited from wpi::SendableBuilder
enum  BackendKind { kUnknown , kNetworkTables }
 The backend kinds used for the sendable builder. More...
 

Detailed Description

Implementation detail for SendableBuilder.

Constructor & Destructor Documentation

◆ SendableBuilderImpl() [1/2]

frc::SendableBuilderImpl::SendableBuilderImpl ( )
default

◆ ~SendableBuilderImpl()

frc::SendableBuilderImpl::~SendableBuilderImpl ( )
overridedefault

◆ SendableBuilderImpl() [2/2]

frc::SendableBuilderImpl::SendableBuilderImpl ( SendableBuilderImpl && )
default

Member Function Documentation

◆ AddBooleanArrayProperty()

void frc::SendableBuilderImpl::AddBooleanArrayProperty ( std::string_view key,
std::function< std::vector< int >()> getter,
std::function< void(std::span< const int >)> setter )
overridevirtual

Add a boolean array property.

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

Implements wpi::SendableBuilder.

◆ AddBooleanProperty()

void frc::SendableBuilderImpl::AddBooleanProperty ( std::string_view key,
std::function< bool()> getter,
std::function< void(bool)> setter )
overridevirtual

Add a boolean property.

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

Implements wpi::SendableBuilder.

◆ AddDoubleArrayProperty()

void frc::SendableBuilderImpl::AddDoubleArrayProperty ( std::string_view key,
std::function< std::vector< double >()> getter,
std::function< void(std::span< const double >)> setter )
overridevirtual

Add a double array property.

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

Implements wpi::SendableBuilder.

◆ AddDoubleProperty()

void frc::SendableBuilderImpl::AddDoubleProperty ( std::string_view key,
std::function< double()> getter,
std::function< void(double)> setter )
overridevirtual

Add a double property.

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

Implements wpi::SendableBuilder.

◆ AddFloatArrayProperty()

void frc::SendableBuilderImpl::AddFloatArrayProperty ( std::string_view key,
std::function< std::vector< float >()> getter,
std::function< void(std::span< const float >)> setter )
overridevirtual

Add a float array property.

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

Implements wpi::SendableBuilder.

◆ AddFloatProperty()

void frc::SendableBuilderImpl::AddFloatProperty ( std::string_view key,
std::function< float()> getter,
std::function< void(float)> setter )
overridevirtual

Add a float property.

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

Implements wpi::SendableBuilder.

◆ AddIntegerArrayProperty()

void frc::SendableBuilderImpl::AddIntegerArrayProperty ( std::string_view key,
std::function< std::vector< int64_t >()> getter,
std::function< void(std::span< const int64_t >)> setter )
overridevirtual

Add an integer array property.

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

Implements wpi::SendableBuilder.

◆ AddIntegerProperty()

void frc::SendableBuilderImpl::AddIntegerProperty ( std::string_view key,
std::function< int64_t()> getter,
std::function< void(int64_t)> setter )
overridevirtual

Add an integer property.

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

Implements wpi::SendableBuilder.

◆ AddRawProperty()

void frc::SendableBuilderImpl::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 )
overridevirtual

Add a raw property.

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

Implements wpi::SendableBuilder.

◆ AddSmallBooleanArrayProperty()

void frc::SendableBuilderImpl::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

◆ AddSmallDoubleArrayProperty()

void frc::SendableBuilderImpl::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

◆ AddSmallFloatArrayProperty()

void frc::SendableBuilderImpl::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

◆ AddSmallIntegerArrayProperty()

void frc::SendableBuilderImpl::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

◆ AddSmallRawProperty()

void frc::SendableBuilderImpl::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

◆ AddSmallStringArrayProperty()

void frc::SendableBuilderImpl::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

◆ AddSmallStringProperty()

void frc::SendableBuilderImpl::AddSmallStringProperty ( std::string_view key,
std::function< std::string_view(wpi::SmallVectorImpl< char > &buf)> getter,
std::function< void(std::string_view)> setter )
override

◆ AddStringArrayProperty()

void frc::SendableBuilderImpl::AddStringArrayProperty ( std::string_view key,
std::function< std::vector< std::string >()> getter,
std::function< void(std::span< const std::string >)> setter )
overridevirtual

Add a string array property.

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

Implements wpi::SendableBuilder.

◆ AddStringProperty()

void frc::SendableBuilderImpl::AddStringProperty ( std::string_view key,
std::function< std::string()> getter,
std::function< void(std::string_view)> setter )
overridevirtual

Add a string property.

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

Implements wpi::SendableBuilder.

◆ ClearProperties()

void frc::SendableBuilderImpl::ClearProperties ( )
overridevirtual

Clear properties.

Implements wpi::SendableBuilder.

◆ GetTable()

std::shared_ptr< nt::NetworkTable > frc::SendableBuilderImpl::GetTable ( )
overridevirtual

Get the network table.

Returns
The network table

Implements nt::NTSendableBuilder.

◆ GetTopic()

nt::Topic frc::SendableBuilderImpl::GetTopic ( std::string_view key)
overridevirtual

Add a property without getters or setters.

This can be used to get entry handles for the function called by SetUpdateTable().

Parameters
keyproperty name
Returns
Network table topic

Implements nt::NTSendableBuilder.

◆ IsActuator()

bool frc::SendableBuilderImpl::IsActuator ( ) const

Return whether this sendable should be treated as an actuator.

Returns
True if actuator, false if not.

◆ IsPublished()

bool frc::SendableBuilderImpl::IsPublished ( ) const
overridevirtual

Return whether this sendable has an associated table.

Returns
True if it has a table, false if not.

Implements wpi::SendableBuilder.

◆ operator=()

SendableBuilderImpl & frc::SendableBuilderImpl::operator= ( SendableBuilderImpl && )
default

◆ PublishConstBoolean()

void frc::SendableBuilderImpl::PublishConstBoolean ( std::string_view key,
bool value )
overridevirtual

Add a constant boolean property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstBooleanArray()

void frc::SendableBuilderImpl::PublishConstBooleanArray ( std::string_view key,
std::span< const int > value )
overridevirtual

Add a constant boolean array property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstDouble()

void frc::SendableBuilderImpl::PublishConstDouble ( std::string_view key,
double value )
overridevirtual

Add a constant double property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstDoubleArray()

void frc::SendableBuilderImpl::PublishConstDoubleArray ( std::string_view key,
std::span< const double > value )
overridevirtual

Add a constant double array property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstFloat()

void frc::SendableBuilderImpl::PublishConstFloat ( std::string_view key,
float value )
overridevirtual

Add a constant float property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstFloatArray()

void frc::SendableBuilderImpl::PublishConstFloatArray ( std::string_view key,
std::span< const float > value )
overridevirtual

Add a constant float array property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstInteger()

void frc::SendableBuilderImpl::PublishConstInteger ( std::string_view key,
int64_t value )
overridevirtual

Add a constant integer property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstIntegerArray()

void frc::SendableBuilderImpl::PublishConstIntegerArray ( std::string_view key,
std::span< const int64_t > value )
overridevirtual

Add a constant integer array property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstRaw()

void frc::SendableBuilderImpl::PublishConstRaw ( std::string_view key,
std::string_view typeString,
std::span< const uint8_t > value )
overridevirtual

Add a constant raw property.

Parameters
keyproperty name
typeStringtype string
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstString()

void frc::SendableBuilderImpl::PublishConstString ( std::string_view key,
std::string_view value )
overridevirtual

Add a constant string property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ PublishConstStringArray()

void frc::SendableBuilderImpl::PublishConstStringArray ( std::string_view key,
std::span< const std::string > value )
overridevirtual

Add a constant string array property.

Parameters
keyproperty name
valuethe value

Implements wpi::SendableBuilder.

◆ SetActuator()

void frc::SendableBuilderImpl::SetActuator ( bool value)
overridevirtual

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

Implements wpi::SendableBuilder.

◆ SetSafeState()

void frc::SendableBuilderImpl::SetSafeState ( std::function< void()> func)
overridevirtual

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

Implements wpi::SendableBuilder.

◆ SetSmartDashboardType()

void frc::SendableBuilderImpl::SetSmartDashboardType ( std::string_view type)
overridevirtual

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

Parameters
typedata type

Implements wpi::SendableBuilder.

◆ SetTable()

void frc::SendableBuilderImpl::SetTable ( std::shared_ptr< nt::NetworkTable > table)

Set the network table.

Must be called prior to any Add* functions being called.

Parameters
tableNetwork table

◆ SetUpdateTable()

void frc::SendableBuilderImpl::SetUpdateTable ( wpi::unique_function< void()> func)
overridevirtual

Set the function that should be called to update the network table for things other than properties.

Note this function is not passed the network table object; instead it should use the entry handles returned by GetEntry().

Parameters
funcfunction

Implements nt::NTSendableBuilder.

◆ StartListeners()

void frc::SendableBuilderImpl::StartListeners ( )

Hook setters for all properties.

◆ StartLiveWindowMode()

void frc::SendableBuilderImpl::StartLiveWindowMode ( )

Start LiveWindow mode by hooking the setters for all properties.

Also calls the SafeState function if one was provided.

◆ StopListeners()

void frc::SendableBuilderImpl::StopListeners ( )

Unhook setters for all properties.

◆ StopLiveWindowMode()

void frc::SendableBuilderImpl::StopLiveWindowMode ( )

Stop LiveWindow mode by unhooking the setters for all properties.

Also calls the SafeState function if one was provided.

◆ Update()

void frc::SendableBuilderImpl::Update ( )
overridevirtual

Synchronize with network table values by calling the getters for all properties and setters when the network table value has changed.

Implements wpi::SendableBuilder.


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