23class GenericPublisher;
24class GenericSubscriber;
25class NetworkTableInstance;
38 explicit operator bool()
const {
return m_handle != 0; }
NetworkTables generic entry.
Definition: GenericEntry.h:435
NetworkTables generic publisher.
Definition: GenericEntry.h:193
NetworkTables generic subscriber.
Definition: GenericEntry.h:24
NetworkTables Instance.
Definition: NetworkTableInstance.h:70
NetworkTables publisher.
Definition: Topic.h:364
Publisher(const Publisher &)=delete
Publisher(NT_Publisher handle)
Definition: Topic.h:397
Topic GetTopic() const
Gets the published-to topic.
Definition: Topic.inc:114
Publisher & operator=(const Publisher &)=delete
virtual ~Publisher()
Definition: Topic.inc:97
NT_Publisher m_pubHandle
NetworkTables handle.
Definition: Topic.h:400
NT_Publisher GetHandle() const
Gets the native handle for the publisher.
Definition: Topic.h:386
NetworkTables subscriber.
Definition: Topic.h:309
bool Exists() const
Determines if the topic is currently being published.
Definition: Topic.inc:85
int64_t GetLastChange() const
Gets the last time the value was changed.
Definition: Topic.inc:89
NT_Subscriber GetHandle() const
Gets the native handle for the subscriber.
Definition: Topic.h:331
virtual ~Subscriber()
Definition: Topic.inc:68
Subscriber & operator=(const Subscriber &)=delete
NT_Subscriber m_subHandle
Definition: Topic.h:360
Subscriber(NT_Subscriber handle)
Definition: Topic.h:358
Topic GetTopic() const
Gets the subscribed-to topic.
Definition: Topic.inc:93
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.inc:32
bool Exists() const
Determines if the topic is currently being published.
Definition: Topic.inc:52
Topic(NT_Topic handle)
Definition: Topic.h:31
bool SetProperties(const wpi::json &properties)
Updates multiple topic properties.
Definition: Topic.inc:60
void DeleteProperty(std::string_view name)
Deletes a property.
Definition: Topic.inc:56
void SetRetained(bool retained)
Make the server retain the topic even when there are no publishers.
Definition: Topic.inc:36
std::string GetTypeString() const
Gets the type string of the topic.
Definition: Topic.inc:24
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.inc:20
std::string GetName() const
Gets the name of the topic.
Definition: Topic.inc:16
bool IsRetained() const
Returns whether the topic is retained by server when there are no publishers.
Definition: Topic.inc:40
NT_Topic m_handle
Definition: Topic.h:305
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.inc:44
bool IsCached() const
Returns whether the topic's last value is stored.
Definition: Topic.inc:48
void SetPersistent(bool persistent)
Make value persistent through server restarts.
Definition: Topic.inc:28
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.inc:64
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.
basic_string_view< char > string_view
Definition: core.h:501
NT_Handle NT_Topic
Definition: ntcore_c.h:40
NT_Handle NT_Subscriber
Definition: ntcore_c.h:41
NT_Handle NT_Publisher
Definition: ntcore_c.h:42
NetworkTableType
NetworkTable entry type.
Definition: NetworkTableType.h:15
constexpr PubSubOptions kDefaultPubSubOptions
Default publish/subscribe options.
Definition: ntcore_cpp.h:390
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