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

@@ -17,6 +17,7 @@
#include "frc/Utility.h"
#include "frc/WPIErrors.h"
#include "frc/smartdashboard/SendableBuilder.h"
#include "frc/smartdashboard/SendableRegistry.h"
using namespace frc;
@@ -46,7 +47,7 @@ PWM::PWM(int channel) {
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
HAL_Report(HALUsageReporting::kResourceType_PWM, channel);
SetName("PWM", channel);
SendableRegistry::GetInstance().AddLW(this, "PWM", channel);
SetSafetyEnabled(false);
}