Skip to content

Commit

Permalink
[wpilib] Add SmartDashboard::PutData() reference overload
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed Nov 8, 2024
1 parent a66fa33 commit 857c3d8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions wpilibc/src/main/native/cpp/smartdashboard/SmartDashboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ void SmartDashboard::PutData(wpi::Sendable* value) {
}
}

void SmartDashboard::PutData(std::string_view key, wpi::Sendable& data) {
PutData(key, &data);
}

void SmartDashboard::PutData(wpi::Sendable& value) {
PutData(&value);
}

wpi::Sendable* SmartDashboard::GetData(std::string_view key) {
auto& inst = GetInstance();
std::scoped_lock lock(inst.tablesToDataMutex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,34 @@ class SmartDashboard {
*/
static void PutData(wpi::Sendable* value);

/**
* Maps the specified key to the specified value in this table.
*
* The value can be retrieved by calling the get method with a key that is
* equal to the original key.
*
* In order for the value to appear in the dashboard, it must be registered
* with SendableRegistry. WPILib components do this automatically.
*
* @param key the key
* @param data the value
*/
static void PutData(std::string_view key, wpi::Sendable& data);

/**
* Maps the specified key (where the key is the name of the Sendable)
* to the specified value in this table.
*
* The value can be retrieved by calling the get method with a key that is
* equal to the original key.
*
* In order for the value to appear in the dashboard, it must be registered
* with SendableRegistry. WPILib components do this automatically.
*
* @param value the value
*/
static void PutData(wpi::Sendable& value);

/**
* Returns the value at the specified key.
*
Expand Down

0 comments on commit 857c3d8

Please sign in to comment.