mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +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:
@@ -47,13 +47,23 @@ public interface Struct<T> {
|
||||
*/
|
||||
Class<T> getTypeClass();
|
||||
|
||||
/**
|
||||
* Gets the type name (e.g. for schemas of other structs). This should be globally unique among
|
||||
* structs.
|
||||
*
|
||||
* @return type name
|
||||
*/
|
||||
String getTypeName();
|
||||
|
||||
/**
|
||||
* Gets the type string (e.g. for NetworkTables). This should be globally unique and start with
|
||||
* "struct:".
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
String getTypeString();
|
||||
default String getTypeString() {
|
||||
return "struct:" + getTypeName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the serialized size (in bytes). This should always be a constant.
|
||||
|
||||
Reference in New Issue
Block a user