mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[commands] Add GetName to Subsystem, use in Scheduler tracer epochs (#5836)
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace wpi {
|
||||
|
||||
@@ -18,6 +19,15 @@ namespace wpi {
|
||||
*/
|
||||
std::string Demangle(std::string_view mangledSymbol);
|
||||
|
||||
/**
|
||||
* Returns the type name of an object
|
||||
* @param type The object
|
||||
*/
|
||||
template <typename T>
|
||||
std::string GetTypeName(const T& type) {
|
||||
return Demangle(typeid(type).name());
|
||||
}
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
#endif // WPIUTIL_WPI_DEMANGLE_H_
|
||||
|
||||
Reference in New Issue
Block a user