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:
Peter Johnson
2019-09-14 15:22:54 -05:00
committed by GitHub
parent 1d8c4d016f
commit 471f375a38
216 changed files with 2448 additions and 1433 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -9,6 +9,8 @@
#include <hal/HAL.h>
#include "frc/smartdashboard/SendableRegistry.h"
using namespace frc;
SD540::SD540(int channel) : PWMSpeedController(channel) {
@@ -31,5 +33,5 @@ SD540::SD540(int channel) : PWMSpeedController(channel) {
SetZeroLatch();
HAL_Report(HALUsageReporting::kResourceType_MindsensorsSD540, GetChannel());
SetName("SD540", GetChannel());
SendableRegistry::GetInstance().SetName(this, "SD540", GetChannel());
}