Merge .inc files into headers (#7215)

This commit is contained in:
Tyler Veness
2024-10-15 23:42:57 -07:00
committed by GitHub
parent 40caabea23
commit fad06ae1e7
25 changed files with 913 additions and 1520 deletions

View File

@@ -8,7 +8,6 @@
#include <functional>
#include <memory>
#include "cscore.h"
#include "cscore_cv.h"
#include "vision/VisionPipeline.h"
@@ -81,17 +80,35 @@ class VisionRunnerBase {
template <typename T>
class VisionRunner : public VisionRunnerBase {
public:
/**
* Creates a new vision runner. It will take images from the {@code
* videoSource}, send them to the {@code pipeline}, and call the {@code
* listener} when the pipeline has finished to alert user code when it is safe
* to access the pipeline's outputs.
*
* @param videoSource The video source to use to supply images for the
* pipeline
* @param pipeline The vision pipeline to run
* @param listener A function to call after the pipeline has finished
* running
*/
VisionRunner(cs::VideoSource videoSource, T* pipeline,
std::function<void(T&)> listener);
std::function<void(T&)> listener)
: VisionRunnerBase(videoSource),
m_pipeline(pipeline),
m_listener(listener) {}
virtual ~VisionRunner() = default;
protected:
void DoProcess(cv::Mat& image) override;
void DoProcess(cv::Mat& image) override {
m_pipeline->Process(image);
m_listener(*m_pipeline);
}
private:
T* m_pipeline;
std::function<void(T&)> m_listener;
};
} // namespace frc
#include "VisionRunner.inc"
} // namespace frc