[wpiutil] Struct: Change from GetTypeString() to GetTypeName() (#6872)

This makes it easier to define schemas when the type name is non-trivial (e.g., templated structs).

This is breaking for a) custom struct implementations and b) anything calling `wpi::Struct<T>::GetTypeString(info...)` in C++ directly. In both cases, it's a simple translation: For A, rename `GetTypeString()` to `GetTypeName()` and remove the struct: at the beginning, and for B, use `wpi::GetStructTypeString<T>(info...)` instead.
This commit is contained in:
Joseph Eng
2024-07-27 20:23:45 -07:00
committed by GitHub
parent 5dcaa6d671
commit 158fb23072
58 changed files with 185 additions and 162 deletions

View File

@@ -11,9 +11,7 @@
template <>
struct WPILIB_DLLEXPORT wpi::Struct<frc::ArmFeedforward> {
static constexpr std::string_view GetTypeString() {
return "struct:ArmFeedforward";
}
static constexpr std::string_view GetTypeName() { return "ArmFeedforward"; }
static constexpr size_t GetSize() { return 32; }
static constexpr std::string_view GetSchema() {
return "double ks;double kg;double kv;double ka";

View File

@@ -11,8 +11,8 @@
template <>
struct WPILIB_DLLEXPORT wpi::Struct<frc::DifferentialDriveWheelVoltages> {
static constexpr std::string_view GetTypeString() {
return "struct:DifferentialDriveWheelVoltages";
static constexpr std::string_view GetTypeName() {
return "DifferentialDriveWheelVoltages";
}
static constexpr size_t GetSize() { return 16; }
static constexpr std::string_view GetSchema() {

View File

@@ -11,8 +11,8 @@
template <>
struct WPILIB_DLLEXPORT wpi::Struct<frc::ElevatorFeedforward> {
static constexpr std::string_view GetTypeString() {
return "struct:ElevatorFeedforward";
static constexpr std::string_view GetTypeName() {
return "ElevatorFeedforward";
}
static constexpr size_t GetSize() { return 32; }
static constexpr std::string_view GetSchema() {