23class GenericPublisher;
24class GenericSubscriber;
25class NetworkTableInstance;
38 explicit operator bool()
const {
return m_handle != 0; }
77 return ::nt::GetTopicTypeString(
m_handle);
178 return ::nt::SetTopicProperties(
m_handle, properties);
217 std::string_view typeString,
238 std::string_view typeString,
261 std::string_view typeString,
const wpi::json& properties,
307 std::string_view typeString,
NetworkTables generic entry.
Definition GenericEntry.h:511
NetworkTables generic publisher.
Definition GenericEntry.h:219
NetworkTables generic subscriber.
Definition GenericEntry.h:24
NetworkTables Instance.
Definition NetworkTableInstance.h:68
NetworkTables publisher.
Definition Topic.h:393
Publisher(const Publisher &)=delete
Publisher(NT_Publisher handle)
Definition Topic.h:438
Topic GetTopic() const
Gets the published-to topic.
Definition Topic.h:432
Publisher(Publisher &&rhs)
Definition Topic.h:400
Publisher & operator=(const Publisher &)=delete
NT_Publisher m_pubHandle
NetworkTables handle.
Definition Topic.h:441
NT_Publisher GetHandle() const
Gets the native handle for the publisher.
Definition Topic.h:425
virtual ~Publisher()
Definition Topic.h:395
Publisher & operator=(Publisher &&rhs)
Definition Topic.h:404
NetworkTables subscriber.
Definition Topic.h:321
bool Exists() const
Determines if the topic is currently being published.
Definition Topic.h:360
int64_t GetLastChange() const
Gets the last time the value was changed.
Definition Topic.h:369
NT_Subscriber GetHandle() const
Gets the native handle for the subscriber.
Definition Topic.h:353
virtual ~Subscriber()
Definition Topic.h:323
Subscriber & operator=(Subscriber &&rhs)
Definition Topic.h:332
Subscriber & operator=(const Subscriber &)=delete
NT_Subscriber m_subHandle
Definition Topic.h:386
Subscriber(NT_Subscriber handle)
Definition Topic.h:384
Subscriber(Subscriber &&rhs)
Definition Topic.h:328
Topic GetTopic() const
Gets the subscribed-to topic.
Definition Topic.h:378
Subscriber(const Subscriber &)=delete
NetworkTables Topic.
Definition Topic.h:28
GenericPublisher GenericPublishEx(std::string_view typeString, const wpi::json &properties, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new publisher to the topic, with type string and initial properties.
bool IsPersistent() const
Returns whether the value is persistent through server restarts.
Definition Topic.h:94
bool Exists() const
Determines if the topic is currently being published.
Definition Topic.h:133
Topic(NT_Topic handle)
Definition Topic.h:31
bool SetProperties(const wpi::json &properties)
Updates multiple topic properties.
Definition Topic.h:177
void DeleteProperty(std::string_view name)
Deletes a property.
Definition Topic.h:156
void SetRetained(bool retained)
Make the server retain the topic even when there are no publishers.
Definition Topic.h:101
std::string GetTypeString() const
Gets the type string of the topic.
Definition Topic.h:76
GenericEntry GetGenericEntry(std::string_view typeString, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new generic entry for the topic.
GenericEntry GetGenericEntry(const PubSubOptions &options=kDefaultPubSubOptions)
Create a new generic entry for the topic.
NT_Topic GetHandle() const
Gets the native handle for the topic.
Definition Topic.h:45
NetworkTableType GetType() const
Gets the type of the topic.
Definition Topic.h:66
std::string GetName() const
Gets the name of the topic.
Definition Topic.h:59
bool IsRetained() const
Returns whether the topic is retained by server when there are no publishers.
Definition Topic.h:111
NT_Topic m_handle
Definition Topic.h:317
bool operator==(const Topic &) const =default
Equality operator.
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.h:119
bool IsCached() const
Returns whether the topic's last value is stored.
Definition Topic.h:126
void SetPersistent(bool persistent)
Make value persistent through server restarts.
Definition Topic.h:85
wpi::json GetProperties() const
Gets all topic properties as a JSON object.
GenericPublisher GenericPublish(std::string_view typeString, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new publisher to the topic.
wpi::json GetProperty(std::string_view name) const
Gets the current value of a property (as a JSON object).
NetworkTableInstance GetInstance() const
Gets the instance for the topic.
TopicInfo GetInfo() const
Gets combined information about the topic.
Definition Topic.h:186
void SetProperty(std::string_view name, const wpi::json &value)
Sets a property value.
GenericSubscriber GenericSubscribe(std::string_view typeString, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new subscriber to the topic.
GenericSubscriber GenericSubscribe(const PubSubOptions &options=kDefaultPubSubOptions)
Create a new subscriber to the topic.
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.h:15
constexpr PubSubOptions kDefaultPubSubOptions
Default publish/subscribe options.
Definition ntcore_cpp.h:390
NT_Topic GetTopicFromHandle(NT_Handle pubsubentry)
Gets the topic handle from an entry/subscriber/publisher handle.
void Release(NT_Handle pubsubentry)
Stops entry/subscriber/publisher.
bool GetTopicExists(NT_Handle handle)
Determine if topic exists (e.g.
NT_Type GetTopicType(NT_Topic topic)
Gets the type for the specified topic, or unassigned if non existent.
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.
NetworkTables (ntcore) namespace.
Definition ntcore_cpp.h:36
NetworkTables publish/subscribe options.
Definition ntcore_cpp.h:305
NetworkTables Topic Information.
Definition ntcore_cpp.h:90