58 m_defaultValue{defaultValue} {}
67 return Get(m_defaultValue);
78 return ::wpi::nt::GetString(
m_subHandle, defaultValue);
89 return Get(buf, m_defaultValue);
124 return ::wpi::nt::GetAtomicString(
m_subHandle, defaultValue);
366 std::string_view typeString,
ParamType defaultValue,
Publisher(const Publisher &)=delete
NT_Publisher m_pubHandle
NetworkTables handle.
Definition Topic.hpp:443
NetworkTables String entry.
Definition StringTopic.hpp:239
std::string_view ParamType
Definition StringTopic.hpp:245
StringPublisher PublisherType
Definition StringTopic.hpp:242
StringEntry(NT_Entry handle, ParamType defaultValue)
Construct from an entry handle; recommended to use StringTopic::GetEntry() instead.
Definition StringTopic.hpp:261
void Unpublish()
Stops publishing the entry if it's published.
Definition StringTopic.hpp:289
std::string ValueType
Definition StringTopic.hpp:244
NT_Entry GetHandle() const
Gets the native handle for the entry.
Definition StringTopic.hpp:277
StringSubscriber SubscriberType
Definition StringTopic.hpp:241
StringTopic TopicType
Definition StringTopic.hpp:243
char SmallElemType
Definition StringTopic.hpp:248
TopicType GetTopic() const
Get the corresponding topic.
Definition StringTopic.hpp:485
TimestampedString TimestampedValueType
Definition StringTopic.hpp:250
std::string_view SmallRetType
Definition StringTopic.hpp:247
NetworkTables String publisher.
Definition StringTopic.hpp:183
std::string_view SmallRetType
Definition StringTopic.hpp:189
StringTopic TopicType
Definition StringTopic.hpp:185
char SmallElemType
Definition StringTopic.hpp:190
void SetDefault(ParamType value)
Publish a default value.
Definition StringTopic.hpp:221
StringPublisher(NT_Publisher handle)
Construct from a publisher handle; recommended to use StringTopic::Publish() instead.
Definition StringTopic.hpp:202
StringPublisher()=default
TopicType GetTopic() const
Get the corresponding topic.
Definition StringTopic.hpp:481
std::string_view ParamType
Definition StringTopic.hpp:187
TimestampedString TimestampedValueType
Definition StringTopic.hpp:192
std::string ValueType
Definition StringTopic.hpp:186
void Set(ParamType value, int64_t time=0)
Publish a new value.
Definition StringTopic.hpp:210
NetworkTables String subscriber.
Definition StringTopic.hpp:35
ValueType Get(ParamType defaultValue) const
Get the last published value.
Definition StringTopic.hpp:77
StringSubscriber()=default
SmallRetType Get(wpi::util::SmallVectorImpl< SmallElemType > &buf) const
Get the last published value.
Definition StringTopic.hpp:88
StringSubscriber(NT_Subscriber handle, ParamType defaultValue)
Construct from a subscriber handle; recommended to use StringTopic::Subscribe() instead.
Definition StringTopic.hpp:56
TimestampedValueViewType GetAtomic(wpi::util::SmallVectorImpl< SmallElemType > &buf, ParamType defaultValue) const
Get the last published value along with its timestamp.
Definition StringTopic.hpp:149
SmallRetType Get(wpi::util::SmallVectorImpl< SmallElemType > &buf, ParamType defaultValue) const
Get the last published value.
Definition StringTopic.hpp:100
TimestampedStringView TimestampedValueViewType
Definition StringTopic.hpp:44
std::string_view SmallRetType
Definition StringTopic.hpp:42
TimestampedValueViewType GetAtomic(wpi::util::SmallVectorImpl< SmallElemType > &buf) const
Get the last published value along with its timestamp.
Definition StringTopic.hpp:135
char SmallElemType
Definition StringTopic.hpp:43
std::string_view ParamType
Definition StringTopic.hpp:39
TimestampedValueType GetAtomic() const
Get the last published value along with its timestamp If no value has been published,...
Definition StringTopic.hpp:111
TopicType GetTopic() const
Get the corresponding topic.
Definition StringTopic.hpp:477
ValueType Get() const
Get the last published value.
Definition StringTopic.hpp:66
std::string ValueType
Definition StringTopic.hpp:38
TimestampedValueType GetAtomic(ParamType defaultValue) const
Get the last published value along with its timestamp.
Definition StringTopic.hpp:123
StringTopic TopicType
Definition StringTopic.hpp:37
TimestampedString TimestampedValueType
Definition StringTopic.hpp:40
std::vector< TimestampedValueType > ReadQueue()
Get an array of all value changes since the last call to ReadQueue.
Definition StringTopic.hpp:165
NetworkTables String topic.
Definition StringTopic.hpp:297
SubscriberType SubscribeEx(std::string_view typeString, ParamType defaultValue, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new subscriber to the topic, with specific type string.
Definition StringTopic.hpp:365
StringSubscriber SubscriberType
Definition StringTopic.hpp:299
PublisherType PublishEx(std::string_view typeString, const wpi::util::json &properties, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new publisher to the topic, with type string and initial properties.
Definition StringTopic.hpp:413
static constexpr std::string_view TYPE_STRING
The default type string for this topic type.
Definition StringTopic.hpp:306
PublisherType Publish(const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new publisher to the topic.
Definition StringTopic.hpp:389
std::string ValueType
Definition StringTopic.hpp:302
StringEntry EntryType
Definition StringTopic.hpp:301
std::string_view ParamType
Definition StringTopic.hpp:303
StringPublisher PublisherType
Definition StringTopic.hpp:300
EntryType GetEntry(ParamType defaultValue, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new entry for the topic.
Definition StringTopic.hpp:440
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new entry for the topic, with specific type string.
Definition StringTopic.hpp:468
TimestampedString TimestampedValueType
Definition StringTopic.hpp:304
SubscriberType Subscribe(ParamType defaultValue, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new subscriber to the topic.
Definition StringTopic.hpp:341
StringTopic(NT_Topic handle)
Construct from a topic handle; recommended to use NetworkTableInstance::GetStringTopic() instead.
Definition StringTopic.hpp:316
StringTopic(Topic topic)
Construct from a generic topic.
Definition StringTopic.hpp:323
Subscriber(const Subscriber &)=delete
NT_Subscriber m_subHandle
Definition Topic.hpp:388
NT_Topic m_handle
Definition Topic.hpp:319
Definition BooleanTopic.hpp:22
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
constexpr PubSubOptions DEFAULT_PUB_SUB_OPTIONS
Default publish/subscribe options.
Definition ntcore_cpp.hpp:388
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
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_Subscriber Subscribe(NT_Topic topic, NT_Type type, std::string_view typeStr, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Creates a new subscriber to value changes on 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=DEFAULT_PUB_SUB_OPTIONS)
Creates a new publisher to a topic.
NT_Publisher Publish(NT_Topic topic, NT_Type type, std::string_view typeStr, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Creates a new publisher to a topic.
NetworkTables (ntcore) namespace.
Definition NTSendable.hpp:9
Definition raw_os_ostream.hpp:19
NetworkTables publish/subscribe options.
Definition ntcore_cpp.hpp:303