diff --git a/wpilibc/src/main/native/cpp/smartdashboard/SmartDashboard.cpp b/wpilibc/src/main/native/cpp/smartdashboard/SmartDashboard.cpp index 22ee2971e8..5e70a4c64d 100644 --- a/wpilibc/src/main/native/cpp/smartdashboard/SmartDashboard.cpp +++ b/wpilibc/src/main/native/cpp/smartdashboard/SmartDashboard.cpp @@ -81,6 +81,10 @@ void SmartDashboard::Delete(wpi::StringRef key) { Singleton::GetInstance().table->Delete(key); } +nt::NetworkTableEntry SmartDashboard::GetEntry(wpi::StringRef key) { + return Singleton::GetInstance().table->GetEntry(key); +} + void SmartDashboard::PutData(wpi::StringRef key, Sendable* data) { if (data == nullptr) { wpi_setGlobalWPIErrorWithContext(NullParameter, "value"); diff --git a/wpilibc/src/main/native/include/frc/smartdashboard/SmartDashboard.h b/wpilibc/src/main/native/include/frc/smartdashboard/SmartDashboard.h index 97805ba8e6..9fdc0492e0 100644 --- a/wpilibc/src/main/native/include/frc/smartdashboard/SmartDashboard.h +++ b/wpilibc/src/main/native/include/frc/smartdashboard/SmartDashboard.h @@ -11,6 +11,7 @@ #include #include +#include #include #include "frc/ErrorBase.h" @@ -96,6 +97,16 @@ class SmartDashboard : public ErrorBase, */ static void Delete(wpi::StringRef key); + /** + * Returns an NT Entry mapping to the specified key + * + * This is useful if an entry is used often, or is read and then modified. + * + * @param key the key + * @return the entry for the key + */ + static nt::NetworkTableEntry GetEntry(wpi::StringRef key); + /** * Maps the specified key to the specified value in this table. *