From c7524b10e0a07623b8fbb2c4becfd01ca9cb936a Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Tue, 15 Nov 2022 09:07:50 +0000 Subject: pipeline: raspberrypi: delayed_controls: Template the ControlRingBuffer class Convert ControlRingBuffer to a templated class to allow arbitrary ring buffer array types to be defined. Rename ControlRingBuffer to RingBuffer to indicate this. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Signed-off-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/delayed_controls.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/libcamera/pipeline/raspberrypi/delayed_controls.h b/src/libcamera/pipeline/raspberrypi/delayed_controls.h index f7f24648..238b86ab 100644 --- a/src/libcamera/pipeline/raspberrypi/delayed_controls.h +++ b/src/libcamera/pipeline/raspberrypi/delayed_controls.h @@ -56,17 +56,18 @@ private: }; static constexpr int listSize = 16; - class ControlRingBuffer : public std::array + template + class RingBuffer : public std::array { public: - Info &operator[](unsigned int index) + T &operator[](unsigned int index) { - return std::array::operator[](index % listSize); + return std::array::operator[](index % listSize); } - const Info &operator[](unsigned int index) const + const T &operator[](unsigned int index) const { - return std::array::operator[](index % listSize); + return std::array::operator[](index % listSize); } }; @@ -76,7 +77,7 @@ private: uint32_t queueCount_; uint32_t writeCount_; - std::unordered_map values_; + std::unordered_map> values_; }; } /* namespace RPi */ -- cgit v1.2.1