57 m_defaultValue{defaultValue.begin(), defaultValue.end()} {}
66 return Get(m_defaultValue);
88 return Get(buf, m_defaultValue);
123 return ::nt::GetAtomicRaw(
m_subHandle, defaultValue);
341 std::string_view typeString,
ParamType defaultValue,
NetworkTables publisher.
Definition Topic.h:393
NT_Publisher m_pubHandle
NetworkTables handle.
Definition Topic.h:441
NetworkTables Raw entry.
Definition RawTopic.h:238
std::vector< uint8_t > ValueType
Definition RawTopic.h:243
RawEntry(NT_Entry handle, ParamType defaultValue)
Construct from an entry handle; recommended to use RawTopic::GetEntry() instead.
Definition RawTopic.h:260
TopicType GetTopic() const
Get the corresponding topic.
Definition RawTopic.h:434
std::span< uint8_t > SmallRetType
Definition RawTopic.h:246
void Unpublish()
Stops publishing the entry if it's published.
Definition RawTopic.h:288
NT_Entry GetHandle() const
Gets the native handle for the entry.
Definition RawTopic.h:276
uint8_t SmallElemType
Definition RawTopic.h:247
RawTopic TopicType
Definition RawTopic.h:242
std::span< const uint8_t > ParamType
Definition RawTopic.h:244
NetworkTables Raw publisher.
Definition RawTopic.h:182
void Set(ParamType value, int64_t time=0)
Publish a new value.
Definition RawTopic.h:209
std::vector< uint8_t > ValueType
Definition RawTopic.h:185
TopicType GetTopic() const
Get the corresponding topic.
Definition RawTopic.h:430
std::span< const uint8_t > ParamType
Definition RawTopic.h:186
uint8_t SmallElemType
Definition RawTopic.h:189
void SetDefault(ParamType value)
Publish a default value.
Definition RawTopic.h:220
std::span< uint8_t > SmallRetType
Definition RawTopic.h:188
RawPublisher(NT_Publisher handle)
Construct from a publisher handle; recommended to use RawTopic::Publish() instead.
Definition RawTopic.h:201
RawTopic TopicType
Definition RawTopic.h:184
NetworkTables Raw subscriber.
Definition RawTopic.h:34
std::vector< uint8_t > ValueType
Definition RawTopic.h:37
TimestampedValueViewType GetAtomic(wpi::SmallVectorImpl< SmallElemType > &buf, ParamType defaultValue) const
Get the last published value along with its timestamp.
Definition RawTopic.h:148
TimestampedValueViewType GetAtomic(wpi::SmallVectorImpl< SmallElemType > &buf) const
Get the last published value along with its timestamp.
Definition RawTopic.h:134
SmallRetType Get(wpi::SmallVectorImpl< SmallElemType > &buf, ParamType defaultValue) const
Get the last published value.
Definition RawTopic.h:99
TimestampedValueType GetAtomic() const
Get the last published value along with its timestamp If no value has been published,...
Definition RawTopic.h:110
ValueType Get() const
Get the last published value.
Definition RawTopic.h:65
std::span< uint8_t > SmallRetType
Definition RawTopic.h:41
RawSubscriber(NT_Subscriber handle, ParamType defaultValue)
Construct from a subscriber handle; recommended to use RawTopic::Subscribe() instead.
Definition RawTopic.h:55
std::vector< TimestampedValueType > ReadQueue()
Get an array of all value changes since the last call to ReadQueue.
Definition RawTopic.h:164
TopicType GetTopic() const
Get the corresponding topic.
Definition RawTopic.h:426
std::span< const uint8_t > ParamType
Definition RawTopic.h:38
ValueType Get(ParamType defaultValue) const
Get the last published value.
Definition RawTopic.h:76
SmallRetType Get(wpi::SmallVectorImpl< SmallElemType > &buf) const
Get the last published value.
Definition RawTopic.h:87
TimestampedValueType GetAtomic(ParamType defaultValue) const
Get the last published value along with its timestamp.
Definition RawTopic.h:122
uint8_t SmallElemType
Definition RawTopic.h:42
RawTopic TopicType
Definition RawTopic.h:36
NetworkTables Raw topic.
Definition RawTopic.h:296
std::vector< uint8_t > ValueType
Definition RawTopic.h:301
SubscriberType Subscribe(std::string_view typeString, ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new subscriber to the topic.
Definition RawTopic.h:340
PublisherType Publish(std::string_view typeString, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new publisher to the topic.
Definition RawTopic.h:365
EntryType GetEntry(std::string_view typeString, ParamType defaultValue, const PubSubOptions &options=kDefaultPubSubOptions)
Create a new entry for the topic.
Definition RawTopic.h:418
RawTopic(NT_Topic handle)
Construct from a topic handle; recommended to use NetworkTableInstance::GetRawTopic() instead.
Definition RawTopic.h:313
std::span< const uint8_t > ParamType
Definition RawTopic.h:302
RawTopic(Topic topic)
Construct from a generic topic.
Definition RawTopic.h:320
PublisherType PublishEx(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.
Definition RawTopic.h:389
NetworkTables subscriber.
Definition Topic.h:321
NT_Subscriber m_subHandle
Definition Topic.h:386
NetworkTables Topic.
Definition Topic.h:28
NT_Topic m_handle
Definition Topic.h:317
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition sha1.h:30
bool SetDefaultRaw(NT_Handle pubentry, std::span< const uint8_t > defaultValue)
Publish a default value.
std::vector< uint8_t > GetRaw(NT_Handle subentry, std::span< const uint8_t > defaultValue)
Get the last published value.
bool SetRaw(NT_Handle pubentry, std::span< const uint8_t > value, int64_t time=0)
Publish a new value.
TimestampedRaw GetAtomicRaw(NT_Handle subentry, std::span< const uint8_t > defaultValue)
Get the last published value along with its timestamp.
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_RAW
Definition ntcore_c.h:58
Timestamped< std::vector< uint8_t > > TimestampedRaw
Timestamped Raw.
Definition ntcore_cpp_types.h:463
Timestamped< std::span< uint8_t > > TimestampedRawView
Timestamped Raw view (for SmallVector-taking functions).
Definition ntcore_cpp_types.h:469
constexpr PubSubOptions kDefaultPubSubOptions
Default publish/subscribe options.
Definition ntcore_cpp.h:390
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 PublishEx(NT_Topic topic, NT_Type type, std::string_view typeStr, const wpi::json &properties, const PubSubOptions &options=kDefaultPubSubOptions)
Creates a new publisher to a topic.
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_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 ntcore_cpp.h:36
Foonathan namespace.
Definition ntcore_cpp.h:26
NetworkTables publish/subscribe options.
Definition ntcore_cpp.h:305
Timestamped value.
Definition ntcore_cpp_types.h:30