[ntcore] Rename constants to all caps style (#8676)

This commit is contained in:
Peter Johnson
2026-03-15 20:44:45 -07:00
committed by GitHub
parent 86dd3ca2b7
commit ab7e4766f6
99 changed files with 736 additions and 732 deletions

View File

@@ -122,9 +122,9 @@ NTField2DModel::NTField2DModel(wpi::nt::NetworkTableInstance inst,
m_tableSub{inst, {{m_path}}, {.periodic = 0.05, .sendAll = true}},
m_nameTopic{inst.GetTopic(fmt::format("{}/.name", path))},
m_poller{inst} {
m_poller.AddListener(m_tableSub, wpi::nt::EventFlags::kTopic |
wpi::nt::EventFlags::kValueAll |
wpi::nt::EventFlags::kImmediate);
m_poller.AddListener(m_tableSub, wpi::nt::EventFlags::TOPIC |
wpi::nt::EventFlags::VALUE_ALL |
wpi::nt::EventFlags::IMMEDIATE);
}
NTField2DModel::~NTField2DModel() = default;
@@ -138,12 +138,12 @@ void NTField2DModel::Update() {
continue;
}
auto [it, match] = Find(info->name);
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
if (match) {
m_objects.erase(it);
}
continue;
} else if (event.flags & wpi::nt::EventFlags::kPublish) {
} else if (event.flags & wpi::nt::EventFlags::PUBLISH) {
if (!match) {
it = m_objects.emplace(
it, std::make_unique<ObjectModel>(

View File

@@ -54,7 +54,7 @@ void NTMechanism2DModel::NTMechanismGroupImpl::NTUpdate(
bool match = it != m_objects.end() && (*it)->GetName() == name;
if (event.GetTopicInfo()) {
if (event.flags & wpi::nt::EventFlags::kPublish) {
if (event.flags & wpi::nt::EventFlags::PUBLISH) {
if (!match) {
it = m_objects.emplace(
it, std::make_unique<NTMechanismObjectModel>(
@@ -79,7 +79,7 @@ bool NTMechanism2DModel::NTMechanismObjectModel::NTUpdate(
const wpi::nt::Event& event, std::string_view childName) {
if (auto info = event.GetTopicInfo()) {
if (info->topic == m_typeTopic.GetHandle()) {
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
return true;
}
} else if (info->topic != m_colorTopic.GetHandle() &&
@@ -121,7 +121,7 @@ bool NTMechanism2DModel::RootModel::NTUpdate(const wpi::nt::Event& event,
if (auto info = event.GetTopicInfo()) {
if (info->topic == m_xTopic.GetHandle() ||
info->topic == m_yTopic.GetHandle()) {
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
return true;
}
} else {
@@ -158,9 +158,9 @@ NTMechanism2DModel::NTMechanism2DModel(wpi::nt::NetworkTableInstance inst,
m_bgColorTopic{m_inst.GetTopic(fmt::format("{}/backgroundColor", path))},
m_poller{m_inst},
m_dimensionsValue{1_m, 1_m} {
m_poller.AddListener(m_tableSub, wpi::nt::EventFlags::kTopic |
wpi::nt::EventFlags::kValueAll |
wpi::nt::EventFlags::kImmediate);
m_poller.AddListener(m_tableSub, wpi::nt::EventFlags::TOPIC |
wpi::nt::EventFlags::VALUE_ALL |
wpi::nt::EventFlags::IMMEDIATE);
}
NTMechanism2DModel::~NTMechanism2DModel() = default;
@@ -184,7 +184,7 @@ void NTMechanism2DModel::Update() {
});
bool match = it != m_roots.end() && (*it)->GetName() == name;
if (event.flags & wpi::nt::EventFlags::kPublish) {
if (event.flags & wpi::nt::EventFlags::PUBLISH) {
if (!match) {
it = m_roots.emplace(
it, std::make_unique<RootModel>(

View File

@@ -23,7 +23,7 @@ NTStringChooserModel::NTStringChooserModel(wpi::nt::NetworkTableInstance inst,
m_selected{m_inst.GetStringTopic(fmt::format("{}/selected", path))
.Subscribe("")},
m_selectedPub{m_inst.GetStringTopic(fmt::format("{}/selected", path))
.PublishEx(wpi::nt::StringTopic::kTypeString,
.PublishEx(wpi::nt::StringTopic::TYPE_STRING,
{{"retained", true}})},
m_active{
m_inst.GetStringTopic(fmt::format("{}/active", path)).Subscribe("")},

View File

@@ -94,9 +94,9 @@ NetworkTablesModel::NetworkTablesModel()
NetworkTablesModel::NetworkTablesModel(wpi::nt::NetworkTableInstance inst)
: m_inst{inst}, m_poller{inst} {
m_poller.AddListener({{"", "$"}}, wpi::nt::EventFlags::kTopic |
wpi::nt::EventFlags::kValueAll |
wpi::nt::EventFlags::kImmediate);
m_poller.AddListener({{"", "$"}}, wpi::nt::EventFlags::TOPIC |
wpi::nt::EventFlags::VALUE_ALL |
wpi::nt::EventFlags::IMMEDIATE);
}
NetworkTablesModel::Entry::~Entry() {
@@ -979,14 +979,14 @@ void NetworkTablesModel::Update() {
for (auto&& event : m_poller.ReadQueue()) {
if (auto info = event.GetTopicInfo()) {
auto& entry = m_entries[info->topic];
if (event.flags & wpi::nt::EventFlags::kPublish) {
if (event.flags & wpi::nt::EventFlags::PUBLISH) {
if (!entry) {
entry = std::make_unique<Entry>();
m_sortedEntries.emplace_back(entry.get());
updateTree = true;
}
}
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
// meta topic handling
if (wpi::util::starts_with(info->name, '$')) {
// meta topic handling
@@ -1020,7 +1020,7 @@ void NetworkTablesModel::Update() {
updateTree = true;
continue;
}
if (event.flags & wpi::nt::EventFlags::kProperties) {
if (event.flags & wpi::nt::EventFlags::PROPERTIES) {
updateTree = true;
}
if (entry) {

View File

@@ -30,7 +30,7 @@ NetworkTablesProvider::NetworkTablesProvider(Storage& storage,
m_typeCache{storage.GetChild("types")} {
storage.SetCustomApply([this] {
m_listener = m_poller.AddListener(
{{""}}, wpi::nt::EventFlags::kImmediate | wpi::nt::EventFlags::kTopic);
{{""}}, wpi::nt::EventFlags::IMMEDIATE | wpi::nt::EventFlags::TOPIC);
for (auto&& childIt : m_storage.GetChildren()) {
auto id = childIt.key();
auto typePtr = m_typeCache.FindValue(id);
@@ -125,7 +125,7 @@ void NetworkTablesProvider::Update() {
continue;
}
if (event.flags & wpi::nt::EventFlags::kUnpublish) {
if (event.flags & wpi::nt::EventFlags::UNPUBLISH) {
auto it = m_topicMap.find(info->topic);
if (it != m_topicMap.end()) {
m_poller.RemoveListener(it->second.listener);
@@ -140,14 +140,14 @@ void NetworkTablesProvider::Update() {
if (it2 != m_viewEntries.end()) {
m_viewEntries.erase(it2);
}
} else if (event.flags & wpi::nt::EventFlags::kPublish) {
} else if (event.flags & wpi::nt::EventFlags::PUBLISH) {
// subscribe to it; use a subscriber so we only get string values
SubListener sublistener;
sublistener.subscriber =
wpi::nt::StringTopic{info->topic}.Subscribe("");
sublistener.listener = m_poller.AddListener(
sublistener.subscriber,
wpi::nt::EventFlags::kValueAll | wpi::nt::EventFlags::kImmediate);
wpi::nt::EventFlags::VALUE_ALL | wpi::nt::EventFlags::IMMEDIATE);
m_topicMap.try_emplace(info->topic, std::move(sublistener));
}
} else if (auto valueData = event.GetValueEventData()) {