diff --git a/wpilibc/src/main/native/cpp/ADXL345_I2C.cpp b/wpilibc/src/main/native/cpp/ADXL345_I2C.cpp index b62488100a..49c7aac228 100644 --- a/wpilibc/src/main/native/cpp/ADXL345_I2C.cpp +++ b/wpilibc/src/main/native/cpp/ADXL345_I2C.cpp @@ -86,11 +86,10 @@ std::string ADXL345_I2C::GetSmartDashboardType() const { } void ADXL345_I2C::InitTable(std::shared_ptr subtable) { - m_table = subtable; - if (m_table) { - m_xEntry = m_table->GetEntry("X"); - m_yEntry = m_table->GetEntry("Y"); - m_zEntry = m_table->GetEntry("Z"); + if (subtable) { + m_xEntry = subtable->GetEntry("X"); + m_yEntry = subtable->GetEntry("Y"); + m_zEntry = subtable->GetEntry("Z"); UpdateTable(); } else { m_xEntry = nt::NetworkTableEntry(); @@ -104,7 +103,3 @@ void ADXL345_I2C::UpdateTable() { if (m_yEntry) m_yEntry.SetDouble(GetY()); if (m_zEntry) m_zEntry.SetDouble(GetZ()); } - -std::shared_ptr ADXL345_I2C::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/ADXL345_SPI.cpp b/wpilibc/src/main/native/cpp/ADXL345_SPI.cpp index 36e3dcac88..022c598666 100644 --- a/wpilibc/src/main/native/cpp/ADXL345_SPI.cpp +++ b/wpilibc/src/main/native/cpp/ADXL345_SPI.cpp @@ -113,11 +113,10 @@ std::string ADXL345_SPI::GetSmartDashboardType() const { } void ADXL345_SPI::InitTable(std::shared_ptr subtable) { - m_table = subtable; - if (m_table) { - m_xEntry = m_table->GetEntry("X"); - m_yEntry = m_table->GetEntry("Y"); - m_zEntry = m_table->GetEntry("Z"); + if (subtable) { + m_xEntry = subtable->GetEntry("X"); + m_yEntry = subtable->GetEntry("Y"); + m_zEntry = subtable->GetEntry("Z"); UpdateTable(); } else { m_xEntry = nt::NetworkTableEntry(); @@ -131,7 +130,3 @@ void ADXL345_SPI::UpdateTable() { if (m_yEntry) m_yEntry.SetDouble(GetY()); if (m_zEntry) m_zEntry.SetDouble(GetZ()); } - -std::shared_ptr ADXL345_SPI::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/ADXL362.cpp b/wpilibc/src/main/native/cpp/ADXL362.cpp index 3a245958d9..cc319e4a49 100644 --- a/wpilibc/src/main/native/cpp/ADXL362.cpp +++ b/wpilibc/src/main/native/cpp/ADXL362.cpp @@ -168,11 +168,10 @@ std::string ADXL362::GetSmartDashboardType() const { } void ADXL362::InitTable(std::shared_ptr subtable) { - m_table = subtable; - if (m_table) { - m_xEntry = m_table->GetEntry("X"); - m_yEntry = m_table->GetEntry("Y"); - m_zEntry = m_table->GetEntry("Z"); + if (subtable) { + m_xEntry = subtable->GetEntry("X"); + m_yEntry = subtable->GetEntry("Y"); + m_zEntry = subtable->GetEntry("Z"); UpdateTable(); } else { m_xEntry = nt::NetworkTableEntry(); @@ -186,5 +185,3 @@ void ADXL362::UpdateTable() { if (m_yEntry) m_yEntry.SetDouble(GetY()); if (m_zEntry) m_zEntry.SetDouble(GetZ()); } - -std::shared_ptr ADXL362::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/AnalogAccelerometer.cpp b/wpilibc/src/main/native/cpp/AnalogAccelerometer.cpp index b24469d5b2..5ffab6b108 100644 --- a/wpilibc/src/main/native/cpp/AnalogAccelerometer.cpp +++ b/wpilibc/src/main/native/cpp/AnalogAccelerometer.cpp @@ -130,15 +130,10 @@ std::string AnalogAccelerometer::GetSmartDashboardType() const { void AnalogAccelerometer::InitTable( std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr AnalogAccelerometer::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/AnalogInput.cpp b/wpilibc/src/main/native/cpp/AnalogInput.cpp index 705fe62f54..3e425b69c3 100644 --- a/wpilibc/src/main/native/cpp/AnalogInput.cpp +++ b/wpilibc/src/main/native/cpp/AnalogInput.cpp @@ -431,15 +431,10 @@ std::string AnalogInput::GetSmartDashboardType() const { } void AnalogInput::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr AnalogInput::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/AnalogOutput.cpp b/wpilibc/src/main/native/cpp/AnalogOutput.cpp index d02aee17dd..e877b350d1 100644 --- a/wpilibc/src/main/native/cpp/AnalogOutput.cpp +++ b/wpilibc/src/main/native/cpp/AnalogOutput.cpp @@ -106,15 +106,10 @@ std::string AnalogOutput::GetSmartDashboardType() const { } void AnalogOutput::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr AnalogOutput::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp b/wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp index 18d6aff521..f89d919165 100644 --- a/wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp +++ b/wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp @@ -88,9 +88,8 @@ std::string AnalogPotentiometer::GetSmartDashboardType() const { */ void AnalogPotentiometer::InitTable( std::shared_ptr subtable) { - m_table = subtable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subtable) { + m_valueEntry = subtable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); @@ -100,7 +99,3 @@ void AnalogPotentiometer::InitTable( void AnalogPotentiometer::UpdateTable() { if (m_valueEntry) m_valueEntry.SetDouble(Get()); } - -std::shared_ptr AnalogPotentiometer::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp b/wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp index 790a08f15e..ce7f120e97 100644 --- a/wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp +++ b/wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp @@ -60,11 +60,10 @@ std::string BuiltInAccelerometer::GetSmartDashboardType() const { void BuiltInAccelerometer::InitTable( std::shared_ptr subtable) { - m_table = subtable; - if (m_table != nullptr) { - m_xEntry = m_table->GetEntry("X"); - m_yEntry = m_table->GetEntry("Y"); - m_zEntry = m_table->GetEntry("Z"); + if (subtable != nullptr) { + m_xEntry = subtable->GetEntry("X"); + m_yEntry = subtable->GetEntry("Y"); + m_zEntry = subtable->GetEntry("Z"); UpdateTable(); } else { m_xEntry = nt::NetworkTableEntry(); @@ -78,7 +77,3 @@ void BuiltInAccelerometer::UpdateTable() { if (m_yEntry) m_yEntry.SetDouble(GetY()); if (m_zEntry) m_zEntry.SetDouble(GetZ()); } - -std::shared_ptr BuiltInAccelerometer::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/Buttons/Trigger.cpp b/wpilibc/src/main/native/cpp/Buttons/Trigger.cpp index b7101d70ce..3f2d8631c4 100644 --- a/wpilibc/src/main/native/cpp/Buttons/Trigger.cpp +++ b/wpilibc/src/main/native/cpp/Buttons/Trigger.cpp @@ -46,13 +46,10 @@ void Trigger::ToggleWhenActive(Command* command) { std::string Trigger::GetSmartDashboardType() const { return "Button"; } void Trigger::InitTable(std::shared_ptr subtable) { - m_table = subtable; - if (m_table) { - m_pressedEntry = m_table->GetEntry("pressed"); + if (subtable) { + m_pressedEntry = subtable->GetEntry("pressed"); m_pressedEntry.SetBoolean(Get()); } else { m_pressedEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr Trigger::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/Commands/Command.cpp b/wpilibc/src/main/native/cpp/Commands/Command.cpp index b49d3bfcb1..f6c8791c73 100644 --- a/wpilibc/src/main/native/cpp/Commands/Command.cpp +++ b/wpilibc/src/main/native/cpp/Commands/Command.cpp @@ -435,12 +435,11 @@ std::string Command::GetSmartDashboardType() const { return "Command"; } void Command::InitTable(std::shared_ptr subtable) { if (m_runningListener != 0) m_runningEntry.RemoveListener(m_runningListener); - m_table = subtable; - if (m_table != nullptr) { - m_table->GetEntry(kName).SetString(GetName()); - m_runningEntry = m_table->GetEntry(kRunning); + if (subtable) { + subtable->GetEntry(kName).SetString(GetName()); + m_runningEntry = subtable->GetEntry(kRunning); m_runningEntry.SetBoolean(IsRunning()); - m_isParentedEntry = m_table->GetEntry(kIsParented); + m_isParentedEntry = subtable->GetEntry(kIsParented); m_isParentedEntry.SetBoolean(m_parent != nullptr); m_runningListener = m_runningEntry.AddListener( @@ -455,5 +454,3 @@ void Command::InitTable(std::shared_ptr subtable) { NT_NOTIFY_NEW | NT_NOTIFY_UPDATE); } } - -std::shared_ptr Command::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/Commands/Scheduler.cpp b/wpilibc/src/main/native/cpp/Commands/Scheduler.cpp index 64b598bc84..1468867db4 100644 --- a/wpilibc/src/main/native/cpp/Commands/Scheduler.cpp +++ b/wpilibc/src/main/native/cpp/Commands/Scheduler.cpp @@ -218,7 +218,6 @@ void Scheduler::ResetAll() { m_buttons.clear(); m_additions.clear(); m_commands.clear(); - m_table = nullptr; m_namesEntry = nt::NetworkTableEntry(); m_idsEntry = nt::NetworkTableEntry(); m_cancelEntry = nt::NetworkTableEntry(); @@ -229,7 +228,7 @@ void Scheduler::ResetAll() { * SmartDashboard. */ void Scheduler::UpdateTable() { - if (m_table != nullptr) { + if (m_cancelEntry && m_namesEntry && m_idsEntry) { // Get the list of possible commands to cancel auto new_toCancel = m_cancelEntry.GetValue(); if (new_toCancel) @@ -277,11 +276,10 @@ std::string Scheduler::GetType() const { return "Scheduler"; } std::string Scheduler::GetSmartDashboardType() const { return "Scheduler"; } void Scheduler::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_namesEntry = m_table->GetEntry("Names"); - m_idsEntry = m_table->GetEntry("Ids"); - m_cancelEntry = m_table->GetEntry("Cancel"); + if (subTable) { + m_namesEntry = subTable->GetEntry("Names"); + m_idsEntry = subTable->GetEntry("Ids"); + m_cancelEntry = subTable->GetEntry("Cancel"); m_namesEntry.SetStringArray(commands); m_idsEntry.SetDoubleArray(ids); m_cancelEntry.SetDoubleArray(toCancel); @@ -291,7 +289,3 @@ void Scheduler::InitTable(std::shared_ptr subTable) { m_cancelEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr Scheduler::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/Commands/Subsystem.cpp b/wpilibc/src/main/native/cpp/Commands/Subsystem.cpp index 573c0f3290..bab3a4c099 100644 --- a/wpilibc/src/main/native/cpp/Commands/Subsystem.cpp +++ b/wpilibc/src/main/native/cpp/Commands/Subsystem.cpp @@ -64,7 +64,7 @@ void Subsystem::SetDefaultCommand(Command* command) { m_defaultCommand = command; } - if (m_table != nullptr) { + if (m_hasDefaultEntry && m_defaultEntry) { if (m_defaultCommand != nullptr) { m_hasDefaultEntry.SetBoolean(true); m_defaultEntry.SetString(m_defaultCommand->GetName()); @@ -119,7 +119,7 @@ void Subsystem::Periodic() {} */ void Subsystem::ConfirmCommand() { if (m_currentCommandChanged) { - if (m_table != nullptr) { + if (m_hasCommandEntry && m_commandEntry) { if (m_currentCommand != nullptr) { m_hasCommandEntry.SetBoolean(true); m_commandEntry.SetString(m_currentCommand->GetName()); @@ -136,12 +136,11 @@ std::string Subsystem::GetName() const { return m_name; } std::string Subsystem::GetSmartDashboardType() const { return "Subsystem"; } void Subsystem::InitTable(std::shared_ptr subtable) { - m_table = subtable; - if (m_table != nullptr) { - m_hasDefaultEntry = m_table->GetEntry("hasDefault"); - m_defaultEntry = m_table->GetEntry("default"); - m_hasCommandEntry = m_table->GetEntry("hasCommand"); - m_commandEntry = m_table->GetEntry("command"); + if (subtable != nullptr) { + m_hasDefaultEntry = subtable->GetEntry("hasDefault"); + m_defaultEntry = subtable->GetEntry("default"); + m_hasCommandEntry = subtable->GetEntry("hasCommand"); + m_commandEntry = subtable->GetEntry("command"); if (m_defaultCommand != nullptr) { m_hasDefaultEntry.SetBoolean(true); @@ -157,7 +156,3 @@ void Subsystem::InitTable(std::shared_ptr subtable) { } } } - -std::shared_ptr Subsystem::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/Compressor.cpp b/wpilibc/src/main/native/cpp/Compressor.cpp index 18521c295d..3a91b9827a 100644 --- a/wpilibc/src/main/native/cpp/Compressor.cpp +++ b/wpilibc/src/main/native/cpp/Compressor.cpp @@ -336,17 +336,12 @@ void Compressor::StopLiveWindowMode() { std::string Compressor::GetSmartDashboardType() const { return "Compressor"; } void Compressor::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_enabledEntry = m_table->GetEntry("Enabled"); - m_pressureSwitchEntry = m_table->GetEntry("Pressure switch"); + if (subTable) { + m_enabledEntry = subTable->GetEntry("Enabled"); + m_pressureSwitchEntry = subTable->GetEntry("Pressure switch"); UpdateTable(); } else { m_enabledEntry = nt::NetworkTableEntry(); m_pressureSwitchEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr Compressor::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/Counter.cpp b/wpilibc/src/main/native/cpp/Counter.cpp index 36b27410f5..4cbbb80fba 100644 --- a/wpilibc/src/main/native/cpp/Counter.cpp +++ b/wpilibc/src/main/native/cpp/Counter.cpp @@ -613,13 +613,10 @@ void Counter::StopLiveWindowMode() {} std::string Counter::GetSmartDashboardType() const { return "Counter"; } void Counter::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr Counter::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/DigitalInput.cpp b/wpilibc/src/main/native/cpp/DigitalInput.cpp index 2a12897ebc..f1c5873ecf 100644 --- a/wpilibc/src/main/native/cpp/DigitalInput.cpp +++ b/wpilibc/src/main/native/cpp/DigitalInput.cpp @@ -116,15 +116,10 @@ std::string DigitalInput::GetSmartDashboardType() const { } void DigitalInput::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr DigitalInput::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/DigitalOutput.cpp b/wpilibc/src/main/native/cpp/DigitalOutput.cpp index e9cd157649..c2cddfa3c4 100644 --- a/wpilibc/src/main/native/cpp/DigitalOutput.cpp +++ b/wpilibc/src/main/native/cpp/DigitalOutput.cpp @@ -257,15 +257,10 @@ std::string DigitalOutput::GetSmartDashboardType() const { } void DigitalOutput::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table != nullptr) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr DigitalOutput::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/DoubleSolenoid.cpp b/wpilibc/src/main/native/cpp/DoubleSolenoid.cpp index e4cdcd0385..3b22b6c0c2 100644 --- a/wpilibc/src/main/native/cpp/DoubleSolenoid.cpp +++ b/wpilibc/src/main/native/cpp/DoubleSolenoid.cpp @@ -227,15 +227,10 @@ std::string DoubleSolenoid::GetSmartDashboardType() const { } void DoubleSolenoid::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr DoubleSolenoid::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/Encoder.cpp b/wpilibc/src/main/native/cpp/Encoder.cpp index 0973d6a7d9..e5a3cbf716 100644 --- a/wpilibc/src/main/native/cpp/Encoder.cpp +++ b/wpilibc/src/main/native/cpp/Encoder.cpp @@ -506,11 +506,10 @@ std::string Encoder::GetSmartDashboardType() const { } void Encoder::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_speedEntry = m_table->GetEntry("Speed"); - m_distanceEntry = m_table->GetEntry("Distance"); - m_distancePerTickEntry = m_table->GetEntry("Distance per Tick"); + if (subTable) { + m_speedEntry = subTable->GetEntry("Speed"); + m_distanceEntry = subTable->GetEntry("Distance"); + m_distancePerTickEntry = subTable->GetEntry("Distance per Tick"); UpdateTable(); } else { m_speedEntry = nt::NetworkTableEntry(); @@ -518,5 +517,3 @@ void Encoder::InitTable(std::shared_ptr subTable) { m_distancePerTickEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr Encoder::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/GyroBase.cpp b/wpilibc/src/main/native/cpp/GyroBase.cpp index 13cfb21f7d..c323589a63 100644 --- a/wpilibc/src/main/native/cpp/GyroBase.cpp +++ b/wpilibc/src/main/native/cpp/GyroBase.cpp @@ -40,13 +40,10 @@ void GyroBase::StopLiveWindowMode() {} std::string GyroBase::GetSmartDashboardType() const { return "Gyro"; } void GyroBase::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr GyroBase::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/PIDController.cpp b/wpilibc/src/main/native/cpp/PIDController.cpp index 635c197855..7db1872f58 100644 --- a/wpilibc/src/main/native/cpp/PIDController.cpp +++ b/wpilibc/src/main/native/cpp/PIDController.cpp @@ -562,19 +562,18 @@ std::string PIDController::GetSmartDashboardType() const { void PIDController::InitTable(std::shared_ptr subtable) { RemoveListeners(); - m_table = subtable; - if (m_table) { - m_pEntry = m_table->GetEntry(kP); + if (subtable) { + m_pEntry = subtable->GetEntry(kP); m_pEntry.SetDouble(GetP()); - m_iEntry = m_table->GetEntry(kI); + m_iEntry = subtable->GetEntry(kI); m_iEntry.SetDouble(GetI()); - m_dEntry = m_table->GetEntry(kD); + m_dEntry = subtable->GetEntry(kD); m_dEntry.SetDouble(GetD()); - m_fEntry = m_table->GetEntry(kF); + m_fEntry = subtable->GetEntry(kF); m_fEntry.SetDouble(GetF()); - m_setpointEntry = m_table->GetEntry(kSetpoint); + m_setpointEntry = subtable->GetEntry(kSetpoint); m_setpointEntry.SetDouble(GetSetpoint()); - m_enabledEntry = m_table->GetEntry(kEnabled); + m_enabledEntry = subtable->GetEntry(kEnabled); m_enabledEntry.SetBoolean(IsEnabled()); m_pListener = m_pEntry.AddListener( @@ -649,10 +648,6 @@ double PIDController::GetContinuousError(double error) const { return error; } -std::shared_ptr PIDController::GetTable() const { - return m_table; -} - void PIDController::UpdateTable() {} void PIDController::StartLiveWindowMode() { Disable(); } diff --git a/wpilibc/src/main/native/cpp/PWM.cpp b/wpilibc/src/main/native/cpp/PWM.cpp index 060765fb9e..ee7ab4c0c2 100644 --- a/wpilibc/src/main/native/cpp/PWM.cpp +++ b/wpilibc/src/main/native/cpp/PWM.cpp @@ -341,13 +341,10 @@ void PWM::StopLiveWindowMode() { std::string PWM::GetSmartDashboardType() const { return "Speed Controller"; } void PWM::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr PWM::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/PowerDistributionPanel.cpp b/wpilibc/src/main/native/cpp/PowerDistributionPanel.cpp index 2183107d66..4e71caf8ac 100644 --- a/wpilibc/src/main/native/cpp/PowerDistributionPanel.cpp +++ b/wpilibc/src/main/native/cpp/PowerDistributionPanel.cpp @@ -189,16 +189,15 @@ std::string PowerDistributionPanel::GetSmartDashboardType() const { void PowerDistributionPanel::InitTable( std::shared_ptr subTable) { - m_table = subTable; - if (m_table != nullptr) { + if (subTable != nullptr) { for (size_t i = 0; i < sizeof(m_chanEntry) / sizeof(m_chanEntry[0]); ++i) { llvm::SmallString<32> buf; llvm::raw_svector_ostream oss(buf); oss << "Chan" << i; - m_chanEntry[i] = m_table->GetEntry(oss.str()); + m_chanEntry[i] = subTable->GetEntry(oss.str()); } - m_voltageEntry = m_table->GetEntry("Voltage"); - m_totalCurrentEntry = m_table->GetEntry("TotalCurrent"); + m_voltageEntry = subTable->GetEntry("Voltage"); + m_totalCurrentEntry = subTable->GetEntry("TotalCurrent"); UpdateTable(); } else { for (size_t i = 0; i < sizeof(m_chanEntry) / sizeof(m_chanEntry[0]); ++i) { @@ -208,7 +207,3 @@ void PowerDistributionPanel::InitTable( m_totalCurrentEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr PowerDistributionPanel::GetTable() const { - return m_table; -} diff --git a/wpilibc/src/main/native/cpp/Relay.cpp b/wpilibc/src/main/native/cpp/Relay.cpp index f877cf37c1..9c5e0000fb 100644 --- a/wpilibc/src/main/native/cpp/Relay.cpp +++ b/wpilibc/src/main/native/cpp/Relay.cpp @@ -315,13 +315,10 @@ void Relay::StopLiveWindowMode() { std::string Relay::GetSmartDashboardType() const { return "Relay"; } void Relay::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr Relay::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/Servo.cpp b/wpilibc/src/main/native/cpp/Servo.cpp index 847d5e30f3..c37e74b65d 100644 --- a/wpilibc/src/main/native/cpp/Servo.cpp +++ b/wpilibc/src/main/native/cpp/Servo.cpp @@ -121,13 +121,10 @@ void Servo::StopLiveWindowMode() { std::string Servo::GetSmartDashboardType() const { return "Servo"; } void Servo::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr Servo::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/SmartDashboard/SendableChooserBase.cpp b/wpilibc/src/main/native/cpp/SmartDashboard/SendableChooserBase.cpp index 7039a1127a..ee7be0ad3c 100644 --- a/wpilibc/src/main/native/cpp/SmartDashboard/SendableChooserBase.cpp +++ b/wpilibc/src/main/native/cpp/SmartDashboard/SendableChooserBase.cpp @@ -13,10 +13,6 @@ const char* SendableChooserBase::kDefault = "default"; const char* SendableChooserBase::kOptions = "options"; const char* SendableChooserBase::kSelected = "selected"; -std::shared_ptr SendableChooserBase::GetTable() const { - return m_table; -} - std::string SendableChooserBase::GetSmartDashboardType() const { return "String Chooser"; } diff --git a/wpilibc/src/main/native/cpp/Solenoid.cpp b/wpilibc/src/main/native/cpp/Solenoid.cpp index 79b46947ba..03003280d5 100644 --- a/wpilibc/src/main/native/cpp/Solenoid.cpp +++ b/wpilibc/src/main/native/cpp/Solenoid.cpp @@ -135,13 +135,10 @@ void Solenoid::StopLiveWindowMode() { std::string Solenoid::GetSmartDashboardType() const { return "Solenoid"; } void Solenoid::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr Solenoid::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/cpp/Ultrasonic.cpp b/wpilibc/src/main/native/cpp/Ultrasonic.cpp index 81e6f58213..2f927d97b4 100644 --- a/wpilibc/src/main/native/cpp/Ultrasonic.cpp +++ b/wpilibc/src/main/native/cpp/Ultrasonic.cpp @@ -331,13 +331,10 @@ void Ultrasonic::StopLiveWindowMode() {} std::string Ultrasonic::GetSmartDashboardType() const { return "Ultrasonic"; } void Ultrasonic::InitTable(std::shared_ptr subTable) { - m_table = subTable; - if (m_table != nullptr) { - m_valueEntry = m_table->GetEntry("Value"); + if (subTable) { + m_valueEntry = subTable->GetEntry("Value"); UpdateTable(); } else { m_valueEntry = nt::NetworkTableEntry(); } } - -std::shared_ptr Ultrasonic::GetTable() const { return m_table; } diff --git a/wpilibc/src/main/native/include/ADXL345_I2C.h b/wpilibc/src/main/native/include/ADXL345_I2C.h index 713cbc9f27..425cb58b61 100644 --- a/wpilibc/src/main/native/include/ADXL345_I2C.h +++ b/wpilibc/src/main/native/include/ADXL345_I2C.h @@ -74,7 +74,6 @@ class ADXL345_I2C : public Accelerometer, public LiveWindowSendable { std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subtable) override; void UpdateTable() override; - std::shared_ptr GetTable() const override; void StartLiveWindowMode() override {} void StopLiveWindowMode() override {} @@ -82,7 +81,6 @@ class ADXL345_I2C : public Accelerometer, public LiveWindowSendable { I2C m_i2c; private: - std::shared_ptr m_table; nt::NetworkTableEntry m_xEntry; nt::NetworkTableEntry m_yEntry; nt::NetworkTableEntry m_zEntry; diff --git a/wpilibc/src/main/native/include/ADXL345_SPI.h b/wpilibc/src/main/native/include/ADXL345_SPI.h index 58323adb2e..3868606598 100644 --- a/wpilibc/src/main/native/include/ADXL345_SPI.h +++ b/wpilibc/src/main/native/include/ADXL345_SPI.h @@ -76,7 +76,6 @@ class ADXL345_SPI : public Accelerometer, public LiveWindowSendable { std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subtable) override; void UpdateTable() override; - std::shared_ptr GetTable() const override; void StartLiveWindowMode() override {} void StopLiveWindowMode() override {} @@ -84,7 +83,6 @@ class ADXL345_SPI : public Accelerometer, public LiveWindowSendable { SPI m_spi; private: - std::shared_ptr m_table; nt::NetworkTableEntry m_xEntry; nt::NetworkTableEntry m_yEntry; nt::NetworkTableEntry m_zEntry; diff --git a/wpilibc/src/main/native/include/ADXL362.h b/wpilibc/src/main/native/include/ADXL362.h index 241a1c085e..191a4553b6 100644 --- a/wpilibc/src/main/native/include/ADXL362.h +++ b/wpilibc/src/main/native/include/ADXL362.h @@ -55,7 +55,6 @@ class ADXL362 : public Accelerometer, public LiveWindowSendable { std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subtable) override; void UpdateTable() override; - std::shared_ptr GetTable() const override; void StartLiveWindowMode() override {} void StopLiveWindowMode() override {} @@ -63,7 +62,6 @@ class ADXL362 : public Accelerometer, public LiveWindowSendable { SPI m_spi; double m_gsPerLSB = 0.001; - std::shared_ptr m_table; nt::NetworkTableEntry m_xEntry; nt::NetworkTableEntry m_yEntry; nt::NetworkTableEntry m_zEntry; diff --git a/wpilibc/src/main/native/include/AnalogAccelerometer.h b/wpilibc/src/main/native/include/AnalogAccelerometer.h index 5b197ecdf4..ad3a53ddb6 100644 --- a/wpilibc/src/main/native/include/AnalogAccelerometer.h +++ b/wpilibc/src/main/native/include/AnalogAccelerometer.h @@ -43,7 +43,6 @@ class AnalogAccelerometer : public SensorBase, void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; private: void InitAccelerometer(); @@ -52,7 +51,6 @@ class AnalogAccelerometer : public SensorBase, double m_voltsPerG = 1.0; double m_zeroGVoltage = 2.5; - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; }; diff --git a/wpilibc/src/main/native/include/AnalogInput.h b/wpilibc/src/main/native/include/AnalogInput.h index d11a9d530c..f43e6123e9 100644 --- a/wpilibc/src/main/native/include/AnalogInput.h +++ b/wpilibc/src/main/native/include/AnalogInput.h @@ -83,7 +83,6 @@ class AnalogInput : public SensorBase, void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; private: int m_channel; @@ -91,7 +90,6 @@ class AnalogInput : public SensorBase, HAL_AnalogInputHandle m_port; int64_t m_accumulatorOffset; - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; }; diff --git a/wpilibc/src/main/native/include/AnalogOutput.h b/wpilibc/src/main/native/include/AnalogOutput.h index 86f063e667..55401e7146 100644 --- a/wpilibc/src/main/native/include/AnalogOutput.h +++ b/wpilibc/src/main/native/include/AnalogOutput.h @@ -35,13 +35,11 @@ class AnalogOutput : public SensorBase, public LiveWindowSendable { void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; protected: int m_channel; HAL_AnalogOutputHandle m_port; - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; }; diff --git a/wpilibc/src/main/native/include/AnalogPotentiometer.h b/wpilibc/src/main/native/include/AnalogPotentiometer.h index 64ba02cbba..ff1e2bf9ca 100644 --- a/wpilibc/src/main/native/include/AnalogPotentiometer.h +++ b/wpilibc/src/main/native/include/AnalogPotentiometer.h @@ -74,7 +74,6 @@ class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable { std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subtable) override; void UpdateTable() override; - std::shared_ptr GetTable() const override; /** * AnalogPotentiometers don't have to do anything special when entering the @@ -91,7 +90,6 @@ class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable { private: std::shared_ptr m_analog_input; double m_fullRange, m_offset; - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; }; diff --git a/wpilibc/src/main/native/include/BuiltInAccelerometer.h b/wpilibc/src/main/native/include/BuiltInAccelerometer.h index 89eb4f079b..4b16625c18 100644 --- a/wpilibc/src/main/native/include/BuiltInAccelerometer.h +++ b/wpilibc/src/main/native/include/BuiltInAccelerometer.h @@ -38,12 +38,10 @@ class BuiltInAccelerometer : public Accelerometer, std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subtable) override; void UpdateTable() override; - std::shared_ptr GetTable() const override; void StartLiveWindowMode() override {} void StopLiveWindowMode() override {} private: - std::shared_ptr m_table; nt::NetworkTableEntry m_xEntry; nt::NetworkTableEntry m_yEntry; nt::NetworkTableEntry m_zEntry; diff --git a/wpilibc/src/main/native/include/Buttons/Trigger.h b/wpilibc/src/main/native/include/Buttons/Trigger.h index 21af5c0ef4..16e3e8770a 100644 --- a/wpilibc/src/main/native/include/Buttons/Trigger.h +++ b/wpilibc/src/main/native/include/Buttons/Trigger.h @@ -45,11 +45,9 @@ class Trigger : public Sendable { void ToggleWhenActive(Command* command); void InitTable(std::shared_ptr subtable) override; - std::shared_ptr GetTable() const override; std::string GetSmartDashboardType() const override; protected: - std::shared_ptr m_table; nt::NetworkTableEntry m_pressedEntry; }; diff --git a/wpilibc/src/main/native/include/Commands/Command.h b/wpilibc/src/main/native/include/Commands/Command.h index ab7cd746ae..1c4fcc7bb1 100644 --- a/wpilibc/src/main/native/include/Commands/Command.h +++ b/wpilibc/src/main/native/include/Commands/Command.h @@ -161,12 +161,8 @@ class Command : public ErrorBase, public NamedSendable { public: std::string GetName() const override; void InitTable(std::shared_ptr subtable) override; - std::shared_ptr GetTable() const override; std::string GetSmartDashboardType() const override; - protected: - std::shared_ptr m_table; - private: nt::NetworkTableEntry m_runningEntry; nt::NetworkTableEntry m_isParentedEntry; diff --git a/wpilibc/src/main/native/include/Commands/Scheduler.h b/wpilibc/src/main/native/include/Commands/Scheduler.h index c4b8e45590..12c4a7e334 100644 --- a/wpilibc/src/main/native/include/Commands/Scheduler.h +++ b/wpilibc/src/main/native/include/Commands/Scheduler.h @@ -44,7 +44,6 @@ class Scheduler : public ErrorBase, public NamedSendable { void UpdateTable(); std::string GetSmartDashboardType() const; void InitTable(std::shared_ptr subTable); - std::shared_ptr GetTable() const; std::string GetName() const; std::string GetType() const; @@ -68,7 +67,6 @@ class Scheduler : public ErrorBase, public NamedSendable { std::vector commands; std::vector ids; std::vector toCancel; - std::shared_ptr m_table; nt::NetworkTableEntry m_namesEntry; nt::NetworkTableEntry m_idsEntry; nt::NetworkTableEntry m_cancelEntry; diff --git a/wpilibc/src/main/native/include/Commands/Subsystem.h b/wpilibc/src/main/native/include/Commands/Subsystem.h index e204018107..78bd7bc215 100644 --- a/wpilibc/src/main/native/include/Commands/Subsystem.h +++ b/wpilibc/src/main/native/include/Commands/Subsystem.h @@ -44,11 +44,9 @@ class Subsystem : public ErrorBase, public NamedSendable { public: std::string GetName() const override; void InitTable(std::shared_ptr subtable) override; - std::shared_ptr GetTable() const override; std::string GetSmartDashboardType() const override; protected: - std::shared_ptr m_table; nt::NetworkTableEntry m_hasDefaultEntry; nt::NetworkTableEntry m_defaultEntry; nt::NetworkTableEntry m_hasCommandEntry; diff --git a/wpilibc/src/main/native/include/Compressor.h b/wpilibc/src/main/native/include/Compressor.h index 4570d442d0..0a003348a9 100644 --- a/wpilibc/src/main/native/include/Compressor.h +++ b/wpilibc/src/main/native/include/Compressor.h @@ -61,7 +61,6 @@ class Compressor : public SensorBase, public LiveWindowSendable { void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; protected: HAL_CompressorHandle m_compressorHandle; @@ -70,7 +69,6 @@ class Compressor : public SensorBase, public LiveWindowSendable { void SetCompressor(bool on); int m_module; - std::shared_ptr m_table; nt::NetworkTableEntry m_enabledEntry; nt::NetworkTableEntry m_pressureSwitchEntry; NT_EntryListener m_enabledListener = 0; diff --git a/wpilibc/src/main/native/include/Counter.h b/wpilibc/src/main/native/include/Counter.h index bbfca2d9c4..a71fd917ef 100644 --- a/wpilibc/src/main/native/include/Counter.h +++ b/wpilibc/src/main/native/include/Counter.h @@ -100,7 +100,6 @@ class Counter : public SensorBase, void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; protected: // Makes the counter count up. @@ -113,7 +112,6 @@ class Counter : public SensorBase, private: int m_index = 0; ///< The index of this counter. - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; friend class DigitalGlitchFilter; }; diff --git a/wpilibc/src/main/native/include/DigitalInput.h b/wpilibc/src/main/native/include/DigitalInput.h index f78b02cf46..35e296a978 100644 --- a/wpilibc/src/main/native/include/DigitalInput.h +++ b/wpilibc/src/main/native/include/DigitalInput.h @@ -43,13 +43,11 @@ class DigitalInput : public DigitalSource, public LiveWindowSendable { void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; private: int m_channel; HAL_DigitalHandle m_handle; - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; friend class DigitalGlitchFilter; }; diff --git a/wpilibc/src/main/native/include/DigitalOutput.h b/wpilibc/src/main/native/include/DigitalOutput.h index 4f94306760..c022595f97 100644 --- a/wpilibc/src/main/native/include/DigitalOutput.h +++ b/wpilibc/src/main/native/include/DigitalOutput.h @@ -48,14 +48,12 @@ class DigitalOutput : public DigitalSource, public LiveWindowSendable { void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; private: int m_channel; HAL_DigitalHandle m_handle; HAL_DigitalPWMHandle m_pwmGenerator; - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; NT_EntryListener m_valueListener = 0; }; diff --git a/wpilibc/src/main/native/include/DoubleSolenoid.h b/wpilibc/src/main/native/include/DoubleSolenoid.h index ce3f8c12f6..e93a3414d7 100644 --- a/wpilibc/src/main/native/include/DoubleSolenoid.h +++ b/wpilibc/src/main/native/include/DoubleSolenoid.h @@ -42,7 +42,6 @@ class DoubleSolenoid : public SolenoidBase, public LiveWindowSendable { void StopLiveWindowMode(); std::string GetSmartDashboardType() const; void InitTable(std::shared_ptr subTable); - std::shared_ptr GetTable() const; private: int m_forwardChannel; ///< The forward channel on the module to control. @@ -52,7 +51,6 @@ class DoubleSolenoid : public SolenoidBase, public LiveWindowSendable { HAL_SolenoidHandle m_forwardHandle = HAL_kInvalidHandle; HAL_SolenoidHandle m_reverseHandle = HAL_kInvalidHandle; - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; NT_EntryListener m_valueListener = 0; }; diff --git a/wpilibc/src/main/native/include/Encoder.h b/wpilibc/src/main/native/include/Encoder.h index a4c7be81ad..435c746f08 100644 --- a/wpilibc/src/main/native/include/Encoder.h +++ b/wpilibc/src/main/native/include/Encoder.h @@ -90,7 +90,6 @@ class Encoder : public SensorBase, void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; int GetFPGAIndex() const; @@ -104,7 +103,6 @@ class Encoder : public SensorBase, std::unique_ptr m_indexSource = nullptr; HAL_EncoderHandle m_encoder = HAL_kInvalidHandle; - std::shared_ptr m_table; nt::NetworkTableEntry m_speedEntry; nt::NetworkTableEntry m_distanceEntry; nt::NetworkTableEntry m_distancePerTickEntry; diff --git a/wpilibc/src/main/native/include/GyroBase.h b/wpilibc/src/main/native/include/GyroBase.h index 8818572077..e8437f2a01 100644 --- a/wpilibc/src/main/native/include/GyroBase.h +++ b/wpilibc/src/main/native/include/GyroBase.h @@ -37,10 +37,8 @@ class GyroBase : public Gyro, void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; private: - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; }; diff --git a/wpilibc/src/main/native/include/PIDController.h b/wpilibc/src/main/native/include/PIDController.h index 815edcc560..04cd795b00 100644 --- a/wpilibc/src/main/native/include/PIDController.h +++ b/wpilibc/src/main/native/include/PIDController.h @@ -87,7 +87,6 @@ class PIDController : public LiveWindowSendable, public PIDInterface { PIDSource* m_pidInput; PIDOutput* m_pidOutput; - std::shared_ptr m_table; nt::NetworkTableEntry m_pEntry; nt::NetworkTableEntry m_iEntry; nt::NetworkTableEntry m_dEntry; @@ -154,7 +153,6 @@ class PIDController : public LiveWindowSendable, public PIDInterface { std::unique_ptr m_controlLoop; Timer m_setpointTimer; - std::shared_ptr GetTable() const override; std::string GetSmartDashboardType() const override; void UpdateTable() override; void StartLiveWindowMode() override; diff --git a/wpilibc/src/main/native/include/PWM.h b/wpilibc/src/main/native/include/PWM.h index a154168f42..87e3a85b5a 100644 --- a/wpilibc/src/main/native/include/PWM.h +++ b/wpilibc/src/main/native/include/PWM.h @@ -83,9 +83,7 @@ class PWM : public SensorBase, public LiveWindowSendable { void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; NT_EntryListener m_valueListener = 0; diff --git a/wpilibc/src/main/native/include/PowerDistributionPanel.h b/wpilibc/src/main/native/include/PowerDistributionPanel.h index 2bb774ce52..78e44682a9 100644 --- a/wpilibc/src/main/native/include/PowerDistributionPanel.h +++ b/wpilibc/src/main/native/include/PowerDistributionPanel.h @@ -39,10 +39,8 @@ class PowerDistributionPanel : public SensorBase, public LiveWindowSendable { void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; private: - std::shared_ptr m_table; nt::NetworkTableEntry m_chanEntry[16]; nt::NetworkTableEntry m_voltageEntry; nt::NetworkTableEntry m_totalCurrentEntry; diff --git a/wpilibc/src/main/native/include/Relay.h b/wpilibc/src/main/native/include/Relay.h index 261085045a..80acbbc1f0 100644 --- a/wpilibc/src/main/native/include/Relay.h +++ b/wpilibc/src/main/native/include/Relay.h @@ -58,10 +58,8 @@ class Relay : public MotorSafety, public SensorBase, public LiveWindowSendable { void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; protected: - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; NT_EntryListener m_valueListener = 0; diff --git a/wpilibc/src/main/native/include/Servo.h b/wpilibc/src/main/native/include/Servo.h index 26f6528b16..aa584ec2db 100644 --- a/wpilibc/src/main/native/include/Servo.h +++ b/wpilibc/src/main/native/include/Servo.h @@ -40,10 +40,8 @@ class Servo : public SafePWM { void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; protected: - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; NT_EntryListener m_valueListener = 0; diff --git a/wpilibc/src/main/native/include/SmartDashboard/Sendable.h b/wpilibc/src/main/native/include/SmartDashboard/Sendable.h index 46b3438120..77c8083e4c 100644 --- a/wpilibc/src/main/native/include/SmartDashboard/Sendable.h +++ b/wpilibc/src/main/native/include/SmartDashboard/Sendable.h @@ -22,11 +22,6 @@ class Sendable { */ virtual void InitTable(std::shared_ptr subtable) = 0; - /** - * @return the table that is currently associated with the sendable - */ - virtual std::shared_ptr GetTable() const = 0; - /** * @return the string representation of the named data type that will be used * by the smart dashboard for this sendable diff --git a/wpilibc/src/main/native/include/SmartDashboard/SendableChooser.h b/wpilibc/src/main/native/include/SmartDashboard/SendableChooser.h index 6da80a66ed..2595c9d16e 100644 --- a/wpilibc/src/main/native/include/SmartDashboard/SendableChooser.h +++ b/wpilibc/src/main/native/include/SmartDashboard/SendableChooser.h @@ -15,6 +15,7 @@ #include "SmartDashboard/SendableChooserBase.h" #include "networktables/NetworkTable.h" +#include "networktables/NetworkTableEntry.h" namespace frc { @@ -35,6 +36,7 @@ namespace frc { template class SendableChooser : public SendableChooserBase { llvm::StringMap m_choices; + nt::NetworkTableEntry m_selectedEntry; template static U _unwrap_smart_ptr(const U& value); diff --git a/wpilibc/src/main/native/include/SmartDashboard/SendableChooser.inc b/wpilibc/src/main/native/include/SmartDashboard/SendableChooser.inc index 51ecc368ae..d2b157b782 100644 --- a/wpilibc/src/main/native/include/SmartDashboard/SendableChooser.inc +++ b/wpilibc/src/main/native/include/SmartDashboard/SendableChooser.inc @@ -59,7 +59,7 @@ void SendableChooser::AddDefault(llvm::StringRef name, T object) { template auto SendableChooser::GetSelected() -> decltype(_unwrap_smart_ptr(m_choices[""])) { - std::string selected = m_table->GetString(kSelected, m_defaultChoice); + std::string selected = m_selectedEntry.GetString(m_defaultChoice); if (selected == "") { return decltype(_unwrap_smart_ptr(m_choices[""])){}; } else { @@ -70,8 +70,8 @@ auto SendableChooser::GetSelected() template void SendableChooser::InitTable(std::shared_ptr subtable) { std::vector keys; - m_table = subtable; - if (m_table != nullptr) { + if (subtable) { + m_selectedEntry = subtable->GetEntry(kSelected); for (const auto& choice : m_choices) { keys.push_back(choice.first()); } @@ -79,9 +79,9 @@ void SendableChooser::InitTable(std::shared_ptr subtable) { // Unlike std::map, llvm::StringMap elements are not sorted std::sort(keys.begin(), keys.end()); - m_table->GetEntry(kOptions).SetValue( + subtable->GetEntry(kOptions).SetValue( nt::Value::MakeStringArray(std::move(keys))); - m_table->GetEntry(kDefault).SetString(m_defaultChoice); + subtable->GetEntry(kDefault).SetString(m_defaultChoice); } } diff --git a/wpilibc/src/main/native/include/SmartDashboard/SendableChooserBase.h b/wpilibc/src/main/native/include/SmartDashboard/SendableChooserBase.h index 97c2a4f7f1..ea08cf594c 100644 --- a/wpilibc/src/main/native/include/SmartDashboard/SendableChooserBase.h +++ b/wpilibc/src/main/native/include/SmartDashboard/SendableChooserBase.h @@ -25,7 +25,6 @@ class SendableChooserBase : public Sendable { public: virtual ~SendableChooserBase() = default; - std::shared_ptr GetTable() const override; std::string GetSmartDashboardType() const override; protected: @@ -34,7 +33,6 @@ class SendableChooserBase : public Sendable { static const char* kSelected; std::string m_defaultChoice; - std::shared_ptr m_table; }; } // namespace frc diff --git a/wpilibc/src/main/native/include/Solenoid.h b/wpilibc/src/main/native/include/Solenoid.h index 4b7a3719d7..7c469d8fe9 100644 --- a/wpilibc/src/main/native/include/Solenoid.h +++ b/wpilibc/src/main/native/include/Solenoid.h @@ -38,12 +38,10 @@ class Solenoid : public SolenoidBase, public LiveWindowSendable { void StopLiveWindowMode(); std::string GetSmartDashboardType() const; void InitTable(std::shared_ptr subTable); - std::shared_ptr GetTable() const; private: HAL_SolenoidHandle m_solenoidHandle = HAL_kInvalidHandle; int m_channel; ///< The channel on the module to control. - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; NT_EntryListener m_valueListener = 0; }; diff --git a/wpilibc/src/main/native/include/Ultrasonic.h b/wpilibc/src/main/native/include/Ultrasonic.h index 4864e0e134..22a4d8095d 100644 --- a/wpilibc/src/main/native/include/Ultrasonic.h +++ b/wpilibc/src/main/native/include/Ultrasonic.h @@ -71,7 +71,6 @@ class Ultrasonic : public SensorBase, void StopLiveWindowMode() override; std::string GetSmartDashboardType() const override; void InitTable(std::shared_ptr subTable) override; - std::shared_ptr GetTable() const override; private: void Initialize(); @@ -97,7 +96,6 @@ class Ultrasonic : public SensorBase, Counter m_counter; DistanceUnit m_units; - std::shared_ptr m_table; nt::NetworkTableEntry m_valueEntry; };