Skip to content

Commit

Permalink
Merge .inc files into headers (wpilibsuite#7215)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul authored Oct 16, 2024
1 parent 40caabe commit fad06ae
Show file tree
Hide file tree
Showing 25 changed files with 914 additions and 1,521 deletions.
17 changes: 12 additions & 5 deletions cameraserver/src/main/native/include/cameraserver/CameraServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <span>
#include <string>
#include <string_view>
#include <vector>

#include <wpi/deprecated.h>

#include "cscore.h"
#include "cscore_cv.h"

namespace frc {
Expand Down Expand Up @@ -130,7 +130,9 @@ class CameraServer {
*/
template <typename T>
[[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]]
static cs::AxisCamera AddAxisCamera(std::initializer_list<T> hosts);
static cs::AxisCamera AddAxisCamera(std::initializer_list<T> hosts) {
return AddAxisCamera("Axis Camera", hosts);
}

/**
* Adds an Axis IP camera.
Expand Down Expand Up @@ -185,7 +187,14 @@ class CameraServer {
template <typename T>
[[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]]
static cs::AxisCamera AddAxisCamera(std::string_view name,
std::initializer_list<T> hosts);
std::initializer_list<T> hosts) {
std::vector<std::string> vec;
vec.reserve(hosts.size());
for (const auto& host : hosts) {
vec.emplace_back(host);
}
return AddAxisCamera(name, vec);
}
WPI_UNIGNORE_DEPRECATED

/**
Expand Down Expand Up @@ -316,5 +325,3 @@ class CameraServer {
};

} // namespace frc

#include "cameraserver/CameraServer.inc"
33 changes: 0 additions & 33 deletions cameraserver/src/main/native/include/cameraserver/CameraServer.inc

This file was deleted.

27 changes: 22 additions & 5 deletions cameraserver/src/main/native/include/vision/VisionRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <functional>
#include <memory>

#include "cscore.h"
#include "cscore_cv.h"
#include "vision/VisionPipeline.h"

Expand Down Expand Up @@ -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
36 changes: 0 additions & 36 deletions cameraserver/src/main/native/include/vision/VisionRunner.inc

This file was deleted.

Loading

0 comments on commit fad06ae

Please sign in to comment.