40 explicit operator bool()
const {
return m_handle != 0; }
79 return ::wpi::nt::GetTopicTypeString(
m_handle);
180 return ::wpi::nt::SetTopicProperties(
m_handle, properties);
219 std::string_view typeString,
240 std::string_view typeString,
309 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:427
Publisher(const Publisher &)=delete
virtual ~Publisher()
Definition Topic.hpp:397
Publisher & operator=(Publisher &&rhs)
Definition Topic.hpp:406
Topic GetTopic() const
Gets the published-to topic.
Definition Topic.hpp:434
Publisher(NT_Publisher handle)
Definition Topic.hpp:440
Publisher(Publisher &&rhs)
Definition Topic.hpp:402
Publisher & operator=(const Publisher &)=delete
NT_Publisher m_pubHandle
NetworkTables handle.
Definition Topic.hpp:443
Subscriber(const Subscriber &)=delete
NT_Subscriber GetHandle() const
Gets the native handle for the subscriber.
Definition Topic.hpp:355
Subscriber(NT_Subscriber handle)
Definition Topic.hpp:386
Subscriber(Subscriber &&rhs)
Definition Topic.hpp:330
bool Exists() const
Determines if the topic is currently being published.
Definition Topic.hpp:362
virtual ~Subscriber()
Definition Topic.hpp:325
NT_Subscriber m_subHandle
Definition Topic.hpp:388
int64_t GetLastChange() const
Gets the last time the value was changed.
Definition Topic.hpp:371
Subscriber & operator=(Subscriber &&rhs)
Definition Topic.hpp:334
Topic GetTopic() const
Gets the subscribed-to topic.
Definition Topic.hpp:380
Subscriber & operator=(const Subscriber &)=delete
NetworkTables Topic.
Definition Topic.hpp:30
std::string GetTypeString() const
Gets the type string of the topic.
Definition Topic.hpp:78
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:103
NT_Topic m_handle
Definition Topic.hpp:319
GenericPublisher GenericPublishEx(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.
bool Exists() const
Determines if the topic is currently being published.
Definition Topic.hpp:135
GenericPublisher GenericPublish(std::string_view typeString, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new publisher 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:128
bool IsRetained() const
Returns whether the topic is retained by server when there are no publishers.
Definition Topic.hpp:113
GenericSubscriber GenericSubscribe(std::string_view typeString, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new subscriber to the topic.
GenericEntry GetGenericEntry(const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new generic entry for the topic.
GenericEntry GetGenericEntry(std::string_view typeString, const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new generic entry for the topic.
NetworkTableInstance GetInstance() const
Gets the instance for the topic.
TopicInfo GetInfo() const
Gets combined information about the topic.
Definition Topic.hpp:188
void SetProperty(std::string_view name, const wpi::util::json &value)
Sets a property value.
Topic(NT_Topic handle)
Definition Topic.hpp:33
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:121
std::string GetName() const
Gets the name of the topic.
Definition Topic.hpp:61
GenericSubscriber GenericSubscribe(const PubSubOptions &options=DEFAULT_PUB_SUB_OPTIONS)
Create a new subscriber to the topic.
void DeleteProperty(std::string_view name)
Deletes a property.
Definition Topic.hpp:158
void SetPersistent(bool persistent)
Make value persistent through server restarts.
Definition Topic.hpp:87
bool SetProperties(const wpi::util::json &properties)
Updates multiple topic properties.
Definition Topic.hpp:179
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:96
NT_Topic GetHandle() const
Gets the native handle for the topic.
Definition Topic.hpp:47
NetworkTableType GetType() const
Gets the type of the topic.
Definition Topic.hpp:68
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 DEFAULT_PUB_SUB_OPTIONS
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
Definition raw_os_ostream.hpp:19
NetworkTables publish/subscribe options.
Definition ntcore_cpp.hpp:303
NetworkTables Topic Information.
Definition ntcore_cpp.hpp:88