mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpiutil] Replace LLVM StringMap impl with std::map
As string_view operations on std::map<std::string> won't be integrated until C++26, placeholder implementations are used which are less efficient in a couple of situations (e.g. insert with hint).
This commit is contained in:
@@ -49,8 +49,8 @@ void Tracer::PrintEpochs(wpi::raw_ostream& os) {
|
||||
m_lastEpochsPrintTime = now;
|
||||
for (const auto& epoch : m_epochs) {
|
||||
os << fmt::format(
|
||||
"\t{}: {:.6f}s\n", epoch.getKey(),
|
||||
duration_cast<microseconds>(epoch.getValue()).count() / 1.0e6);
|
||||
"\t{}: {:.6f}s\n", epoch.first,
|
||||
duration_cast<microseconds>(epoch.second).count() / 1.0e6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void ShuffleboardComponentBase::BuildMetadata(
|
||||
if (GetProperties().size() > 0) {
|
||||
auto propTable = metaTable->GetSubTable("Properties");
|
||||
for (auto& entry : GetProperties()) {
|
||||
propTable->GetEntry(entry.first()).SetValue(entry.second);
|
||||
propTable->GetEntry(entry.first).SetValue(entry.second);
|
||||
}
|
||||
}
|
||||
m_metadataDirty = false;
|
||||
|
||||
@@ -51,7 +51,7 @@ void Mechanism2d::InitSendable(nt::NTSendableBuilder& builder) {
|
||||
m_colorPub = m_table->GetStringTopic(kBackgroundColor).Publish();
|
||||
m_colorPub.Set(m_color);
|
||||
for (const auto& entry : m_roots) {
|
||||
const auto& root = entry.getValue().get();
|
||||
root->Update(m_table->GetSubTable(entry.getKey()));
|
||||
const auto& root = entry.second.get();
|
||||
root->Update(m_table->GetSubTable(entry.first));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ void MechanismObject2d::Update(std::shared_ptr<nt::NetworkTable> table) {
|
||||
std::scoped_lock lock(m_mutex);
|
||||
m_table = table;
|
||||
UpdateEntries(m_table);
|
||||
for (const wpi::StringMapEntry<std::unique_ptr<MechanismObject2d>>& entry :
|
||||
m_objects) {
|
||||
entry.getValue()->Update(m_table->GetSubTable(entry.getKey()));
|
||||
for (const auto& entry : m_objects) {
|
||||
entry.second->Update(m_table->GetSubTable(entry.first));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ wpi::Sendable* SmartDashboard::GetData(std::string_view key) {
|
||||
if (it == inst.tablesToData.end()) {
|
||||
throw FRC_MakeError(err::SmartDashboardMissingKey, "{}", key);
|
||||
}
|
||||
return wpi::SendableRegistry::GetSendable(it->getValue());
|
||||
return wpi::SendableRegistry::GetSendable(it->second);
|
||||
}
|
||||
|
||||
bool SmartDashboard::PutBoolean(std::string_view keyName, bool value) {
|
||||
@@ -254,6 +254,6 @@ void SmartDashboard::UpdateValues() {
|
||||
inst.listenerExecutor.RunListenerTasks();
|
||||
std::scoped_lock lock(inst.tablesToDataMutex);
|
||||
for (auto& i : inst.tablesToData) {
|
||||
wpi::SendableRegistry::Update(i.getValue());
|
||||
wpi::SendableRegistry::Update(i.second);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user