mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add SmartDashboard::GetEntry function in C++ (#2064)
Existed in Java already.
This commit is contained in:
committed by
Peter Johnson
parent
565e1f3e79
commit
3cce61b89f
@@ -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");
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user