53 m_defaultValue{defaultValue} {}
62 return Get(m_defaultValue);
73 return ::wpi::nt::GetBoolean(
m_subHandle, defaultValue);
96 return ::wpi::nt::GetAtomicBoolean(
m_subHandle, defaultValue);
304 std::string_view typeString,
ParamType defaultValue,
NetworkTables Boolean entry.
Definition BooleanTopic.hpp:180
void Unpublish()
Stops publishing the entry if it's published.
Definition BooleanTopic.hpp:227
NT_Entry GetHandle() const
Gets the native handle for the entry.
Definition BooleanTopic.hpp:215
TopicType GetTopic() const
Get the corresponding topic.
Definition BooleanTopic.hpp:423
bool ValueType
Definition BooleanTopic.hpp:185
bool ParamType
Definition BooleanTopic.hpp:186
BooleanSubscriber SubscriberType
Definition BooleanTopic.hpp:182
TimestampedBoolean TimestampedValueType
Definition BooleanTopic.hpp:188
BooleanPublisher PublisherType
Definition BooleanTopic.hpp:183
BooleanEntry(NT_Entry handle, ParamType defaultValue)
Construct from an entry handle; recommended to use BooleanTopic::GetEntry() instead.
Definition BooleanTopic.hpp:199
BooleanTopic TopicType
Definition BooleanTopic.hpp:184
NetworkTables Boolean publisher.
Definition BooleanTopic.hpp:127
BooleanTopic TopicType
Definition BooleanTopic.hpp:129
bool ParamType
Definition BooleanTopic.hpp:131
TimestampedBoolean TimestampedValueType
Definition BooleanTopic.hpp:133
void SetDefault(ParamType value)
Publish a default value.
Definition BooleanTopic.hpp:162
void Set(ParamType value, int64_t time=0)
Publish a new value.
Definition BooleanTopic.hpp:151
bool ValueType
Definition BooleanTopic.hpp:130
BooleanPublisher()=default
BooleanPublisher(NT_Publisher handle)
Construct from a publisher handle; recommended to use BooleanTopic::Publish() instead.
Definition BooleanTopic.hpp:143
TopicType GetTopic() const
Get the corresponding topic.
Definition BooleanTopic.hpp:419
NetworkTables Boolean subscriber.
Definition BooleanTopic.hpp:34
ValueType Get(ParamType defaultValue) const
Get the last published value.
Definition BooleanTopic.hpp:72
TimestampedBoolean TimestampedValueType
Definition BooleanTopic.hpp:39
std::vector< TimestampedValueType > ReadQueue()
Get an array of all value changes since the last call to ReadQueue.
Definition BooleanTopic.hpp:109
ValueType Get() const
Get the last published value.
Definition BooleanTopic.hpp:61
BooleanSubscriber(NT_Subscriber handle, ParamType defaultValue)
Construct from a subscriber handle; recommended to use BooleanTopic::Subscribe() instead.
Definition BooleanTopic.hpp:51
TopicType GetTopic() const
Get the corresponding topic.
Definition BooleanTopic.hpp:415
TimestampedValueType GetAtomic(ParamType defaultValue) const
Get the last published value along with its timestamp.
Definition BooleanTopic.hpp:95
TimestampedValueType GetAtomic() const
Get the last published value along with its timestamp If no value has been published,...
Definition BooleanTopic.hpp:83
bool ParamType
Definition BooleanTopic.hpp:38
bool ValueType
Definition BooleanTopic.hpp:37
BooleanSubscriber()=default
BooleanTopic TopicType
Definition BooleanTopic.hpp:36
NetworkTables Boolean topic.
Definition BooleanTopic.hpp:235
SubscriberType Subscribe(ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new subscriber to the topic.
Definition BooleanTopic.hpp:279
BooleanSubscriber SubscriberType
Definition BooleanTopic.hpp:237
static constexpr std::string_view kTypeString
The default type string for this topic type.
Definition BooleanTopic.hpp:244
BooleanTopic(Topic topic)
Construct from a generic topic.
Definition BooleanTopic.hpp:261
PublisherType PublishEx(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.
Definition BooleanTopic.hpp:351
PublisherType Publish(const PubSubOptions &options=kDefaultPubSubOptions)
Create a new publisher to the topic.
Definition BooleanTopic.hpp:327
SubscriberType SubscribeEx(std::string_view typeString, ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new subscriber to the topic, with specific type string.
Definition BooleanTopic.hpp:303
EntryType GetEntry(ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new entry for the topic.
Definition BooleanTopic.hpp:378
TimestampedBoolean TimestampedValueType
Definition BooleanTopic.hpp:242
BooleanEntry EntryType
Definition BooleanTopic.hpp:239
bool ValueType
Definition BooleanTopic.hpp:240
BooleanTopic(NT_Topic handle)
Construct from a topic handle; recommended to use NetworkTableInstance::GetBooleanTopic() instead.
Definition BooleanTopic.hpp:254
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new entry for the topic, with specific type string.
Definition BooleanTopic.hpp:406
bool ParamType
Definition BooleanTopic.hpp:241
BooleanPublisher PublisherType
Definition BooleanTopic.hpp:238
Publisher(const Publisher &)=delete
NT_Publisher m_pubHandle
NetworkTables handle.
Definition Topic.hpp:440
Subscriber(const Subscriber &)=delete
NT_Subscriber m_subHandle
Definition Topic.hpp:385
NT_Topic m_handle
Definition Topic.hpp:316
Definition BooleanTopic.hpp:24
bool SetDefaultBoolean(NT_Handle pubentry, bool defaultValue)
Publish a default value.
bool SetBoolean(NT_Handle pubentry, bool 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_BOOLEAN
Definition ntcore_c.h:52
Timestamped< bool > TimestampedBoolean
Timestamped Boolean.
Definition ntcore_cpp_types.hpp:55
constexpr PubSubOptions kDefaultPubSubOptions
Default publish/subscribe options.
Definition ntcore_cpp.hpp:388
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_Publisher Publish(NT_Topic topic, NT_Type type, std::string_view typeStr, const PubSubOptions &options=kDefaultPubSubOptions)
Creates a new publisher to 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=kDefaultPubSubOptions)
Creates a new publisher to a topic.
NT_Subscriber Subscribe(NT_Topic topic, NT_Type type, std::string_view typeStr, const PubSubOptions &options=kDefaultPubSubOptions)
Creates a new subscriber to value changes on a topic.
NetworkTables (ntcore) namespace.
Definition NTSendable.hpp:9
Definition raw_os_ostream.hpp:19
NetworkTables publish/subscribe options.
Definition ntcore_cpp.hpp:303