[cscore] Add [[nodiscard]] to GrabFrame functions (#3479)

Closes #3086.
This commit is contained in:
Tyler Veness
2021-07-11 10:41:12 -04:00
committed by GitHub
parent 7a8796414c
commit 9c2723391b
3 changed files with 11 additions and 8 deletions

View File

@@ -152,7 +152,8 @@ class CvSink : public ImageSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
uint64_t GrabFrame(cv::Mat& image, double timeout = 0.225) const;
[[nodiscard]] uint64_t GrabFrame(cv::Mat& image,
double timeout = 0.225) const;
/**
* Wait for the next frame and get the image. May block forever.
@@ -162,7 +163,7 @@ class CvSink : public ImageSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
uint64_t GrabFrameNoTimeout(cv::Mat& image) const;
[[nodiscard]] uint64_t GrabFrameNoTimeout(cv::Mat& image) const;
};
inline CvSource::CvSource(std::string_view name, const VideoMode& mode) {

View File

@@ -174,7 +174,8 @@ class RawSink : public ImageSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
uint64_t GrabFrame(RawFrame& image, double timeout = 0.225) const;
[[nodiscard]] uint64_t GrabFrame(RawFrame& image,
double timeout = 0.225) const;
/**
* Wait for the next frame and get the image. May block forever.
@@ -184,7 +185,7 @@ class RawSink : public ImageSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
uint64_t GrabFrameNoTimeout(RawFrame& image) const;
[[nodiscard]] uint64_t GrabFrameNoTimeout(RawFrame& image) const;
};
inline RawSource::RawSource(std::string_view name, const VideoMode& mode) {

View File

@@ -111,7 +111,7 @@ class RawCvSink : public RawSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
uint64_t GrabFrame(cv::Mat& image, double timeout = 0.225);
[[nodiscard]] uint64_t GrabFrame(cv::Mat& image, double timeout = 0.225);
/**
* Wait for the next frame and get the image. May block forever.
@@ -121,7 +121,7 @@ class RawCvSink : public RawSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
uint64_t GrabFrameNoTimeout(cv::Mat& image);
[[nodiscard]] uint64_t GrabFrameNoTimeout(cv::Mat& image);
/**
* Wait for the next frame and get the image.
@@ -132,7 +132,8 @@ class RawCvSink : public RawSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
uint64_t GrabFrameDirect(cv::Mat& image, double timeout = 0.225);
[[nodiscard]] uint64_t GrabFrameDirect(cv::Mat& image,
double timeout = 0.225);
/**
* Wait for the next frame and get the image. May block forever.
@@ -142,7 +143,7 @@ class RawCvSink : public RawSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
uint64_t GrabFrameNoTimeoutDirect(cv::Mat& image);
[[nodiscard]] uint64_t GrabFrameNoTimeoutDirect(cv::Mat& image);
private:
RawFrame rawFrame;