Add SmartDashboard::GetEntry function in C++ (#2064)

Existed in Java already.
This commit is contained in:
Thad House
2019-11-12 17:11:32 -08:00
committed by Peter Johnson
parent 565e1f3e79
commit 3cce61b89f
2 changed files with 15 additions and 0 deletions

View File

@@ -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");

View File

@@ -11,6 +11,7 @@
#include <string>
#include <vector>
#include <networktables/NetworkTableEntry.h>
#include <networktables/NetworkTableValue.h>
#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.
*