mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
TrajectoryGenerator: Allow replacement of error reporting function (C++) (#2267)
C++ version of #2234.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -114,7 +115,19 @@ class TrajectoryGenerator {
|
||||
return splinePoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set error reporting function. By default, it is output to stderr.
|
||||
*
|
||||
* @param func Error reporting function.
|
||||
*/
|
||||
static void SetErrorHandler(std::function<void(const char*)> func) {
|
||||
s_errorFunc = std::move(func);
|
||||
}
|
||||
|
||||
private:
|
||||
static void ReportError(const char* error);
|
||||
|
||||
static const Trajectory kDoNothingTrajectory;
|
||||
static std::function<void(const char*)> s_errorFunc;
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
Reference in New Issue
Block a user