mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[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:
@@ -11,9 +11,7 @@
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::ChassisSpeeds> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:ChassisSpeeds";
|
||||
}
|
||||
static constexpr std::string_view GetTypeName() { return "ChassisSpeeds"; }
|
||||
static constexpr size_t GetSize() { return 24; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
return "double vx;double vy;double omega";
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::DifferentialDriveKinematics> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:DifferentialDriveKinematics";
|
||||
static constexpr std::string_view GetTypeName() {
|
||||
return "DifferentialDriveKinematics";
|
||||
}
|
||||
static constexpr size_t GetSize() { return 8; }
|
||||
static constexpr std::string_view GetSchema() { return "double track_width"; }
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::DifferentialDriveWheelPositions> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:DifferentialDriveWheelPositions";
|
||||
static constexpr std::string_view GetTypeName() {
|
||||
return "DifferentialDriveWheelPositions";
|
||||
}
|
||||
static constexpr size_t GetSize() { return 16; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::DifferentialDriveWheelSpeeds> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:DifferentialDriveWheelSpeeds";
|
||||
static constexpr std::string_view GetTypeName() {
|
||||
return "DifferentialDriveWheelSpeeds";
|
||||
}
|
||||
static constexpr size_t GetSize() { return 16; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::MecanumDriveKinematics> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:MecanumDriveKinematics";
|
||||
static constexpr std::string_view GetTypeName() {
|
||||
return "MecanumDriveKinematics";
|
||||
}
|
||||
static constexpr size_t GetSize() {
|
||||
return 4 * wpi::GetStructSize<frc::Translation2d>();
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::MecanumDriveWheelPositions> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:MecanumDriveWheelPositions";
|
||||
static constexpr std::string_view GetTypeName() {
|
||||
return "MecanumDriveWheelPositions";
|
||||
}
|
||||
static constexpr size_t GetSize() { return 32; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::MecanumDriveWheelSpeeds> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:MecanumDriveWheelSpeeds";
|
||||
static constexpr std::string_view GetTypeName() {
|
||||
return "MecanumDriveWheelSpeeds";
|
||||
}
|
||||
static constexpr size_t GetSize() { return 32; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::SwerveModulePosition> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:SwerveModulePosition";
|
||||
static constexpr std::string_view GetTypeName() {
|
||||
return "SwerveModulePosition";
|
||||
}
|
||||
static constexpr size_t GetSize() {
|
||||
return 8 + wpi::GetStructSize<frc::Rotation2d>();
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::Struct<frc::SwerveModuleState> {
|
||||
static constexpr std::string_view GetTypeString() {
|
||||
return "struct:SwerveModuleState";
|
||||
static constexpr std::string_view GetTypeName() {
|
||||
return "SwerveModuleState";
|
||||
}
|
||||
static constexpr size_t GetSize() {
|
||||
return 8 + wpi::GetStructSize<frc::Rotation2d>();
|
||||
|
||||
Reference in New Issue
Block a user