[wpilib] Deprecate getInstance() in favor of static functions (#3440)

Co-authored-by: Noam Zaks <imnoamzaks@gmail.com>
This commit is contained in:
Peter Johnson
2021-06-15 23:06:03 -07:00
committed by GitHub
parent 26ff9371d9
commit 362066a9b7
105 changed files with 1500 additions and 1539 deletions

View File

@@ -13,7 +13,7 @@
using namespace frc2;
SubsystemBase::SubsystemBase() {
wpi::SendableRegistry::GetInstance().AddLW(this, GetTypeName(*this));
wpi::SendableRegistry::AddLW(this, GetTypeName(*this));
CommandScheduler::GetInstance().RegisterSubsystem({this});
}
@@ -48,22 +48,21 @@ void SubsystemBase::InitSendable(wpi::SendableBuilder& builder) {
}
std::string SubsystemBase::GetName() const {
return wpi::SendableRegistry::GetInstance().GetName(this);
return wpi::SendableRegistry::GetName(this);
}
void SubsystemBase::SetName(std::string_view name) {
wpi::SendableRegistry::GetInstance().SetName(this, name);
wpi::SendableRegistry::SetName(this, name);
}
std::string SubsystemBase::GetSubsystem() const {
return wpi::SendableRegistry::GetInstance().GetSubsystem(this);
return wpi::SendableRegistry::GetSubsystem(this);
}
void SubsystemBase::SetSubsystem(std::string_view name) {
wpi::SendableRegistry::GetInstance().SetSubsystem(this, name);
wpi::SendableRegistry::SetSubsystem(this, name);
}
void SubsystemBase::AddChild(std::string name, wpi::Sendable* child) {
auto& registry = wpi::SendableRegistry::GetInstance();
registry.AddLW(child, GetSubsystem(), name);
wpi::SendableRegistry::AddLW(child, GetSubsystem(), name);
}