WPILibC++ 2024.1.1-beta-4
nt::StructPublisher< T > Class Template Reference

NetworkTables struct-encoded value publisher. More...

#include <networktables/StructTopic.h>

Inheritance diagram for nt::StructPublisher< T >:
nt::Publisher nt::StructEntry< T >

Public Types

using TopicType = StructTopic< T >
 
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)
 Construct from a publisher handle; recommended to use StructTopic::Publish() instead. More...
 
void Set (const T &value, int64_t time=0)
 Publish a new value. More...
 
void SetDefault (const T &value)
 Publish a default value. More...
 
TopicType GetTopic () const
 Get the corresponding topic. More...
 
- Public Member Functions inherited from nt::Publisher
virtual ~Publisher ()
 
 Publisher (const Publisher &)=delete
 
Publisheroperator= (const Publisher &)=delete
 
 Publisher (Publisher &&)
 
Publisheroperator= (Publisher &&)
 
 operator bool () const
 Determines if the native handle is valid. More...
 
NT_Publisher GetHandle () const
 Gets the native handle for the publisher. More...
 
Topic GetTopic () const
 Gets the published-to topic. More...
 

Additional Inherited Members

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

Detailed Description

template<wpi::StructSerializable T>
class nt::StructPublisher< T >

NetworkTables struct-encoded value publisher.

Member Typedef Documentation

◆ ParamType

using nt::StructPublisher< T >::ParamType = const T&

◆ TimestampedValueType

using nt::StructPublisher< T >::TimestampedValueType = Timestamped<T>

◆ TopicType

using nt::StructPublisher< T >::TopicType = StructTopic<T>

◆ ValueType

using nt::StructPublisher< T >::ValueType = T

Constructor & Destructor Documentation

◆ StructPublisher() [1/4]

nt::StructPublisher< T >::StructPublisher ( )
default

◆ StructPublisher() [2/4]

nt::StructPublisher< T >::StructPublisher ( const StructPublisher< T > &  )
delete

◆ StructPublisher() [3/4]

nt::StructPublisher< T >::StructPublisher ( StructPublisher< T > &&  rhs)
inline

◆ StructPublisher() [4/4]

nt::StructPublisher< T >::StructPublisher ( NT_Publisher  handle)
inlineexplicit

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

Parameters
handleNative handle

Member Function Documentation

◆ GetTopic()

TopicType nt::StructPublisher< T >::GetTopic ( ) const
inline

Get the corresponding topic.

Returns
Topic

◆ operator=() [1/2]

StructPublisher & nt::StructPublisher< T >::operator= ( const StructPublisher< T > &  )
delete

◆ operator=() [2/2]

StructPublisher & nt::StructPublisher< T >::operator= ( StructPublisher< T > &&  rhs)
inline

◆ Set()

void nt::StructPublisher< 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 nt::StructPublisher< 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: