59 m_defaultValue{defaultValue} {}
68 return Get(m_defaultValue);
79 return ::wpi::nt::GetString(
m_subHandle, defaultValue);
90 return Get(buf, m_defaultValue);
125 return ::wpi::nt::GetAtomicString(
m_subHandle, defaultValue);
367 std::string_view typeString,
ParamType defaultValue,
Publisher(const Publisher &)=delete
NT_Publisher m_pubHandle
NetworkTables handle.
Definition Topic.hpp:440
NetworkTables String entry.
Definition StringTopic.hpp:240
std::string_view ParamType
Definition StringTopic.hpp:246
StringPublisher PublisherType
Definition StringTopic.hpp:243
StringEntry(NT_Entry handle, ParamType defaultValue)
Construct from an entry handle; recommended to use StringTopic::GetEntry() instead.
Definition StringTopic.hpp:262
void Unpublish()
Stops publishing the entry if it's published.
Definition StringTopic.hpp:290
std::string ValueType
Definition StringTopic.hpp:245
NT_Entry GetHandle() const
Gets the native handle for the entry.
Definition StringTopic.hpp:278
StringSubscriber SubscriberType
Definition StringTopic.hpp:242
StringTopic TopicType
Definition StringTopic.hpp:244
char SmallElemType
Definition StringTopic.hpp:249
TopicType GetTopic() const
Get the corresponding topic.
Definition StringTopic.hpp:486
TimestampedString TimestampedValueType
Definition StringTopic.hpp:251
std::string_view SmallRetType
Definition StringTopic.hpp:248
NetworkTables String publisher.
Definition StringTopic.hpp:184
std::string_view SmallRetType
Definition StringTopic.hpp:190
StringTopic TopicType
Definition StringTopic.hpp:186
char SmallElemType
Definition StringTopic.hpp:191
void SetDefault(ParamType value)
Publish a default value.
Definition StringTopic.hpp:222
StringPublisher(NT_Publisher handle)
Construct from a publisher handle; recommended to use StringTopic::Publish() instead.
Definition StringTopic.hpp:203
StringPublisher()=default
TopicType GetTopic() const
Get the corresponding topic.
Definition StringTopic.hpp:482
std::string_view ParamType
Definition StringTopic.hpp:188
TimestampedString TimestampedValueType
Definition StringTopic.hpp:193
std::string ValueType
Definition StringTopic.hpp:187
void Set(ParamType value, int64_t time=0)
Publish a new value.
Definition StringTopic.hpp:211
NetworkTables String subscriber.
Definition StringTopic.hpp:36
ValueType Get(ParamType defaultValue) const
Get the last published value.
Definition StringTopic.hpp:78
StringSubscriber()=default
SmallRetType Get(wpi::util::SmallVectorImpl< SmallElemType > &buf) const
Get the last published value.
Definition StringTopic.hpp:89
StringSubscriber(NT_Subscriber handle, ParamType defaultValue)
Construct from a subscriber handle; recommended to use StringTopic::Subscribe() instead.
Definition StringTopic.hpp:57
TimestampedValueViewType GetAtomic(wpi::util::SmallVectorImpl< SmallElemType > &buf, ParamType defaultValue) const
Get the last published value along with its timestamp.
Definition StringTopic.hpp:150
SmallRetType Get(wpi::util::SmallVectorImpl< SmallElemType > &buf, ParamType defaultValue) const
Get the last published value.
Definition StringTopic.hpp:101
TimestampedStringView TimestampedValueViewType
Definition StringTopic.hpp:45
std::string_view SmallRetType
Definition StringTopic.hpp:43
TimestampedValueViewType GetAtomic(wpi::util::SmallVectorImpl< SmallElemType > &buf) const
Get the last published value along with its timestamp.
Definition StringTopic.hpp:136
char SmallElemType
Definition StringTopic.hpp:44
std::string_view ParamType
Definition StringTopic.hpp:40
TimestampedValueType GetAtomic() const
Get the last published value along with its timestamp If no value has been published,...
Definition StringTopic.hpp:112
TopicType GetTopic() const
Get the corresponding topic.
Definition StringTopic.hpp:478
ValueType Get() const
Get the last published value.
Definition StringTopic.hpp:67
std::string ValueType
Definition StringTopic.hpp:39
TimestampedValueType GetAtomic(ParamType defaultValue) const
Get the last published value along with its timestamp.
Definition StringTopic.hpp:124
StringTopic TopicType
Definition StringTopic.hpp:38
TimestampedString TimestampedValueType
Definition StringTopic.hpp:41
std::vector< TimestampedValueType > ReadQueue()
Get an array of all value changes since the last call to ReadQueue.
Definition StringTopic.hpp:166
NetworkTables String topic.
Definition StringTopic.hpp:298
PublisherType Publish(const PubSubOptions &options=kDefaultPubSubOptions)
Create a new publisher to the topic.
Definition StringTopic.hpp:390
StringSubscriber SubscriberType
Definition StringTopic.hpp:300
SubscriberType Subscribe(ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new subscriber to the topic.
Definition StringTopic.hpp:342
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new entry for the topic, with specific type string.
Definition StringTopic.hpp:469
SubscriberType SubscribeEx(std::string_view typeString, ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new subscriber to the topic, with specific type string.
Definition StringTopic.hpp:366
std::string ValueType
Definition StringTopic.hpp:303
StringEntry EntryType
Definition StringTopic.hpp:302
std::string_view ParamType
Definition StringTopic.hpp:304
StringPublisher PublisherType
Definition StringTopic.hpp:301
static constexpr std::string_view kTypeString
The default type string for this topic type.
Definition StringTopic.hpp:307
PublisherType PublishEx(std::string_view typeString, const wpi::util::json &properties, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new publisher to the topic, with type string and initial properties.
Definition StringTopic.hpp:414
TimestampedString TimestampedValueType
Definition StringTopic.hpp:305
EntryType GetEntry(ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new entry for the topic.
Definition StringTopic.hpp:441
StringTopic(NT_Topic handle)
Construct from a topic handle; recommended to use NetworkTableInstance::GetStringTopic() instead.
Definition StringTopic.hpp:317
StringTopic(Topic topic)
Construct from a generic topic.
Definition StringTopic.hpp:324
Subscriber(const Subscriber &)=delete
NT_Subscriber m_subHandle
Definition Topic.hpp:385
NT_Topic m_handle
Definition Topic.hpp:316
Definition BooleanTopic.hpp:24
bool SetDefaultString(NT_Handle pubentry, std::string_view defaultValue)
Publish a default value.
std::string GetString(NT_Handle subentry, std::string_view defaultValue)
Get the last published value.
TimestampedString GetAtomicString(NT_Handle subentry, std::string_view defaultValue)
Get the last published value along with its timestamp.
bool SetString(NT_Handle pubentry, std::string_view value, int64_t time=0)
Publish a new value.
NT_Handle NT_Topic
Definition ntcore_c.h:42
NT_Handle NT_Subscriber
Definition ntcore_c.h:43
NT_Handle NT_Publisher
Definition ntcore_c.h:44
NT_Handle NT_Entry
Definition ntcore_c.h:37
@ NT_STRING
Definition ntcore_c.h:54
Timestamped< std::string_view > TimestampedStringView
Timestamped String view (for wpi::util::SmallVector-taking functions).
Definition ntcore_cpp_types.hpp:377
Timestamped< std::string > TimestampedString
Timestamped String.
Definition ntcore_cpp_types.hpp:371
constexpr PubSubOptions kDefaultPubSubOptions
Default publish/subscribe options.
Definition ntcore_cpp.hpp:388
NT_Entry GetEntry(NT_Inst inst, std::string_view name)
Get Entry Handle.
NT_Topic GetTopicFromHandle(NT_Handle pubsubentry)
Gets the topic handle from an entry/subscriber/publisher handle.
NT_Publisher Publish(NT_Topic topic, NT_Type type, std::string_view typeStr, const PubSubOptions &options=kDefaultPubSubOptions)
Creates a new publisher to a topic.
void Unpublish(NT_Handle pubentry)
Stops publisher.
NT_Publisher PublishEx(NT_Topic topic, NT_Type type, std::string_view typeStr, const wpi::util::json &properties, const PubSubOptions &options=kDefaultPubSubOptions)
Creates a new publisher to a topic.
NT_Subscriber Subscribe(NT_Topic topic, NT_Type type, std::string_view typeStr, const PubSubOptions &options=kDefaultPubSubOptions)
Creates a new subscriber to value changes on a topic.
NetworkTables (ntcore) namespace.
Definition NTSendable.hpp:9
Definition raw_os_ostream.hpp:19
NetworkTables publish/subscribe options.
Definition ntcore_cpp.hpp:303