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

NetworkTables struct-encoded value publisher. More...

#include <wpi/nt/StructTopic.hpp>

Inheritance diagram for wpi::nt::StructPublisher< T, I >:
wpi::nt::Publisher

Public Types

using TopicType = StructTopic<T, I...>
using ValueType = T
using ParamType = const T&
using TimestampedValueType = Timestamped<T>

Public Member Functions

 StructPublisher ()=default
 StructPublisher (const StructPublisher &)=delete
StructPublisheroperator= (const StructPublisher &)=delete
 StructPublisher (StructPublisher &&rhs)
StructPublisheroperator= (StructPublisher &&rhs)
 StructPublisher (NT_Publisher handle, I... info)
 Construct from a publisher handle; recommended to use StructTopic::Publish() instead.
void Set (const T &value, int64_t time=0)
 Publish a new value.
void SetDefault (const T &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, typename... I>
requires wpi::util::StructSerializable<T, I...>
class wpi::nt::StructPublisher< T, I >

NetworkTables struct-encoded value publisher.

Member Typedef Documentation

◆ ParamType

template<typename T, typename... I>
using wpi::nt::StructPublisher< T, I >::ParamType = const T&

◆ TimestampedValueType

template<typename T, typename... I>
using wpi::nt::StructPublisher< T, I >::TimestampedValueType = Timestamped<T>

◆ TopicType

template<typename T, typename... I>
using wpi::nt::StructPublisher< T, I >::TopicType = StructTopic<T, I...>

◆ ValueType

template<typename T, typename... I>
using wpi::nt::StructPublisher< T, I >::ValueType = T

Constructor & Destructor Documentation

◆ StructPublisher() [1/4]

template<typename T, typename... I>
wpi::nt::StructPublisher< T, I >::StructPublisher ( )
default

◆ StructPublisher() [2/4]

template<typename T, typename... I>
wpi::nt::StructPublisher< T, I >::StructPublisher ( const StructPublisher< T, I > & )
delete

◆ StructPublisher() [3/4]

template<typename T, typename... I>
wpi::nt::StructPublisher< T, I >::StructPublisher ( StructPublisher< T, I > && rhs)
inline

◆ StructPublisher() [4/4]

template<typename T, typename... I>
wpi::nt::StructPublisher< T, I >::StructPublisher ( NT_Publisher handle,
I... info )
inlineexplicit

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

Parameters
handleNative handle
infooptional struct type info

Member Function Documentation

◆ GetTopic()

template<typename T, typename... I>
TopicType wpi::nt::StructPublisher< T, I >::GetTopic ( ) const
inline

Get the corresponding topic.

Returns
Topic

◆ operator=() [1/2]

template<typename T, typename... I>
StructPublisher & wpi::nt::StructPublisher< T, I >::operator= ( const StructPublisher< T, I > & )
delete

◆ operator=() [2/2]

template<typename T, typename... I>
StructPublisher & wpi::nt::StructPublisher< T, I >::operator= ( StructPublisher< T, I > && rhs)
inline

◆ Set()

template<typename T, typename... I>
void wpi::nt::StructPublisher< T, I >::Set ( const T & 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, typename... I>
void wpi::nt::StructPublisher< T, I >::SetDefault ( const T & 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: