mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[ntcore] StructArrayTopic: Publish schema in span-taking setters (#6303)
This commit is contained in:
@@ -312,6 +312,9 @@ class StructArrayPublisher : public Publisher {
|
||||
void Set(std::span<const T> value, int64_t time = 0) {
|
||||
std::apply(
|
||||
[&](const I&... info) {
|
||||
if (!m_schemaPublished.exchange(true, std::memory_order_relaxed)) {
|
||||
GetTopic().GetInstance().template AddStructSchema<T>(info...);
|
||||
}
|
||||
m_buf.Write(
|
||||
value,
|
||||
[&](auto bytes) { ::nt::SetRaw(m_pubHandle, bytes, time); },
|
||||
@@ -356,6 +359,9 @@ class StructArrayPublisher : public Publisher {
|
||||
void SetDefault(std::span<const T> value) {
|
||||
std::apply(
|
||||
[&](const I&... info) {
|
||||
if (!m_schemaPublished.exchange(true, std::memory_order_relaxed)) {
|
||||
GetTopic().GetInstance().template AddStructSchema<T>(info...);
|
||||
}
|
||||
m_buf.Write(
|
||||
value,
|
||||
[&](auto bytes) { ::nt::SetDefaultRaw(m_pubHandle, bytes); },
|
||||
|
||||
Reference in New Issue
Block a user