[wpilib] Fix usage reporting for static classes (#6090)

This commit is contained in:
Gold856
2023-12-27 00:16:55 -05:00
committed by GitHub
parent f2c2bab7dc
commit 141241d2d6
4 changed files with 50 additions and 26 deletions

View File

@@ -30,12 +30,17 @@ ShuffleboardInstance::ShuffleboardInstance(nt::NetworkTableInstance ntInstance)
m_impl->selectedTabPub =
m_impl->rootMetaTable->GetStringTopic("Selected")
.Publish(nt::PubSubOptions{.keepDuplicates = true});
HAL_Report(HALUsageReporting::kResourceType_Shuffleboard, 0);
}
ShuffleboardInstance::~ShuffleboardInstance() = default;
static bool gReported = false;
frc::ShuffleboardTab& ShuffleboardInstance::GetTab(std::string_view title) {
if (!gReported) {
HAL_Report(HALUsageReporting::kResourceType_Shuffleboard, 0);
gReported = true;
}
if (m_impl->tabs.find(title) == m_impl->tabs.end()) {
m_impl->tabs.try_emplace(title,
std::make_unique<ShuffleboardTab>(*this, title));