mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Simplify Sendable interface (#1864)
This removes the name and subsystem from individual objects, and instead puts this data into a new singleton class, SendableRegistry. Much of LiveWindow has been refactored into SendableRegistry. In C++, a new CRTP helper class, SendableHelper, has been added to provide move and destruction functionality. Shims for GetName, SetName, GetSubsystem, and SetSubsystem have been added to Command and Subsystem (both old and new), and also to SendableHelper to prevent code breakage. This deprecates SendableBase in preparation for future removal.
This commit is contained in:
@@ -15,13 +15,14 @@
|
||||
|
||||
#include "frc/ErrorBase.h"
|
||||
#include "frc/smartdashboard/ListenerExecutor.h"
|
||||
#include "frc/smartdashboard/SendableBase.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class Sendable;
|
||||
|
||||
class SmartDashboard : public ErrorBase, public SendableBase {
|
||||
class SmartDashboard : public ErrorBase,
|
||||
public Sendable,
|
||||
public SendableHelper<SmartDashboard> {
|
||||
public:
|
||||
static void init();
|
||||
|
||||
@@ -101,6 +102,9 @@ class SmartDashboard : public ErrorBase, public SendableBase {
|
||||
* 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 keyName the key
|
||||
* @param value the value
|
||||
*/
|
||||
@@ -113,6 +117,9 @@ class SmartDashboard : public ErrorBase, public SendableBase {
|
||||
* 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(Sendable* value);
|
||||
|
||||
Reference in New Issue
Block a user