37 explicit operator bool()
const {
return m_handle != 0; }
76 return ::wpi::nt::GetTopicTypeString(
m_handle);
177 return ::wpi::nt::SetTopicProperties(
m_handle, properties);
216 std::string_view typeString,
237 std::string_view typeString,
260 std::string_view typeString,
const wpi::util::json& properties,
306 std::string_view typeString,
@ name
Definition base.h:690
NetworkTables generic entry.
Definition GenericEntry.hpp:511
NetworkTables generic publisher.
Definition GenericEntry.hpp:219
NetworkTables generic subscriber.
Definition GenericEntry.hpp:24
NetworkTables Instance.
Definition NetworkTableInstance.hpp:67
NT_Publisher GetHandle() const
Gets the native handle for the publisher.
Definition Topic.hpp:424
Publisher(const Publisher &)=delete
virtual ~Publisher()
Definition Topic.hpp:394
Publisher & operator=(Publisher &&rhs)
Definition Topic.hpp:403
Topic GetTopic() const
Gets the published-to topic.
Definition Topic.hpp:431
Publisher(NT_Publisher handle)
Definition Topic.hpp:437
Publisher(Publisher &&rhs)
Definition Topic.hpp:399
Publisher & operator=(const Publisher &)=delete
NT_Publisher m_pubHandle
NetworkTables handle.
Definition Topic.hpp:440
Subscriber(const Subscriber &)=delete
NT_Subscriber GetHandle() const
Gets the native handle for the subscriber.
Definition Topic.hpp:352
Subscriber(NT_Subscriber handle)
Definition Topic.hpp:383
Subscriber(Subscriber &&rhs)
Definition Topic.hpp:327
bool Exists() const
Determines if the topic is currently being published.
Definition Topic.hpp:359
virtual ~Subscriber()
Definition Topic.hpp:322
NT_Subscriber m_subHandle
Definition Topic.hpp:385
int64_t GetLastChange() const
Gets the last time the value was changed.
Definition Topic.hpp:368
Subscriber & operator=(Subscriber &&rhs)
Definition Topic.hpp:331
Topic GetTopic() const
Gets the subscribed-to topic.
Definition Topic.hpp:377
Subscriber & operator=(const Subscriber &)=delete
NetworkTables Topic.
Definition Topic.hpp:27
GenericPublisher GenericPublish(std::string_view typeString, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new publisher to the topic.
std::string GetTypeString() const
Gets the type string of the topic.
Definition Topic.hpp:75
wpi::util::json GetProperty(std::string_view name) const
Gets the current value of a property (as a JSON object).
void SetRetained(bool retained)
Make the server retain the topic even when there are no publishers.
Definition Topic.hpp:100
NT_Topic m_handle
Definition Topic.hpp:316
bool Exists() const
Determines if the topic is currently being published.
Definition Topic.hpp:132
GenericSubscriber GenericSubscribe(std::string_view typeString, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new subscriber to the topic.
bool operator==(const Topic &) const =default
Equality operator.
bool IsCached() const
Returns whether the topic's last value is stored.
Definition Topic.hpp:125
bool IsRetained() const
Returns whether the topic is retained by server when there are no publishers.
Definition Topic.hpp:110
NetworkTableInstance GetInstance() const
Gets the instance for the topic.
GenericEntry GetGenericEntry(std::string_view typeString, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new generic entry for the topic.
TopicInfo GetInfo() const
Gets combined information about the topic.
Definition Topic.hpp:185
void SetProperty(std::string_view name, const wpi::util::json &value)
Sets a property value.
Topic(NT_Topic handle)
Definition Topic.hpp:30
GenericPublisher GenericPublishEx(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.
void SetCached(bool cached)
Allow storage of the topic's last value, allowing the value to be read (and not just accessed through...
Definition Topic.hpp:118
std::string GetName() const
Gets the name of the topic.
Definition Topic.hpp:58
GenericEntry GetGenericEntry(const PubSubOptions &options=kDefaultPubSubOptions)
Create a new generic entry for the topic.
void DeleteProperty(std::string_view name)
Deletes a property.
Definition Topic.hpp:155
void SetPersistent(bool persistent)
Make value persistent through server restarts.
Definition Topic.hpp:84
GenericSubscriber GenericSubscribe(const PubSubOptions &options=kDefaultPubSubOptions)
Create a new subscriber to the topic.
bool SetProperties(const wpi::util::json &properties)
Updates multiple topic properties.
Definition Topic.hpp:176
wpi::util::json GetProperties() const
Gets all topic properties as a JSON object.
bool IsPersistent() const
Returns whether the value is persistent through server restarts.
Definition Topic.hpp:93
NT_Topic GetHandle() const
Gets the native handle for the topic.
Definition Topic.hpp:44
NetworkTableType GetType() const
Gets the type of the topic.
Definition Topic.hpp:65
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
NetworkTableType
NetworkTable entry type.
Definition NetworkTableType.hpp:15
constexpr PubSubOptions kDefaultPubSubOptions
Default publish/subscribe options.
Definition ntcore_cpp.hpp:388
bool GetTopicExists(NT_Handle handle)
Determine if topic exists (e.g.
NT_Topic GetTopicFromHandle(NT_Handle pubsubentry)
Gets the topic handle from an entry/subscriber/publisher handle.
void SetTopicCached(NT_Topic topic, bool value)
Sets the cached property of a topic.
void SetTopicRetained(NT_Topic topic, bool value)
Sets the retained property of a topic.
void SetTopicPersistent(NT_Topic topic, bool value)
Sets the persistent property of a topic.
void DeleteTopicProperty(NT_Topic topic, std::string_view name)
Deletes a property.
NT_Type GetTopicType(NT_Topic topic)
Gets the type for the specified topic, or unassigned if non existent.
void Release(NT_Handle pubsubentry)
Stops entry/subscriber/publisher.
NetworkTables (ntcore) namespace.
Definition NTSendable.hpp:9
NetworkTables publish/subscribe options.
Definition ntcore_cpp.hpp:303
NetworkTables Topic Information.
Definition ntcore_cpp.hpp:88