SCRIPT namespace replacements

This commit is contained in:
PJ Reiniger
2025-11-07 20:00:05 -05:00
committed by Peter Johnson
parent ae6c043632
commit 9aca8e0fd6
2622 changed files with 22275 additions and 22275 deletions

View File

@@ -18,7 +18,7 @@
#include "wpi/nt/StringTopic.hpp"
#include "wpi/util/json.hpp"
using namespace frc;
using namespace wpi;
// The Preferences table name
static constexpr std::string_view kTableName{"Preferences"};
@@ -27,13 +27,13 @@ namespace {
struct Instance {
Instance();
std::shared_ptr<nt::NetworkTable> table{
nt::NetworkTableInstance::GetDefault().GetTable(kTableName)};
nt::StringPublisher typePublisher{table->GetStringTopic(".type").PublishEx(
nt::StringTopic::kTypeString, {{"SmartDashboard", kSmartDashboardType}})};
nt::MultiSubscriber tableSubscriber{nt::NetworkTableInstance::GetDefault(),
std::shared_ptr<wpi::nt::NetworkTable> table{
wpi::nt::NetworkTableInstance::GetDefault().GetTable(kTableName)};
wpi::nt::StringPublisher typePublisher{table->GetStringTopic(".type").PublishEx(
wpi::nt::StringTopic::kTypeString, {{"SmartDashboard", kSmartDashboardType}})};
wpi::nt::MultiSubscriber tableSubscriber{wpi::nt::NetworkTableInstance::GetDefault(),
{{fmt::format("{}/", table->GetPath())}}};
nt::NetworkTableListener listener;
wpi::nt::NetworkTableListener listener;
};
} // namespace
@@ -43,11 +43,11 @@ static Instance& GetInstance() {
}
#ifndef __FRC_SYSTEMCORE__
namespace frc::impl {
namespace wpi::impl {
void ResetPreferencesInstance() {
GetInstance() = Instance();
}
} // namespace frc::impl
} // namespace wpi::impl
#endif
std::vector<std::string> Preferences::GetKeys() {
@@ -171,12 +171,12 @@ void Preferences::RemoveAll() {
Instance::Instance() {
typePublisher.Set(kSmartDashboardType);
listener = nt::NetworkTableListener::CreateListener(
listener = wpi::nt::NetworkTableListener::CreateListener(
tableSubscriber, NT_EVENT_PUBLISH | NT_EVENT_IMMEDIATE,
[typeTopic = typePublisher.GetTopic().GetHandle()](auto& event) {
if (auto topicInfo = event.GetTopicInfo()) {
if (topicInfo->topic != typeTopic) {
nt::SetTopicPersistent(topicInfo->topic, true);
wpi::nt::SetTopicPersistent(topicInfo->topic, true);
}
}
});