WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::nt::UnitPublisher< T > Class Template Reference

NetworkTables unit-typed publisher. More...

#include <wpi/nt/UnitTopic.hpp>

Inheritance diagram for wpi::nt::UnitPublisher< T >:
wpi::nt::Publisher wpi::nt::UnitEntry< T >

Public Types

using TopicType = UnitTopic<T>
using ValueType = T
using ParamType = T
using TimestampedValueType = TimestampedUnit<T>

Public Member Functions

 UnitPublisher ()=default
 UnitPublisher (NT_Publisher handle)
 Construct from a publisher handle; recommended to use UnitTopic::Publish() instead.
void Set (ParamType value, int64_t time=0)
 Publish a new value.
void SetDefault (ParamType value)
 Publish a default value.
TopicType GetTopic () const
 Get the corresponding topic.
Public Member Functions inherited from wpi::nt::Publisher
virtual ~Publisher ()
 Publisher (const Publisher &)=delete
Publisheroperator= (const Publisher &)=delete
 Publisher (Publisher &&rhs)
Publisheroperator= (Publisher &&rhs)
 operator bool () const
 Determines if the native handle is valid.
NT_Publisher GetHandle () const
 Gets the native handle for the publisher.
Topic GetTopic () const
 Gets the published-to topic.

Additional Inherited Members

Protected Member Functions inherited from wpi::nt::Publisher
 Publisher ()=default
 Publisher (NT_Publisher handle)
Protected Attributes inherited from wpi::nt::Publisher
NT_Publisher m_pubHandle {0}
 NetworkTables handle.

Detailed Description

template<typename T>
class wpi::nt::UnitPublisher< T >

NetworkTables unit-typed publisher.

Template Parameters
Tunit type, e.g. wpi::units::meter_t

Member Typedef Documentation

◆ ParamType

template<typename T>
using wpi::nt::UnitPublisher< T >::ParamType = T

◆ TimestampedValueType

template<typename T>
using wpi::nt::UnitPublisher< T >::TimestampedValueType = TimestampedUnit<T>

◆ TopicType

template<typename T>
using wpi::nt::UnitPublisher< T >::TopicType = UnitTopic<T>

◆ ValueType

template<typename T>
using wpi::nt::UnitPublisher< T >::ValueType = T

Constructor & Destructor Documentation

◆ UnitPublisher() [1/2]

template<typename T>
wpi::nt::UnitPublisher< T >::UnitPublisher ( )
default

◆ UnitPublisher() [2/2]

template<typename T>
wpi::nt::UnitPublisher< T >::UnitPublisher ( NT_Publisher handle)
inlineexplicit

Construct from a publisher handle; recommended to use UnitTopic::Publish() instead.

Parameters
handleNative handle

Member Function Documentation

◆ GetTopic()

template<typename T>
TopicType wpi::nt::UnitPublisher< T >::GetTopic ( ) const
inline

Get the corresponding topic.

Returns
Topic

◆ Set()

template<typename T>
void wpi::nt::UnitPublisher< T >::Set ( ParamType value,
int64_t time = 0 )
inline

Publish a new value.

Parameters
valuevalue to publish
timetimestamp; 0 indicates current NT time should be used

◆ SetDefault()

template<typename T>
void wpi::nt::UnitPublisher< T >::SetDefault ( ParamType value)
inline

Publish a default value.

On reconnect, a default value will never be used in preference to a published value.

Parameters
valuevalue

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