mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] Add ReportWarning to MathShared (#3441)
This commit is contained in:
@@ -25,12 +25,19 @@ class MathShared {
|
||||
public:
|
||||
virtual ~MathShared() = default;
|
||||
virtual void ReportErrorV(fmt::string_view format, fmt::format_args args) = 0;
|
||||
virtual void ReportWarningV(fmt::string_view format,
|
||||
fmt::format_args args) = 0;
|
||||
virtual void ReportUsage(MathUsageId id, int count) = 0;
|
||||
|
||||
template <typename S, typename... Args>
|
||||
inline void ReportError(const S& format, Args&&... args) {
|
||||
ReportErrorV(format, fmt::make_args_checked<Args...>(format, args...));
|
||||
}
|
||||
|
||||
template <typename S, typename... Args>
|
||||
inline void ReportWarning(const S& format, Args&&... args) {
|
||||
ReportWarningV(format, fmt::make_args_checked<Args...>(format, args...));
|
||||
}
|
||||
};
|
||||
|
||||
class MathSharedStore {
|
||||
@@ -48,6 +55,15 @@ class MathSharedStore {
|
||||
ReportErrorV(format, fmt::make_args_checked<Args...>(format, args...));
|
||||
}
|
||||
|
||||
static void ReportWarningV(fmt::string_view format, fmt::format_args args) {
|
||||
GetMathShared().ReportWarningV(format, args);
|
||||
}
|
||||
|
||||
template <typename S, typename... Args>
|
||||
static inline void ReportWarning(const S& format, Args&&... args) {
|
||||
ReportWarningV(format, fmt::make_args_checked<Args...>(format, args...));
|
||||
}
|
||||
|
||||
static void ReportUsage(MathUsageId id, int count) {
|
||||
GetMathShared().ReportUsage(id, count);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user