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

NetworkTables protobuf-encoded value publisher. More...

#include <wpi/nt/ProtobufTopic.hpp>

Inheritance diagram for wpi::nt::ProtobufPublisher< T >:
wpi::nt::Publisher wpi::nt::ProtobufEntry< T >

Public Types

using TopicType = ProtobufTopic<T>
using ValueType = T
using ParamType = const T&
using TimestampedValueType = Timestamped<T>

Public Member Functions

 ProtobufPublisher ()=default
 ProtobufPublisher (NT_Publisher handle, wpi::util::ProtobufMessage< T > msg)
 Construct from a publisher handle; recommended to use ProtobufTopic::Publish() instead.
 ProtobufPublisher (const ProtobufPublisher &)=delete
ProtobufPublisheroperator= (const ProtobufPublisher &)=delete
 ProtobufPublisher (ProtobufPublisher &&rhs)
ProtobufPublisheroperator= (ProtobufPublisher &&rhs)
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<wpi::util::ProtobufSerializable T>
class wpi::nt::ProtobufPublisher< T >

NetworkTables protobuf-encoded value publisher.

Member Typedef Documentation

◆ ParamType

using wpi::nt::ProtobufPublisher< T >::ParamType = const T&

◆ TimestampedValueType

using wpi::nt::ProtobufPublisher< T >::TimestampedValueType = Timestamped<T>

◆ TopicType

◆ ValueType

using wpi::nt::ProtobufPublisher< T >::ValueType = T

Constructor & Destructor Documentation

◆ ProtobufPublisher() [1/4]

wpi::nt::ProtobufPublisher< T >::ProtobufPublisher ( )
default

◆ ProtobufPublisher() [2/4]

wpi::nt::ProtobufPublisher< T >::ProtobufPublisher ( NT_Publisher handle,
wpi::util::ProtobufMessage< T > msg )
inlineexplicit

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

Parameters
handleNative handle
msgProtobuf message

◆ ProtobufPublisher() [3/4]

wpi::nt::ProtobufPublisher< T >::ProtobufPublisher ( const ProtobufPublisher< T > & )
delete

◆ ProtobufPublisher() [4/4]

wpi::nt::ProtobufPublisher< T >::ProtobufPublisher ( ProtobufPublisher< T > && rhs)
inline

Member Function Documentation

◆ GetTopic()

TopicType wpi::nt::ProtobufPublisher< T >::GetTopic ( ) const
inline

Get the corresponding topic.

Returns
Topic

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ Set()

void wpi::nt::ProtobufPublisher< T >::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()

void wpi::nt::ProtobufPublisher< T >::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: